/* ============================================================
   TINCOVERSE — AUTH.CSS
   Giao diện trang đăng nhập & đăng ký
   ============================================================ */

/* ─── AUTH BODY ─── */
.auth-body {
  min-height: 100vh;
  background: var(--bg-dark);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

/* ─── AUTH WRAPPER ─── */
.auth-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── LEFT PANEL ─── */
.auth-panel-left {
  background: linear-gradient(145deg, #0A0B1A 0%, #1A0545 60%, #0A1530 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-panel-left::before {
  content: '';
  position: absolute;
  top: -120px; left: -120px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,60,225,0.25) 0%, transparent 70%);
  pointer-events: none;
}

.auth-panel-left::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -80px;
  width: 350px; height: 350px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand .nav-logo {
  font-size: 1.5rem;
  margin-bottom: 20px;
  display: inline-flex;
}

.auth-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 340px;
}

/* Feature list */
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 32px 0;
}

.af-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(108,60,225,0.08);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.af-item:hover {
  background: rgba(108,60,225,0.14);
  border-color: rgba(139,92,246,0.3);
  transform: translateX(4px);
}

.af-icon {
  width: 42px; height: 42px;
  min-width: 42px;
  background: linear-gradient(135deg, rgba(108,60,225,0.3), rgba(6,182,212,0.2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 1rem;
}

.af-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.af-item p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* Auth stats */
.auth-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.as-item {
  background: rgba(108,60,225,0.08);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.as-num {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.as-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Testimonial */
.auth-testimonial {
  background: rgba(108,60,225,0.08);
  border: 1px solid rgba(139,92,246,0.18);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 0;
}

.auth-testimonial .tc-stars {
  color: var(--accent-2);
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.auth-testimonial p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 14px;
}

.at-author {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-left-footer {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-left-footer a {
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.register-class-code[hidden] { display: none; }
.register-class-code-help { display: block; margin-top: 7px; color: var(--text-muted); font-size: .78rem; line-height: 1.5; }

/* ─── RIGHT PANEL ─── */
.auth-panel-right {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow-y: auto;
}

.auth-theme-btn {
  position: absolute;
  top: 24px; right: 24px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  position: absolute;
  overflow: hidden;
}

.auth-theme-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: rotate(20deg);
}

.auth-form-wrap {
  width: 100%;
  max-width: 460px;
}

.auth-form-header {
  margin-bottom: 28px;
}

.auth-form-header h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.auth-form-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ─── ALERT ─── */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.88rem;
  line-height: 1.6;
}

.auth-alert i { margin-top: 2px; flex-shrink: 0; }

.auth-alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #FCA5A5;
}

.auth-alert-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6EE7B7;
}

.auth-alert-warning {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  color: #FCD34D;
}

/* ─── FORM GROUPS ─── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-label i {
  color: var(--primary-light);
  margin-right: 6px;
  font-size: 0.8rem;
}

.form-label em {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}

.input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  outline: none;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--primary-light);
  background: rgba(108,60,225,0.08);
  box-shadow: 0 0 0 3px rgba(108,60,225,0.18);
}

.form-input.valid {
  border-color: var(--accent-3);
}

.form-input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}

/* Status icon inside input */
.input-status {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
  transition: all 0.25s ease;
}

/* Password toggle */
.input-password .form-input { padding-right: 48px; }

.toggle-password {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.toggle-password:hover { color: var(--primary-light); }

/* ─── PASSWORD STRENGTH ─── */
.pw-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pw-strength-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.pw-strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease, background-color 0.4s ease;
}

#pw-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 60px;
}

/* ─── ROLE TABS ─── */
.role-tabs {
  display: flex;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 22px;
  gap: 4px;
}

.role-tabs input[type="radio"] { display: none; }

.role-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.role-tabs input:checked + .role-tab {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(108,60,225,0.4);
}

.role-tab:hover { color: var(--primary-light); }

/* ─── 2-COL FORM ROW ─── */
.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── CHECKBOX ─── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 18px; height: 18px;
  border: 2px solid var(--border-glass);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.checkbox-label input:checked + .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}

/* ─── FORM ROW (remember + forgot) ─── */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.forgot-link {
  font-size: 0.88rem;
  color: var(--primary-light);
  font-weight: 600;
  transition: var(--transition);
}

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

/* ─── BTN FULL ─── */
.btn-full {
  width: 100%;
  justify-content: center;
  position: relative;
  gap: 10px;
}

/* Loading spinner inside button */
.btn-spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-full.loading .btn-spinner { display: block; }
.btn-full.loading span:first-of-type { opacity: 0.7; }

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

/* ─── DIVIDER ─── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

/* ─── SOCIAL LOGIN ─── */
.social-login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1.5px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Be Vietnam Pro', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.btn-social:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
  background: rgba(108,60,225,0.08);
  transform: translateY(-2px);
}

/* ─── SWITCH LINK ─── */
.auth-switch-link {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.auth-switch-link a {
  color: var(--primary-light);
  font-weight: 700;
  transition: var(--transition);
}

.auth-switch-link a:hover { color: var(--accent); }
.auth-switch-link a i { font-size: 0.8em; margin-left: 4px; }

.auth-link {
  color: var(--primary-light);
  font-weight: 600;
}

/* ─── LIGHT MODE OVERRIDES ─── */
[data-theme="light"] .auth-body { background: #F0F2FF; }

[data-theme="light"] .auth-panel-left {
  background: linear-gradient(145deg, #E8E5FF 0%, #D8C8FF 60%, #C8E5FF 100%);
}

[data-theme="light"] .auth-panel-left .auth-tagline,
[data-theme="light"] .auth-panel-left .af-item p,
[data-theme="light"] .auth-panel-left .auth-left-footer,
[data-theme="light"] .auth-testimonial p { color: #4A4870; }

[data-theme="light"] .auth-panel-left .nav-logo,
[data-theme="light"] .auth-panel-left strong { color: #1A1035; }

[data-theme="light"] .af-item {
  background: rgba(108,60,225,0.07);
  border-color: rgba(108,60,225,0.2);
}

[data-theme="light"] .as-item,
[data-theme="light"] .auth-testimonial {
  background: rgba(108,60,225,0.07);
  border-color: rgba(108,60,225,0.18);
}

[data-theme="light"] .auth-panel-right { background: #FFFFFF; }

[data-theme="light"] .form-input {
  background: #F4F2FF;
  border-color: rgba(108,60,225,0.2);
  color: #1A1035;
}

[data-theme="light"] .form-input::placeholder { color: #8B85A8; }

[data-theme="light"] .form-input:focus {
  background: #EDE8FF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,60,225,0.12);
}

[data-theme="light"] .role-tabs {
  background: rgba(108,60,225,0.06);
  border-color: rgba(108,60,225,0.18);
}

[data-theme="light"] .role-tab { color: #8B85A8; }

[data-theme="light"] .btn-social {
  background: #F4F2FF;
  border-color: rgba(108,60,225,0.2);
  color: #4A4870;
}

[data-theme="light"] .btn-social:hover {
  background: #EDE8FF;
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="light"] .auth-alert-error {
  background: rgba(239,68,68,0.07);
  color: #B91C1C;
}
[data-theme="light"] .auth-alert-success {
  background: rgba(16,185,129,0.07);
  color: #065F46;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-panel-left { display: none; }
  .auth-panel-right { min-height: 100vh; }
}

@media (max-width: 480px) {
  .auth-panel-right { padding: 24px 20px; }
  .form-row-2col { grid-template-columns: 1fr; }
  .social-login { grid-template-columns: 1fr; }
  .auth-form-wrap { max-width: 100%; }
}
