/* ================================================================
 * auth.css — Login / Register / Forgot Password
 * Font: Roboto | Nền: Trắng | Accent: Đỏ #e53935
 * ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

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

body {
  font-family: 'Roboto', sans-serif;
  font-size: var(--fs-sm);
  color: var(--text);
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* ── LEFT PANEL ─────────────────────────────────────────────────── */
.left {
  width: 420px;
  min-width: 420px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 56px 48px;
  position: relative;
  align-items: center;
}

/* Dải đỏ trên cùng */
.left::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--red);
}

.brand-logo {
  display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    align-content: center;
    flex-direction: column;
}
.brand-icon-box {
  width: 48px; height: 48px;
  background: var(--red);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon-box svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { font-size: var(--fs-xl); font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.brand-text span { color: var(--red); }
.mobile-logo { display: none !important; }

.brand-tagline {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 40px;
  text-align: center;
  width: 100%;
}

/* Feature list */
.feature-list { display: flex; flex-direction: column; gap: 20px; }
.feature-item  { display: flex; align-items: flex-start; gap: 14px; }
.fi-icon {
  width: 36px; height: 36px;
  background: var(--red-soft);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fi-icon svg { width: 16px; height: 16px; stroke: var(--red); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fi-title { font-size: var(--fs-sm); font-weight: 500; color: var(--text); margin-bottom: 2px; }
.fi-desc  { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Bottom link */
.left-footer {
  /*margin-top: auto;*/
  /*padding-top: 32px;*/
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  width: 100%;
}
.left-footer a { color: var(--red); text-decoration: none; }
.left-footer a:hover { text-decoration: underline; }

/* ── RIGHT PANEL ────────────────────────────────────────────────── */
.right {
  flex: 1;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.form-wrap {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  padding: 36px 40px 32px;
}

/* ── TABS ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 10px 8px;
  font-family: 'Roboto', sans-serif;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }

/* ── PANELS ──────────────────────────────────────────────────────── */
.panel        { display: none; }
.panel.active { display: block; }

.panel-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 32px;
    text-align: center;
}
.panel-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── ALERTS ──────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; stroke-linecap: round; fill: none; }
.alert-error   { background: var(--red-soft); color: var(--red-dark); border: 1px solid #ffcdd2; }
.alert-error svg { stroke: var(--red); }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-success svg { stroke: #2e7d32; }

/* ── FORM FIELDS ─────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--muted); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
  z-index: 1;
  flex-shrink: 0;
}
.input-wrap input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  font-family: 'Roboto', sans-serif;
  font-size: var(--fs-sm);
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
  line-height: 1.4;
}
.input-wrap input:focus { border-color: var(--red); }
.input-wrap input::placeholder { color: #bdbdbd; }

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  padding: 4px;
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.eye-btn svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.eye-btn:hover svg { stroke: var(--text); }

.field-error { font-size: 13px; color: var(--red); margin-top: 5px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Remember row */
.remember-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px; font-size: var(--fs-sm); color: var(--muted);
}
.remember-row input[type=checkbox] { accent-color: var(--red); width: 15px; height: 15px; }
.remember-row label { color: var(--text); cursor: pointer; }
.forgot-link { font-size: var(--fs-sm); color: var(--red); text-decoration: none; cursor: pointer; }
.forgot-link:hover { text-decoration: underline; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 13px 20px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s;
  position: relative;
}
.btn-primary:hover   { background: var(--red-dark); }
.btn-primary:active  { transform: scale(.99); }
.btn-primary:disabled{ background: #ef9a9a; cursor: not-allowed; }
.btn-primary svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.spinner {
  display: none; width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SWITCH LINK ─────────────────────────────────────────────────── */
.switch-link {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 20px;
}
.switch-link a { color: var(--red); cursor: pointer; font-weight: 500; text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

/* ── PASSWORD STRENGTH ───────────────────────────────────────────── */
.strength-bar {
  display: flex; gap: 4px; margin-top: 7px; height: 3px;
}
.strength-bar span {
  flex: 1; border-radius: 2px;
  background: var(--border);
  transition: background .2s;
}
.strength-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── TERMS ───────────────────────────────────────────────────────── */
.terms { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; font-size: var(--fs-sm); color: var(--muted); }
.terms input { accent-color: var(--red); margin-top: 2px; flex-shrink: 0; }
.terms a { color: var(--red); text-decoration: none; }
.terms a:hover { text-decoration: underline; }

/* ── STEP BAR ────────────────────────────────────────────────────── */
.step-bar { display: flex; gap: 6px; margin-bottom: 20px; }
.step-bar span { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background .3s; }
.step-bar span.on { background: var(--red); }

/* ── OTP CHUNG ───────────────────────────────────────────────────── */
.otp-hint { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 18px; line-height: 1.7; }
.otp-hint strong { color: var(--text); }
.countdown { color: var(--red); font-weight: 500; font-variant-numeric: tabular-nums; }
.resend { color: var(--red); cursor: pointer; font-weight: 500; }
.resend.disabled { color: var(--muted); cursor: default; pointer-events: none; }

.otp-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}

/* ── OTP INPUT: dùng chung cho cả .otp-d (forgot) và .otp-r (register) ── */
.otp-d,
.otp-r {
  width: 100%;
  height: 52px;
  text-align: center;
  font-family: 'Roboto', sans-serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, background .15s;
  padding: 0;
  min-width: 0;
  -moz-appearance: textfield;
}
.otp-d::-webkit-outer-spin-button,
.otp-d::-webkit-inner-spin-button,
.otp-r::-webkit-outer-spin-button,
.otp-r::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp-d:focus,  .otp-r:focus  { border-color: var(--red); background: var(--red-soft); }
.otp-d.filled, .otp-r.filled { border-color: var(--red); }
.otp-d.otp-error, .otp-r.otp-error {
  border-color: var(--red);
  background: var(--red-soft);
  animation: shake .3s;
}

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

.inline-err { font-size: 13px; color: var(--red); margin-top: 5px; display: block; min-height: 18px; }

/* ── SUCCESS STATE ───────────────────────────────────────────────── */
.success-state { text-align: center; padding: 16px 0 24px; }
.check-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #e8f5e9;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.check-circle svg { width: 28px; height: 28px; stroke: #2e7d32; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.success-state h3 { font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin-bottom: 8px; }
.success-state p  { font-size: var(--fs-sm); color: var(--muted); line-height: 1.7; }

/* ── FOOTER TEXT ─────────────────────────────────────────────────── */
.footer-text {
  text-align: center;
  font-size: 12px;
  color: #bdbdbd;
  margin-top: 24px;
}
.footer-text a { color: #bdbdbd; text-decoration: none; }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .left { display: none; }
  .right { padding: 24px 16px; background: #fff; }
  .form-wrap { box-shadow: none; border: none; padding: 24px 16px; }
  .mobile-logo { display: flex !important; margin-bottom: 28px; }
}
@media (max-width: 400px) {
  .otp-d, .otp-r { font-size: var(--fs-lg); }
  .tabs { gap: 0; }
  .tab-btn { font-size: 13px; padding: 10px 4px; }
}

/* ── Role Cards ─────────────────────────────────────── */
.role-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}
.role-card {
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color .2s, background .2s, box-shadow .2s;
    background: #fff;
}
.role-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.role-card-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 5px 6px;
}
.role-card-inner svg {
    width: 28px; height: 28px;
    stroke: #9e9e9e;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke .2s;
}
.role-card .role-name {
    font-size: 15px;
    font-weight: 700;
    color: #424242;
    transition: color .2s;
}
.role-card .role-desc {
    font-size: 12px;
    color: #9e9e9e;
    transition: color .2s;
}
.role-card:hover {
    border-color: #e53e3e;
    box-shadow: 0 2px 8px rgba(229,62,62,.12);
}
.role-card.selected {
    border-color: #e53e3e;
    background: #fff5f5;
    box-shadow: 0 2px 10px rgba(229,62,62,.15);
}
.role-card.selected .role-card-inner svg { stroke: #e53e3e; }
.role-card.selected .role-name { color: #e53e3e; }
.role-card.selected .role-desc { color: #e57373; }
