/* ============================================================
   auth.css – Trang đăng nhập / đăng ký StudyConnect
   ============================================================ */

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

body {
  font-family: var(--font-body, 'Plus Jakarta Sans', 'Segoe UI', sans-serif);
  min-height: 100vh;
  background: #fff7ed;
}
h1, h2, h3 { font-family: var(--font-display, 'Space Grotesk', 'Plus Jakarta Sans', sans-serif); }

/* ── SPLASH ──────────────────────────────────────────────── */
#splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #c2410c 0%, #f97316 60%, #fbbf24 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.5rem;
}
.splash-logo {
  display: flex; align-items: center; gap: .7rem;
  color: #fff; font-size: 1.9rem; font-weight: 800;
}
.splash-logo i { font-size: 2.2rem; }
.splash-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── WRAPPER ─────────────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */
.auth-left {
  flex: 1;
  background: linear-gradient(150deg, #c2410c 0%, #ea580c 30%, #f97316 65%, #fb923c 85%, #fbbf24 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  position: relative;
  overflow: hidden;
  height: 100vh;
}
.auth-left::before {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  top: -140px; right: -100px;
  pointer-events: none;
}
.auth-left::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(0,0,0,.06);
  bottom: -60px; left: -80px;
  pointer-events: none;
}

.auth-dots { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-dot {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.07);
  animation: floatUp 7s ease-in-out infinite;
}
.auth-dot:nth-child(1) { width:100px; height:100px; top:10%; left:5%;  animation-delay:0s; }
.auth-dot:nth-child(2) { width: 60px; height: 60px; top:55%; left:70%; animation-delay:2.5s; }
.auth-dot:nth-child(3) { width: 40px; height: 40px; top:75%; left:25%; animation-delay:5s; }
.auth-dot:nth-child(4) { width: 75px; height: 75px; top:30%; left:80%; animation-delay:1.5s; }
@keyframes floatUp {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-20px) scale(1.05); }
}

.auth-brand { position: relative; z-index: 1; }
.brand-logo {
  display: flex; align-items: center; gap: .7rem;
  margin-bottom: 2rem;
}
.brand-logo-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  backdrop-filter: blur(8px);
}
.brand-logo-text {
  font-size: 1.35rem; font-weight: 800;
  color: #fff; letter-spacing: -.02em;
}
.auth-brand h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-bottom: .75rem;
}
.auth-brand h1 em {
  font-style: normal;
  position: relative;
}
.auth-brand h1 em::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.5);
  border-radius: 2px;
}
.auth-brand .subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,.78);
  line-height: 1.65;
  max-width: 360px;
}

