/* ============================================================
   assets/css/auth.css
   Styles shared by: login.php, forgot-password.php,
   reset-password.php, verify-2fa.php, setup-2fa.php
   ============================================================ */

/* ---- CSS Variables ---------------------------------------- */
:root {
  --color-bg:           #eef1f7;
  --color-surface:      #ffffff;
  --color-primary:      #006666;
  --color-primary-dark: #004d4d;
  --color-accent:       #008080;
  --color-accent-hover: #006666;
  --color-text:         #1e2535;
  --color-muted:        #6b7a99;
  --color-border:       #dde3f0;
  --color-error-bg:     #fff0f0;
  --color-error:        #c0392b;
  --color-success-bg:   #f0fff4;
  --color-success:      #1a7f4b;

  --radius-card:   16px;
  --radius-input:  8px;
  --radius-btn:    8px;

  --shadow-card:   0 8px 40px rgba(0,102,102,.13);
  --shadow-btn:    0 4px 14px rgba(0,128,128,.30);

  --font-body:     'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-display:  'Playfair Display', Georgia, serif;

  --transition:    0.18s ease;
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
}

/* ---- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ---- Auth wrapper ----------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* Left decorative panel */
.auth-panel {
  display: none;
  flex: 0 0 420px;
  background: var(--color-primary);
  background-image:
    radial-gradient(ellipse at 20% 60%, rgba(0,128,128,.35) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
  padding: 56px 48px;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

@media (min-width: 900px) {
  .auth-panel { display: flex; }
}

.auth-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 39px,
    rgba(255,255,255,.03) 39px, rgba(255,255,255,.03) 40px
  ), repeating-linear-gradient(
    90deg, transparent, transparent 39px,
    rgba(255,255,255,.03) 39px, rgba(255,255,255,.03) 40px
  );
  pointer-events: none;
}

.panel-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.panel-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255,255,255,.1);
}

.panel-logo-fallback {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}

.panel-wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
  letter-spacing: .02em;
}

.panel-headline {
  position: relative;
}

.panel-headline h2 {
  font-family: var(--font-display);
  font-size: 32px;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 16px;
}

.panel-headline p {
  color: rgba(255,255,255,.65);
  line-height: 1.7;
  font-size: 14px;
}

.panel-quote {
  position: relative;
  border-left: 3px solid rgba(255,255,255,.2);
  padding-left: 20px;
}

.panel-quote blockquote {
  font-style: italic;
  color: rgba(255,255,255,.75);
  font-size: 14px;
  line-height: 1.7;
}

.panel-quote cite {
  display: block;
  margin-top: 10px;
  color: rgba(255,255,255,.4);
  font-size: 12px;
  font-style: normal;
}

/* Right form side */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 44px 40px;
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px; }
}

/* ---- Auth card header ------------------------------------- */
.auth-card-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-card-logo-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--color-bg);
}

.auth-card-logo-fallback {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.auth-card-logo-wordmark {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-primary);
  font-weight: 600;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ---- Form elements ---------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0,128,128,.12);
  background: #fff;
}

.form-input.is-error {
  border-color: var(--color-error);
}

/* OTP / code input */
.otp-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: .3em;
  font-weight: 600;
}

/* Password wrapper with show/hide */
.password-wrapper {
  position: relative;
}

.password-wrapper .form-input {
  padding-right: 44px;
}

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.btn-toggle-pass:hover { color: var(--color-primary); }

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
  margin-top: 10px;
}

.btn-secondary:hover { background: var(--color-border); }

.btn-danger {
  background: #c0392b;
  color: #fff;
  margin-top: 10px;
}

.btn-danger:hover { background: #a93226; }

/* ---- Alerts / messages ------------------------------------ */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(192,57,43,.2);
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(26,127,75,.2);
}

.alert-info {
  background: #f0f5ff;
  color: #006666;
  border: 1px solid rgba(0,128,128,.2);
}

/* ---- Misc ------------------------------------------------- */
.form-footer {
  margin-top: 24px;
  text-align: center;
}

.auth-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

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

.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 22px 0;
}

/* QR code area */
.qr-container {
  text-align: center;
  margin: 20px 0;
  padding: 20px;
  background: var(--color-bg);
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.qr-container img {
  max-width: 200px;
  height: auto;
  border: 4px solid #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

.secret-box {
  background: var(--color-primary);
  color: #e8edff;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: .15em;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  word-break: break-all;
  margin: 12px 0;
  user-select: all;
}

.steps-list {
  padding-left: 0;
  list-style: none;
  counter-reset: steps;
}

.steps-list li {
  counter-increment: steps;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--color-muted);
  line-height: 1.5;
}

.steps-list li::before {
  content: counter(steps);
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

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

/* Hide JS spinner by default */
.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: .6; }

/* Fix card logo alignment */
.auth-card-logo { justify-content: center; margin-bottom: 24px; }
.auth-card-logo-img { width: 52px; height: 52px; border-radius: 50%; object-fit: contain; }
.auth-card-logo-wordmark { font-size: 22px; font-weight: 600; color: var(--color-primary); }
