/* ==========================================
   🔥 FIREBASE AUTH UI - STYLES v2.0
   Themes: dark-gold (HariOom), medical-blue (GetCheckupX)
   ========================================== */

/* ---- CSS Variables by Theme ---- */
.auth-theme-dark-gold {
  --auth-bg: rgba(6, 13, 26, 0.97);
  --auth-card-bg: linear-gradient(145deg, #0d1f3a 0%, #162a4a 50%, #0d1f3a 100%);
  --auth-card-border: rgba(212, 160, 32, 0.35);
  --auth-card-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px rgba(212, 160, 32, 0.08);
  --auth-primary: #d4a020;
  --auth-primary-hover: #e8b52a;
  --auth-primary-text: #060d1a;
  --auth-accent: #4a9eff;
  --auth-text: #dce8f5;
  --auth-text-muted: #8a9ab5;
  --auth-input-bg: rgba(255, 255, 255, 0.06);
  --auth-input-border: rgba(212, 160, 32, 0.25);
  --auth-input-focus: rgba(212, 160, 32, 0.5);
  --auth-error: #ff6b6b;
  --auth-success: #51cf66;
  --auth-divider: rgba(212, 160, 32, 0.15);
  --auth-font: 'DM Sans', 'Noto Sans Telugu', sans-serif;
}

.auth-theme-medical-blue {
  --auth-bg: rgba(10, 15, 30, 0.97);
  --auth-card-bg: linear-gradient(145deg, #0f1b2e 0%, #162640 50%, #0f1b2e 100%);
  --auth-card-border: rgba(59, 130, 246, 0.3);
  --auth-card-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(59, 130, 246, 0.08);
  --auth-primary: #3b82f6;
  --auth-primary-hover: #60a5fa;
  --auth-primary-text: #ffffff;
  --auth-accent: #06b6d4;
  --auth-text: #e2e8f0;
  --auth-text-muted: #94a3b8;
  --auth-input-bg: rgba(255, 255, 255, 0.06);
  --auth-input-border: rgba(59, 130, 246, 0.25);
  --auth-input-focus: rgba(59, 130, 246, 0.5);
  --auth-error: #f87171;
  --auth-success: #34d399;
  --auth-divider: rgba(59, 130, 246, 0.15);
  --auth-font: 'DM Sans', system-ui, sans-serif;
}

/* ==========================================
   MODAL OVERLAY
   ========================================== */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  font-family: var(--auth-font);
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: var(--auth-bg);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.auth-modal-active .auth-backdrop {
  opacity: 1;
}

.auth-container {
  position: relative;
  width: 92%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  border-radius: 20px;
  box-shadow: var(--auth-card-shadow);
  padding: 32px 28px;
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-active .auth-container {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Scrollbar */
.auth-container::-webkit-scrollbar { width: 4px; }
.auth-container::-webkit-scrollbar-thumb { background: var(--auth-card-border); border-radius: 4px; }
.auth-container::-webkit-scrollbar-track { background: transparent; }

/* Close button */
.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--auth-text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
  transition: all 0.2s;
  z-index: 10;
}
.auth-close:hover {
  color: var(--auth-text);
  background: rgba(255,255,255,0.08);
}

/* ==========================================
   HEADER
   ========================================== */
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  font-size: 42px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(212, 160, 32, 0.3));
  animation: authPulse 3s ease-in-out infinite;
}

@keyframes authPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--auth-text);
  margin: 0 0 4px;
  letter-spacing: 0.3px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--auth-text-muted);
  margin: 0;
}

/* ==========================================
   TABS
   ========================================== */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--auth-text-muted);
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.auth-tab.active {
  background: var(--auth-primary);
  color: var(--auth-primary-text);
  box-shadow: 0 4px 16px rgba(212, 160, 32, 0.25);
}

.auth-tab:not(.active):hover {
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.06);
}

/* ==========================================
   SOCIAL LOGIN
   ========================================== */
.auth-social {
  margin-bottom: 4px;
}

.auth-btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.auth-btn-google:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.auth-btn-google svg {
  flex-shrink: 0;
}

/* ==========================================
   DIVIDER
   ========================================== */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-divider);
}

.auth-divider span {
  font-size: 11px;
  color: var(--auth-text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

/* ==========================================
   FORM FIELDS
   ========================================== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--auth-text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-field input {
  padding: 12px 14px;
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-input-border);
  border-radius: 10px;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 15px;
  outline: none;
  transition: all 0.25s ease;
}

.auth-field input::placeholder {
  color: var(--auth-text-muted);
  opacity: 0.6;
}

.auth-field input:focus {
  border-color: var(--auth-input-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(212, 160, 32, 0.1);
}

/* Phone row */
.auth-phone-row {
  display: flex;
  gap: 8px;
}

.auth-country-select {
  width: 110px;
  padding: 12px 8px;
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-input-border);
  border-radius: 10px;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: all 0.25s;
}

.auth-country-select:focus {
  border-color: var(--auth-input-focus);
}

.auth-country-select option {
  background: #0d1f3a;
  color: var(--auth-text);
}

.auth-phone-row input {
  flex: 1;
}

/* OTP inputs */
.auth-otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.auth-otp-digit {
  width: 46px;
  height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--auth-primary);
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-input-border);
  border-radius: 10px;
  outline: none;
  transition: all 0.25s;
  font-family: var(--auth-font);
}

