/* ════════════════════════════════════════════════════════════════
   NAN2-LOGIN.CSS
   หน้าเข้าสู่ระบบ — โรงเรียน และ เจ้าหน้าที่
   ต้อง load หลัง nan2-variables.css, nan2-base.css, nan2-components.css
   ════════════════════════════════════════════════════════════════ */

/* ── Full-page wrapper ── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-page);
}

/* ── Left panel — decorative ── */
.login-panel-left {
  background: var(--primary-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  position: relative;
  overflow: hidden;
}

/* geometric accent circles */
.login-panel-left::before,
.login-panel-left::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: .06;
  background: var(--gold-400);
  pointer-events: none;
}

.login-panel-left::before {
  width: 480px;
  height: 480px;
  bottom: -160px;
  left: -160px;
}

.login-panel-left::after {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -80px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-6);
  position: relative;
  z-index: 1;
}

.login-brand-logo {
  width: 80px;
  height: 80px;
  background: var(--gold-400);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: var(--weight-bold);
  color: var(--primary-950);
  letter-spacing: -1px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.login-brand-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: #fff;
  line-height: var(--leading-tight);
}

.login-brand-sub {
  font-size: var(--text-base);
  color: rgba(255,255,255,.6);
  line-height: var(--leading-normal);
  max-width: 320px;
}

.login-brand-divider {
  width: 48px;
  height: 3px;
  background: var(--gold-400);
  border-radius: var(--radius-full);
}

.login-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  width: 100%;
  max-width: 360px;
  margin-top: var(--space-4);
}

.login-stat {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}

.login-stat-num {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--gold-300);
  display: block;
  line-height: 1;
}

.login-stat-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.5);
  margin-top: var(--space-1);
  display: block;
}

/* ── Right panel — form ── */
.login-panel-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-10);
  background: var(--bg-surface);
}

.login-form-box {
  width: 100%;
  max-width: 420px;
}

.login-form-header {
  margin-bottom: var(--space-8);
}

.login-form-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.login-form-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

/* ── Role tabs ── */
.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
}

.login-role-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
  border: none;
  background: transparent;
}

.login-role-tab.active {
  background: var(--bg-surface);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.login-role-icon {
  font-size: 18px;
}

/* ── Input group with icon ── */
.login-input-group {
  position: relative;
  margin-bottom: var(--space-4);
}

.login-input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-hint);
  pointer-events: none;
  z-index: 1;
}

.login-input-wrap .form-input {
  padding-left: 40px;
  height: 44px;
  font-size: var(--text-base);
}

/* Show/hide password button */
.login-eye-btn {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--text-hint);
  padding: 0;
  line-height: 1;
  transition: color var(--dur);
}

.login-eye-btn:hover {
  color: var(--text-muted);
}

/* ── Remember + Forgot row ── */
.login-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

/* ── Submit button ── */
.login-submit-btn {
  width: 100%;
  height: 48px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: .01em;
  margin-bottom: var(--space-4);
}

/* ── Footer note ── */
.login-footer {
  position: absolute;
  bottom: var(--space-5);
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-hint);
}

/* ── Error message box ── */
.login-error {
  background: var(--danger-50);
  border: 1px solid var(--danger-200);
  border-left: 4px solid var(--danger-500);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--danger-700);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-panel-left {
    display: none;
  }

  .login-panel-right {
    padding: var(--space-8) var(--space-6);
    justify-content: flex-start;
    padding-top: var(--space-12);
  }

  /* แสดง mini brand บน mobile */
  .login-mobile-brand {
    display: flex !important;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
  }

  .login-mobile-logo {
    width: 44px;
    height: 44px;
    background: var(--primary-900);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: var(--weight-bold);
    color: var(--gold-400);
    flex-shrink: 0;
  }
}

@media (min-width: 769px) {
  .login-mobile-brand {
    display: none;
  }
}
