/**
 * KejaMarket – Authentication Modal (Clean Single-Column Design v4)
 * No hero sidebar. Premium centered card with emerald accents on interactive elements only.
 */

/* ============================================================================
   1. BACKDROP
   ============================================================================ */
#modal-auth {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#modal-auth.open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ============================================================================
   2. MODAL CARD
   ============================================================================ */
.auth-modal-wrapper {
  width: 100%;
  max-width: 480px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  animation: authModalEntrance 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authModalEntrance {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0,0,0,0.06);
  width: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

/* Hero removed — hide if accidentally rendered */
.auth-modal-hero { display: none !important; }

/* ============================================================================
   3. FORM BODY
   ============================================================================ */
.auth-modal-body {
  padding: 1.5rem 2.25rem 2rem;
  position: relative;
  overflow-y: auto;
  flex: 1;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.auth-modal-body::-webkit-scrollbar {
  width: 4px;
}
.auth-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.auth-modal-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* Accent bar at top */
.auth-modal-body::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: linear-gradient(90deg, #059669, #34d399);
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

/* Close Button */
.auth-close-btn {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: rotate(90deg);
  border-color: #cbd5e1;
}

/* ============================================================================
   4. TAB NAVIGATION
   ============================================================================ */
.auth-tabs-nav {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.6rem;
  gap: 2px;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 0.84rem;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: #047857;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-tab-btn:hover:not(.active) { color: #334155; }

/* ============================================================================
   5. PANELS
   ============================================================================ */
.auth-panel {
  display: none;
  flex-direction: column;
}

.auth-panel.active {
  display: flex;
  animation: authPanelFade 0.2s ease-out;
}

@keyframes authPanelFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================================
   7. DIVIDER
   ============================================================================ */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.1rem 0;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.auth-divider span { padding: 0 0.75rem; }

/* ============================================================================
   8. FORM GROUPS & INPUTS
   ============================================================================ */
.form-group { margin-bottom: 0.75rem; }

.form-group label {
  display: block;
  font-size: 0.81rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.38rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.38rem;
}

.label-row label { margin-bottom: 0; }

.auth-link-subtle {
  font-size: 0.78rem;
  font-weight: 600;
  color: #059669;
  text-decoration: none;
}

.auth-link-subtle:hover { text-decoration: underline; }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.875rem;
  color: #9ca3af;
  font-size: 0.875rem;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 1;
}

.input-group input,
.custom-select-input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 0.875rem;
  color: #111827;
  background: #fafafa;
  transition: all 0.2s ease;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.input-group input:focus,
.custom-select-input:focus {
  outline: none;
  border-color: #059669;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.input-group:focus-within .input-icon { color: #059669; }

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  font-size: 0.875rem;
  transition: color 0.2s;
  z-index: 1;
}

.password-toggle:hover { color: #4b5563; }

/* Phone Input */
.phone-input-group { display: flex; align-items: center; }

.phone-prefix-badge {
  position: absolute;
  left: 0.55rem;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #374151;
  border: 1px solid #e5e7eb;
  pointer-events: none;
  font-weight: 600;
  white-space: nowrap;
}

.phone-input-group input { padding-left: 5.2rem !important; }

/* Two column row */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ============================================================================
   9. ROLE CARDS
   ============================================================================ */
.role-selection-wrapper { margin-bottom: 0.8rem; }

.form-label-section {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.role-card-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  position: relative;
  font-family: inherit;
}

.role-card-btn:hover {
  border-color: #6ee7b7;
  background: #f0fdf4;
}

.role-card-btn.active {
  background: #ecfdf5;
  border-color: #059669;
  box-shadow: 0 0 0 1px #059669;
}

.role-icon-box {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #ffffff;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
  transition: all 0.18s;
}

.role-card-btn.active .role-icon-box {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

.role-card-info strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.role-card-info span {
  display: block;
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.3;
}

.role-check-indicator {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #059669;
  color: #ffffff;
  font-size: 0.6rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.role-card-btn.active .role-check-indicator { display: flex; }

/* ============================================================================
   10. PASSWORD STRENGTH
   ============================================================================ */
.password-strength-container {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.strength-bars { flex: 1; display: flex; gap: 4px; }

.strength-bar-segment {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background 0.3s;
}

.strength-label-text {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #9ca3af;
  min-width: 40px;
}

.strength-weak #strength-seg-1 { background: #ef4444; }
.strength-weak .strength-label-text { color: #ef4444; }

.strength-medium #strength-seg-1,
.strength-medium #strength-seg-2 { background: #f59e0b; }
.strength-medium .strength-label-text { color: #d97706; }

.strength-strong #strength-seg-1,
.strength-strong #strength-seg-2,
.strength-strong #strength-seg-3 { background: #10b981; }
.strength-strong .strength-label-text { color: #059669; }

.password-match-icon {
  position: absolute;
  right: 2.5rem;
  color: #10b981;
  font-size: 0.875rem;
}

/* ============================================================================
   11. CHECKBOXES
   ============================================================================ */
.form-options { margin: 0.75rem 0 1.1rem; }

.remember-me-label,
.terms-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #4b5563;
  cursor: pointer;
  line-height: 1.4;
}

.remember-me-label input,
.terms-checkbox-label input {
  margin-top: 2px;
  accent-color: #059669;
  cursor: pointer;
  flex-shrink: 0;
}

.terms-checkbox-label a {
  color: #059669;
  font-weight: 600;
  text-decoration: underline;
}

/* ============================================================================
   12. SUBMIT BUTTON
   ============================================================================ */
.auth-btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.825rem 1.25rem;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
  font-family: inherit;
  letter-spacing: 0.01em;
}

.auth-btn-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

.auth-btn-primary:active { transform: translateY(0); }

.auth-btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================================
   13. FOOTER PROMPT
   ============================================================================ */
.auth-footer-prompt {
  text-align: center;
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: #6b7280;
}

.auth-footer-prompt a {
  color: #059669;
  font-weight: 700;
  text-decoration: none;
  margin-left: 3px;
}

.auth-footer-prompt a:hover { text-decoration: underline; }

/* ============================================================================
   14. ALERT BOX
   ============================================================================ */
.auth-alert-box {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
}

.auth-alert-box.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.auth-alert-box.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.auth-alert-box.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ============================================================================
   15. FORGOT PASSWORD PANEL
   ============================================================================ */
.forgot-header { margin-bottom: 1.25rem; }

.back-to-signin-btn {
  background: none;
  border: none;
  color: #059669;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.75rem;
  padding: 0;
  font-family: inherit;
}

.back-to-signin-btn:hover { text-decoration: underline; }

.forgot-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 0.35rem 0;
}

.forgot-header p {
  font-size: 0.84rem;
  color: #6b7280;
  line-height: 1.45;
  margin: 0;
}

.forgot-success-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  text-align: center;
}

.success-icon-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin: 0 auto 0.75rem;
}

.forgot-success-box h4 {
  font-size: 1rem;
  font-weight: 800;
  color: #065f46;
  margin: 0 0 0.35rem;
}

.forgot-success-box p {
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.4;
  margin: 0;
}

/* ============================================================================
   16. SELECT DROPDOWN
   ============================================================================ */
.custom-select-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.25rem !important;
}

/* ============================================================================
   17. RESPONSIVE — MOBILE BOTTOM SHEET
   ============================================================================ */
@media (max-width: 520px) {
  #modal-auth {
    padding: 0;
    align-items: flex-end;
  }

  .auth-modal-wrapper {
    max-width: 100%;
    max-height: 96vh;
  }

  .auth-modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 96vh;
  }

  .auth-modal-body {
    padding: 1.25rem 1.1rem 1.75rem;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-group { margin-bottom: 0.6rem; }

  .role-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .role-card-btn {
    padding: 0.5rem 0.6rem;
  }

  .auth-btn-primary {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 360px) {
  .role-cards-grid { grid-template-columns: 1fr; }
}


