/* =========================================================================
   TekSathi - auth.css
   Styles for the Member Auth Modal and Fallback Auth Pages.
   Supports Light and Dark modes dynamically via CSS variables from style.css.
   ========================================================================= */

/* ---------- Modal Container & Backdrop ---------- */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 19, 0.82);
  backdrop-filter: blur(8px);
}

body.light-mode .auth-modal-overlay {
  background: rgba(16, 34, 56, 0.45);
  backdrop-filter: blur(8px);
}

.auth-modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 2;
  animation: authModalFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}

.auth-modal-close:hover {
  color: var(--text);
  transform: scale(1.1);
}

.auth-modal-body {
  padding: 34px 28px 28px;
  max-height: 90vh;
  overflow-y: auto;
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-modal-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
}

.auth-modal-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-modal-header p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Fallback Auth Pages ---------- */
.auth-page-section {
  padding: 80px 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.auth-page-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-page-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 34px;
  box-shadow: var(--shadow);
}

.auth-page-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-page-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: #fff;
  padding: 5px;
}

.auth-page-header h2 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-page-header p {
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
}

/* ---------- Auth Form Component ---------- */
.auth-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.auth-tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.auth-tab-btn:hover {
  color: var(--text);
}

.auth-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Login Method Toggle */
.login-toggle-wrap {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}

.login-toggle-lbl {
  flex: 1;
  cursor: pointer;
  text-align: center;
}

.login-toggle-lbl input {
  display: none;
}

.login-toggle-lbl span {
  display: block;
  padding: 8px;
  border-radius: 9px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}

.login-toggle-lbl input:checked + span {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

body.light-mode .login-toggle-lbl input:checked + span {
  background: #fff;
  box-shadow: 0 2px 6px rgba(16,34,56,0.08);
}

/* Form Groups & Grid */
.auth-fgroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.auth-fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 580px) {
  .auth-fgrid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.auth-fgroup label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.94rem;
  outline: 0;
  transition: border-color 0.25s, box-shadow 0.25s;
}

body.light-mode .auth-input {
  background: var(--surface-2);
}

.auth-input:focus {
  border-color: rgba(31, 143, 229, 0.5);
  box-shadow: 0 0 0 3px rgba(31, 143, 229, 0.12);
}

.auth-input.error-input {
  border-color: #ff4a4a !important;
  box-shadow: 0 0 0 3px rgba(255, 74, 74, 0.12) !important;
}

.auth-error-feedback {
  font-size: 0.78rem;
  color: #ff4a4a;
  font-weight: 600;
  margin-top: 2px;
}

/* Buttons & Links */
.auth-submit-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.96rem;
  border-radius: 12px;
  margin-top: 8px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.auth-link {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
}

.auth-link:hover {
  opacity: 0.85;
}

.auth-remember-row {
  margin-bottom: 12px;
}

.auth-check-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.auth-check-lbl input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Alerts */
.auth-alert {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  animation: authAlertShake 0.4s ease;
}

.auth-alert.alert-danger {
  background: rgba(255, 74, 74, 0.12);
  border: 1px solid rgba(255, 74, 74, 0.25);
  color: #ff5f5f;
}

body.light-mode .auth-alert.alert-danger {
  color: #d32f2f;
}

.auth-alert.alert-success {
  background: rgba(89, 184, 12, 0.12);
  border: 1px solid rgba(89, 184, 12, 0.25);
  color: var(--green);
}

/* Sections & Back links */
.auth-section-title {
  margin-bottom: 16px;
}

.auth-section-title h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-section-title p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.auth-back-link {
  margin-bottom: 12px;
}

.auth-back-link .auth-link {
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Spinners */
.auth-spinner {
  font-size: 0.95rem;
}

/* Animations */
@keyframes authModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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