.auth-otp-digit:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(212, 160, 32, 0.15);
  transform: scale(1.05);
}

/* ==========================================
   BUTTONS
   ========================================== */
.auth-btn-primary {
  width: 100%;
  padding: 13px 20px;
  background: var(--auth-primary);
  color: var(--auth-primary-text);
  border: none;
  border-radius: 12px;
  font-family: var(--auth-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
}

.auth-btn-primary:hover {
  background: var(--auth-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 160, 32, 0.3);
}

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

.auth-btn-secondary {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  color: var(--auth-primary);
  border: 1.5px solid var(--auth-card-border);
  border-radius: 12px;
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.auth-btn-secondary:hover {
  background: rgba(212, 160, 32, 0.1);
  border-color: var(--auth-primary);
}

.auth-btn-link {
  background: none;
  border: none;
  color: var(--auth-accent);
  font-family: var(--auth-font);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-align: center;
  transition: color 0.2s;
}

.auth-btn-link:hover {
  color: var(--auth-primary);
  text-decoration: underline;
}

/* ==========================================
   LOADING SPINNER
   ========================================== */
.auth-loading {
  position: absolute;
  inset: 0;
  background: rgba(6, 13, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 20px;
  z-index: 20;
  color: var(--auth-text-muted);
  font-size: 14px;
  backdrop-filter: blur(4px);
}

.auth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(212, 160, 32, 0.2);
  border-top-color: var(--auth-primary);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   ERROR DISPLAY
   ========================================== */
.auth-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: 10px;
  color: var(--auth-error);
  font-size: 13px;
  text-align: center;
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================
   USER MENU (Top-Right Floating)
   ========================================== */
.auth-user-menu {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99990;
  font-family: var(--auth-font, 'DM Sans', sans-serif);
}

.auth-user-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(212, 160, 32, 0.4);
  background: linear-gradient(135deg, #0d1f3a, #162a4a);
  color: #d4a020;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.auth-user-btn:hover {
  border-color: #d4a020;
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(212, 160, 32, 0.2);
}

.auth-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 18px;
}

.auth-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: linear-gradient(145deg, #0d1f3a, #162a4a);
  border: 1px solid rgba(212, 160, 32, 0.25);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  padding: 8px;
  animation: authDropdownIn 0.2s ease;
}

@keyframes authDropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-user-info {
  padding: 10px 12px;
}

.auth-user-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #dce8f5;
}

.auth-user-email {
  display: block;
  font-size: 11px;
  color: #8a9ab5;
  margin-top: 2px;
}

.auth-user-divider {
  border: none;
  height: 1px;
  background: rgba(212, 160, 32, 0.12);
  margin: 4px 8px;
}

.auth-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #a0c4e8;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-menu-item:hover {
  background: rgba(212, 160, 32, 0.1);
  color: #dce8f5;
}

.auth-menu-item.auth-logout {
  color: #ff8a8a;
}
.auth-menu-item.auth-logout:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
}

/* ==========================================
   AUTH GATE (Full-screen login required)
   ========================================== */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(6, 13, 26, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(20px);
}

.auth-gate-content {
  text-align: center;
  padding: 40px;
}

.auth-gate-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: authPulse 3s ease-in-out infinite;
}

.auth-gate-content h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #dce8f5;
  margin: 0 0 8px;
}

.auth-gate-content p {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: #8a9ab5;
  margin: 0 0 24px;
}

.auth-gate-content .auth-btn-primary {
  max-width: 260px;
  margin: 0 auto;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.auth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  z-index: 999999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.auth-toast-success {
  background: linear-gradient(135deg, #0d3320, #1a4a30);
  border: 1px solid rgba(81, 207, 102, 0.3);
  color: #51cf66;
}

.auth-toast-error {
  background: linear-gradient(135deg, #3d1111, #4a1a1a);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
}

.auth-toast-warning {
  background: linear-gradient(135deg, #3d2e0d, #4a380f);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

.auth-toast-info {
  background: linear-gradient(135deg, #0d1f3a, #162a4a);
  border: 1px solid rgba(74, 158, 255, 0.3);
  color: #4a9eff;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 480px) {
  .auth-container {
    width: 96%;
    padding: 24px 18px;
    border-radius: 16px;
    max-height: 95vh;
  }
  
  .auth-otp-digit {
    width: 38px;
    height: 44px;
    font-size: 18px;
  }
  
  .auth-user-menu {
    top: 8px;
    right: 8px;
  }
  
  .auth-user-btn {
    width: 36px;
    height: 36px;
  }
  
  .auth-toast {
    width: 90%;
    white-space: normal;
    text-align: center;
  }
}