.auth-features {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: .65rem;
  margin-top: 2.5rem;
}
.feature-item {
  display: flex; align-items: center; gap: .85rem;
  padding: .8rem 1rem;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  color: #fff;
  font-size: .88rem; font-weight: 500;
  backdrop-filter: blur(8px);
  transition: background .2s, transform .2s;
  cursor: default;
}
.feature-item:hover { background: rgba(255,255,255,.22); transform: translateX(5px); }
.feature-item i {
  font-size: .88rem;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-tagline {
  position: relative; z-index: 1;
  color: rgba(255,255,255,.4);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
.auth-right {
  flex: 0 0 500px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 2rem 3rem;
  position: relative;
  height: 100vh;
  overflow-y: auto;
  box-shadow: -12px 0 50px rgba(0,0,0,.07);
  /* Căn giữa nội dung theo chiều dọc khi không overflow */
  padding-top: max(2rem, calc(50vh - 320px));
}
.auth-right::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #c2410c, #f97316, #fbbf24);
}

.auth-right-header { margin-bottom: 1.75rem; }
.auth-right-header h2 {
  font-size: 1.6rem; font-weight: 800;
  color: #111827; letter-spacing: -.025em; margin-bottom: .3rem;
}
.auth-right-header p { font-size: .86rem; color: #6b7280; }
.auth-right-header p a { color: #ea580c; font-weight: 700; text-decoration: none; }
.auth-right-header p a:hover { text-decoration: underline; }

/* Tabs */
.auth-tabs {
  display: flex;
  background: #f9fafb;
  border: 1.5px solid #f3f4f6;
  border-radius: 11px;
  padding: 4px; gap: 4px;
  margin-bottom: 1.6rem;
}
.auth-tab {
  flex: 1; padding: .58rem .5rem;
  font-size: .875rem; font-weight: 600;
  color: #6b7280;
  border-radius: 8px; border: none; background: none;
  cursor: pointer; transition: all .18s; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.auth-tab:hover { color: #ea580c; }
.auth-tab.active {
  background: #fff; color: #ea580c;
  box-shadow: 0 1px 8px rgba(0,0,0,.09);
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: .95rem; }

.form-group { display: flex; flex-direction: column; gap: .36rem; }
.form-group label {
  font-size: .75rem; font-weight: 700; color: #6b7280;
  display: flex; align-items: center; gap: .35rem;
  letter-spacing: .06em; text-transform: uppercase;
}
.form-group label i { color: #f97316; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .75rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: .95rem;
  background: #fafafa; color: #111827;
  font-family: inherit; width: 100%;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.form-group input:hover { border-color: #fdba74; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #f97316; background: #fff;
  box-shadow: 0 0 0 3px rgba(249,115,22,.13);
}
.form-group input::placeholder { color: #9ca3af; font-size: .92rem; }

.input-eye { position: relative; }
.input-eye input { padding-right: 2.75rem; }
.toggle-eye {
  position: absolute; right: .9rem; top: 50%;
  transform: translateY(-50%);
  color: #9ca3af; cursor: pointer; font-size: .85rem;
  transition: color .15s;
}
.toggle-eye:hover { color: #f97316; }

.form-row { display: flex; align-items: center; justify-content: space-between; }
.remember-me {
  display: flex; align-items: center; gap: .4rem;
  cursor: pointer; color: #4b5563; font-size: .83rem; font-weight: 500;
}
.remember-me input[type="checkbox"] { width: auto; accent-color: #f97316; }
.forgot-link { color: #ea580c; font-weight: 700; font-size: .83rem; text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }

/* Submit button */
.auth-submit-btn {
  padding: .82rem;
  border-radius: 11px;
  font-size: .95rem; font-weight: 700;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff; border: none; cursor: pointer; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: 0 4px 16px rgba(249,115,22,.38);
  transition: all .2s; font-family: inherit; margin-top: .15rem;
}
.auth-submit-btn:hover {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  transform: translateY(-1px);
  box-shadow: 0 7px 22px rgba(249,115,22,.48);
}
.auth-submit-btn:active { transform: translateY(0); }
.auth-submit-btn:disabled { opacity: .62; cursor: not-allowed; transform: none; }

/* Divider */
.divider {
  display: flex; align-items: center; gap: .7rem;
  color: #9ca3af; font-size: .8rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #f3f4f6; }

/* Google */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .65rem;
  width: 100%; padding: .75rem;
  border: 1.5px solid #e5e7eb; border-radius: 11px;
  background: #fff; color: #374151;
  font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: all .18s; font-family: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.btn-google:hover { border-color: #fdba74; background: #fff7ed; box-shadow: 0 3px 10px rgba(0,0,0,.07); }
.btn-google img { width: 19px; height: 19px; }

/* Error */
.auth-error {
  color: #dc2626; font-size: .82rem; font-weight: 600;
  min-height: 1rem;
  display: flex; align-items: center; gap: .3rem;
}
.auth-error:not(:empty)::before { content: '⚠'; font-size: .8rem; }
.auth-field-error {
  display: none; color: #dc2626; font-size: .78rem; font-weight: 600;
  line-height: 1.4;
}
.auth-field-error:not(:empty) { display: block; }

/* Bottom note */
.auth-bottom-note {
  margin-top: 1.4rem;
  padding-bottom: 2rem;
  text-align: center;
  font-size: .8rem; color: #9ca3af;
}
.auth-terms-consent {
  display: flex; align-items: flex-start; justify-content: center; gap: .55rem;
  max-width: 420px; margin: 0 auto; text-align: left; line-height: 1.6;
  cursor: pointer;
}
.auth-terms-consent input[type="checkbox"] {
  width: 16px; height: 16px; flex: 0 0 16px; margin: .15rem 0 0;
  accent-color: #4f46e5; cursor: pointer;
}
.terms-consent-error {
  display: none; max-width: 420px; margin: .45rem auto 0;
  color: #dc2626; font-size: .8rem; font-weight: 600;
  line-height: 1.45; text-align: center;
}
.terms-consent-error:not(:empty) { display: block; }
.auth-bottom-note a { color: #ea580c; font-weight: 700; text-decoration: none; }
.auth-bottom-note a:hover { text-decoration: underline; }

/* Toast */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b; color: #fff;
  padding: .65rem 1.4rem; border-radius: 99px;
  font-size: .9rem; z-index: 9998;
  opacity: 0; transition: all .35s ease;
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Shared StudyConnect visual language */
body {
  background:
    radial-gradient(ellipse at 10% 8%, rgba(99,102,241,.12), transparent 34rem),
    #f1f5f9;
}
#splash-screen {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 58%, #0891b2 100%);
}
.auth-left {
  background: linear-gradient(145deg, #312e81 0%, #4338ca 42%, #4f46e5 72%, #0891b2 125%);
}
.auth-right {
  background: rgba(255,255,255,.96);
}
.auth-right::before {
  background: linear-gradient(90deg, #4f46e5, #6366f1, #06b6d4);
}
.auth-right-header p a,
.auth-tab:hover,
.forgot-link,
.auth-bottom-note a { color: #4f46e5; }
.auth-tab.active {
  background: #fff;
  color: #4f46e5;
}
.form-group label i,
.toggle-eye:hover { color: #4f46e5; }
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: #c7d2fe; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.input-eye input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.13);
}
.remember-me input[type="checkbox"] { accent-color: #4f46e5; }
.auth-submit-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 5px 14px rgba(79,70,229,.24);
}
.auth-submit-btn:hover {
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}
.btn-google { border-radius: 12px; }
.btn-google:hover { border-color: #c7d2fe; background: #f5f3ff; }
.auth-bottom-note { color: #64748b; }
body :is(button, a, input):focus-visible {
  outline: 3px solid rgba(79,70,229,.3);
  outline-offset: 2px;
}
#toast.success { background: #059669; }
#toast.error   { background: #dc2626; }

html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] body textarea,
html[data-theme="dark"] body select,
html[data-theme="dark"] body [contenteditable="true"] {
  color: var(--text, #f1f5f9);
  background-color: var(--surface2, #263347);
  border-color: var(--border, #28364a);
  color-scheme: dark;
}
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
html[data-theme="dark"] body textarea:focus,
html[data-theme="dark"] body select:focus,
html[data-theme="dark"] body [contenteditable="true"]:focus {
  color: var(--text, #f1f5f9);
  background-color: var(--surface2, #263347);
}
html[data-theme="dark"] body .auth-form input:autofill,
html[data-theme="dark"] body .auth-form input:-webkit-autofill,
html[data-theme="dark"] body .auth-form input:-webkit-autofill:hover,
html[data-theme="dark"] body .auth-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f1f5f9;
  caret-color: #f1f5f9;
  -webkit-box-shadow: 0 0 0 1000px #263347 inset;
  box-shadow: 0 0 0 1000px #263347 inset;
  border-color: rgba(255,255,255,.1);
  transition: background-color 9999s ease-out;
}
html:not([data-theme="dark"]) body .auth-form input:autofill,
html:not([data-theme="dark"]) body .auth-form input:-webkit-autofill,
html:not([data-theme="dark"]) body .auth-form input:-webkit-autofill:hover,
html:not([data-theme="dark"]) body .auth-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #111827;
  caret-color: #111827;
  -webkit-box-shadow: 0 0 0 1000px #fafafa inset;
  box-shadow: 0 0 0 1000px #fafafa inset;
  border-color: #e5e7eb;
  transition: background-color 9999s ease-out;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .auth-left { display: none; }
  .auth-right { flex: 1; padding: 2.5rem 2rem; box-shadow: none; }
}
@media (max-width: 480px) {
  .auth-right { padding: 2rem 1.25rem; }
  .auth-right-header h2 { font-size: 1.35rem; }
}
