/* FILE: /assets/auth/css/auth.css
   Єдиний дизайн логіну + реєстрації MedOnline.
   Mobile-first, спліт-лейаут (бренд-панель + форма), світла/темна тема,
   стримані «живі» анімації. Стиль: accessible + minimal.
   Сумісно з наявними класами form_group / form_label / form_input,
   id #submit_btn / #error і компонентом .custom-select. */

:root {
  --bg:            #f4faf8;
  --surface:       #ffffff;
  --surface-2:     #f0f6f4;
  --fg:            #122e2a;
  --muted:         #4f6b66;
  --border:        #dde8e5;
  --primary:       #10b981;   /* бренд-зелений — головний CTA */
  --primary-strong:#0c9f6e;
  --on-primary:    #ffffff;
  --accent:        #0891b2;   /* cyan — лінки/акцент */
  --ring:          rgba(8,145,178,.30);
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;

  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 10px 30px -12px rgba(13,60,52,.22);
  --shadow-card:   0 18px 50px -20px rgba(13,60,52,.28);

  --ease:          cubic-bezier(.4,0,.2,1);
  --t:             .2s var(--ease);

  --font-head:     'Ubuntu', system-ui, sans-serif;
  --font-body:     'Raleway', system-ui, sans-serif;
}

body.dark-mode {
  --bg:            #0b1413;
  --surface:       #121e1c;
  --surface-2:     #182825;
  --fg:            #e9f2f0;
  --muted:         #9db4af;
  --border:        #243733;
  --primary:       #2f9e7b;
  --primary-strong:#277f64;
  --on-primary:    #ffffff;
  --accent:        #5fa6c2;
  --ring:          rgba(56,189,248,.38);
  --danger:        #f87171;
  --danger-bg:     #2a1414;
  --shadow:        0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-card:   0 18px 50px -20px rgba(0,0,0,.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.auth {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ============== LAYOUT (centered, single column) ============== */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-panel {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
}
.auth-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.auth-logo-sm { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); font-family: var(--font-head); font-weight: 700; }
.auth-logo-sm img { width: 28px; height: 28px; }

.theme-toggle {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--t), border-color var(--t), transform var(--t);
}
.theme-toggle:hover { color: var(--accent); transform: rotate(15deg); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
body.dark-mode .theme-toggle .icon-sun  { display: none; }
body.dark-mode .theme-toggle .icon-moon { display: inline; }

.auth-card {
  width: 100%;
  max-width: 440px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(22px, 5vw, 36px);
  animation: cardIn .5s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth-card__title {
  font-family: var(--font-head);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: -.3px;
}
.auth-card__sub { margin-top: 6px; margin-bottom: 22px; color: var(--muted); font-size: 14.5px; }

/* ============== FORM ============== */
.form_group { margin-bottom: 18px; }
.form_label {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
  letter-spacing: .1px;
}
.form_input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 16px;                /* ≥16px — без авто-зуму на iOS */
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.form_input::placeholder { color: var(--muted); opacity: .7; }
.form_input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

/* password show/hide */
.pw-wrap { position: relative; }
.pw-wrap .form_input { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 0; right: 0;
  width: 46px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer; color: var(--muted);
  transition: color var(--t);
}
.pw-toggle:hover { color: var(--accent); }
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.is-shown .icon-eye    { display: none; }
.pw-toggle.is-shown .icon-eye-off { display: inline; }

/* submit */
#submit_btn {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .3px;
  color: var(--on-primary);
  background: var(--primary);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t), transform .06s var(--ease);
}
#submit_btn:hover { background: var(--primary-strong); }
#submit_btn:active { transform: translateY(1px); }
#submit_btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
#submit_btn:disabled { opacity: .65; cursor: default; transform: none; }

/* error */
#error, #error_box {
  margin: 4px 0 14px;
  padding: 11px 14px;
  background: var(--danger-bg);
  border: 1px solid rgba(220,38,38,.35);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}
#error_box #error { margin: 0; padding: 0; background: none; border: 0; }

/* alt link + terms */
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

#terms_check { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; }
#terms_check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--primary); cursor: pointer; }
#terms_text { font-size: 12.5px; line-height: 1.5; color: var(--muted); cursor: pointer; }
#terms_text a { color: var(--accent); text-decoration: none; }
#terms_text a:hover { text-decoration: underline; }

.auth-foot { margin-top: 22px; text-align: center; }
.auth-foot a { color: var(--muted); font-size: 12.5px; text-decoration: none; margin: 0 8px; }
.auth-foot a:hover { color: var(--accent); }

/* ============== CUSTOM SELECT (study + source) ============== */
.custom-select { position: relative; user-select: none; }
.custom-select-btn {
  height: 48px;
  padding: 0 40px 0 14px;
  display: flex; align-items: center;
  font-size: 15px;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.custom-select-btn::after {
  content: ""; position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px; margin-top: -5px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform var(--t);
}
.custom-select.open .custom-select-btn { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.custom-select.open .custom-select-btn::after { transform: rotate(-135deg); margin-top: -2px; }
.custom-select-options {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 240px; overflow-y: auto;
  z-index: 50;
  display: none;
}
.custom-select.open .custom-select-options { display: block; animation: cardIn .16s var(--ease) both; }
.custom-select-option { padding: 11px 14px; font-size: 14.5px; cursor: pointer; transition: background var(--t); }
.custom-select-option:hover { background: var(--surface-2); color: var(--accent); }

/* ============== REDUCED MOTION ============== */
@media (prefers-reduced-motion: reduce) {
  .auth-card, .custom-select.open .custom-select-options { animation: none; }
  * { transition-duration: .01ms !important; }
}
