/* =====================================================
   login.css — EduLearn Login Page
   ใช้ร่วมกับ Bootstrap 5 + IBM Plex Sans Thai
   ===================================================== */

@font-face {
  font-family: Prompt;
  src: url("../fonts/Prompt/Prompt-Regular.ttf");
}
:root {
  --primary: #0f6745;
  --primary-lt: #0e9d6f;
  --primary-dk: #0d402d;
  --accent: #f5a623;
  --accent-lt: #ffd080;
  --surface: #f7f9fc;
  --surface-2: #eef2f8;
  --text: #1a2332;
  --text-muted: #5a6880;
  --border: #d8e2ef;
  --danger: #c0392b;
  --danger-bg: #fef0ee;
  --danger-border: rgba(192, 57, 43, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --panel-blue: #0f6745;
  --panel-blue-lt: #196c4c;
  --panel-text: #e0eee9;
  --panel-muted: #a8c2b8;
  --panel-accent: #589b81;
  --panel-feat: #8eada1;
}

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

body {
  scrollbar-width: thin;
  font-family: Prompt, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
}

/* ── Page wrapper ──────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface);
}

/* ── Split card ────────────────────────────────────── */
.login-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 860px;
  min-height: 560px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(10, 92, 143, 0.1);
}

/* ══════════════════════════════════════════════════
   LEFT PANEL — brand
   ══════════════════════════════════════════════════ */
.panel-left {
  background: var(--panel-blue);
  display: flex;
  flex-direction: column;
}

.panel-left-inner {
  flex: 1;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: var(--panel-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--panel-text);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--panel-text);
  letter-spacing: -0.2px;
}

.brand-name span {
  color: var(--accent-lt);
}

/* Tagline */
.panel-tagline {
  font-size: 0.88rem;
  color: var(--panel-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

/* Feature list */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feat-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgb(45, 131, 98, 82%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--panel-feat);
}

.feat-body {
  font-size: 0.83rem;
  color: var(--panel-feat);
  line-height: 1.55;
}

.feat-body strong {
  display: block;
  color: var(--panel-text);
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 0.86rem;
}

/* Footer note */
.panel-footer-note {
  font-size: 0.72rem;
  color: var(--panel-accent);
  margin-top: 32px;
}

/* ══════════════════════════════════════════════════
   RIGHT PANEL — form
   ══════════════════════════════════════════════════ */
.panel-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel-right-inner {
  padding: 44px 40px;
}

/* Mobile brand (hidden on desktop) */
.brand-mobile {
  display: none;
  margin-bottom: 24px;
}
.brand-mark-dark {
  background: var(--primary);
  color: #fff;
}
.brand-name-dark {
  color: var(--text);
}
.brand-name-dark span {
  color: var(--primary-lt);
}

/* Heading */
.login-heading {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subheading {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Error alert ───────────────────────────────────── */
.alert-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 16px;
  font-size: 0.83rem;
  color: var(--danger);
  animation: slideIn 0.2s ease;
}

.alert-error svg {
  flex-shrink: 0;
  stroke: var(--danger);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Form fields ───────────────────────────────────── */
.form-field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.45px;
  margin-bottom: 6px;
}

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

.field-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  stroke: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.field-input {
  width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.4rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s;
  outline: none;
}

.field-input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
}

.field-input:hover {
  border-color: var(--primary-lt);
}

.field-input:focus {
  border-color: var(--primary-lt);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 123, 191, 0.12);
}

.field-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

/* Password eye toggle */
.eye-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-radius: 5px;
  transition:
    color 0.15s,
    background 0.15s;
}

.eye-toggle:hover {
  color: var(--primary);
  background: var(--surface-2);
}

.eye-toggle svg {
  display: block;
}

/* ── Remember me + forgot link ─────────────────────── */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.checkbox-input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  user-select: none;
}

.forgot-link {
  font-size: 0.84rem;
  color: var(--primary-lt);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── Submit button ─────────────────────────────────── */
.btn-login {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.18s,
    transform 0.1s;
  min-height: 44px;
}

.btn-login:hover {
  background: var(--primary-lt);
}
.btn-login:active {
  transform: scale(0.99);
}
.btn-login:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-login svg {
  flex-shrink: 0;
}

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

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

/* ── Divider ───────────────────────────────────────── */
.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* ── SSO button ────────────────────────────────────── */
.btn-sso {
  width: 100%;
  padding: 0.65rem 1rem;
  background: #fff;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.18s,
    border-color 0.18s,
    color 0.18s;
  min-height: 44px;
}

.btn-sso:hover {
  background: var(--surface);
  border-color: var(--primary-lt);
  color: var(--primary);
}

.btn-sso svg {
  flex-shrink: 0;
}

/* ── Help text ─────────────────────────────────────── */
.help-text {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.help-text a {
  color: var(--primary-lt);
  text-decoration: none;
}

.help-text a:hover {
  text-decoration: underline;
  color: var(--primary);
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
  .login-split {
    grid-template-columns: 1fr;
    min-height: unset;
  }
  .panel-left {
    display: none;
  }
  .panel-right {
    justify-content: flex-start;
  }
  .panel-right-inner {
    padding: 36px 28px;
  }
  .brand-mobile {
    display: flex;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .login-page {
    padding: 0;
    align-items: flex-start;
  }
  .login-split {
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-height: 100vh;
  }
  .panel-right-inner {
    padding: 32px 20px;
  }
  .login-heading {
    font-size: 1.25rem;
  }
}

.help-text span {
  color: var(--accent-lt);
}
