/**
 * Admin Auth — Enterprise layout
 * Scoped classes avoid Bootstrap 3 .input-group conflicts.
 */

:root {
  --auth-brand: #e8943a;
  --auth-brand-hover: #d47d26;
  --auth-brand-ring: rgba(232, 148, 58, 0.18);
}

[data-ent-theme="light"] {
  --auth-text: #1c1917;
  --auth-muted: #78716c;
  --auth-border: rgba(28, 25, 23, 0.1);
  --auth-bg: #f6f5f2;
  --auth-surface: #ffffff;
  --auth-surface-border: rgba(28, 25, 23, 0.06);
  --auth-header-border: rgba(28, 25, 23, 0.05);
  --auth-input-bg: #ffffff;
  --auth-input-hover-border: #9ca3af;
  --auth-placeholder: #9ca3af;
  --auth-label: #374151;
  --auth-back: #4b5563;
  --auth-eye: #6b7280;
  --auth-eye-hover: #374151;
  --auth-footer: #9ca3af;
  --auth-footer-note: #b0b7c3;
  --auth-shadow: 0 4px 24px rgba(28, 25, 23, 0.06);
  --auth-success-bg: #f0fdf4;
  --auth-success-text: #166534;
  --auth-success-border: #bbf7d0;
  --auth-error-bg: #fef2f2;
  --auth-error-text: #991b1b;
  --auth-error-border: #fecaca;
  --auth-input-disabled-bg: #f1f5f9;
  --auth-input-disabled-text: #94a3b8;
}

.auth-form .form-control:disabled {
  background: var(--auth-input-disabled-bg);
  color: var(--auth-input-disabled-text);
  cursor: not-allowed;
}

[data-ent-theme="dark"] {
  --auth-text: #fafaf9;
  --auth-muted: #a8a29e;
  --auth-border: rgba(255, 255, 255, 0.1);
  --auth-bg: #121110;
  --auth-surface: #1c1a18;
  --auth-surface-border: rgba(255, 255, 255, 0.07);
  --auth-header-border: rgba(255, 255, 255, 0.05);
  --auth-input-bg: #242220;
  --auth-input-hover-border: rgba(255, 255, 255, 0.2);
  --auth-placeholder: #64748b;
  --auth-label: #cbd5e1;
  --auth-back: #94a3b8;
  --auth-eye: #94a3b8;
  --auth-eye-hover: #e2e8f0;
  --auth-footer: #64748b;
  --auth-footer-note: #475569;
  --auth-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --auth-success-bg: rgba(5, 150, 105, 0.12);
  --auth-success-text: #34d399;
  --auth-success-border: rgba(5, 150, 105, 0.25);
  --auth-error-bg: rgba(220, 38, 38, 0.12);
  --auth-error-text: #f87171;
  --auth-error-border: rgba(220, 38, 38, 0.25);
  --auth-input-disabled-bg: #151b28;
  --auth-input-disabled-text: #64748b;
}

body.auth-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--auth-bg);
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--auth-text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

body.auth-page section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page-wrap {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.auth-center {
  width: 100%;
  max-width: 440px;
}

/* ── Card ─────────────────────────────────────────────────── */
.auth-box {
  background: var(--auth-surface);
  border: 1px solid var(--auth-surface-border);
  border-radius: 12px;
  box-shadow: var(--auth-shadow);
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-box::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--auth-brand);
}

.auth-box-header {
  padding: 32px 40px 24px;
  text-align: center;
  border-bottom: 1px solid var(--auth-header-border);
}

.auth-box-header .auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-back);
  text-decoration: none;
  margin-bottom: 20px;
}

.auth-box-body > .auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-back);
  text-decoration: none;
  margin-bottom: 20px;
}

.auth-box-header .auth-back-link:hover,
.auth-box-body > .auth-back-link:hover {
  color: var(--auth-brand);
}

.auth-box-header .auth-back-link i,
.auth-box-body > .auth-back-link i {
  font-size: 11px;
}

.auth-logo {
  display: block;
  max-width: 220px;
  max-height: 56px;
  width: auto;
  height: auto;
  margin: 0 auto 24px;
  object-fit: contain;
}

.auth-portal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--auth-brand);
  background: rgba(8, 145, 178, 0.08);
  border: 1px solid rgba(8, 145, 178, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.auth-box-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--auth-text);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.25;
}

.auth-box-header p {
  font-size: 14px;
  color: var(--auth-muted);
  margin: 0;
  line-height: 1.55;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Form body ────────────────────────────────────────────── */
.auth-box-body {
  padding: 28px 40px 36px;
}

.auth-box .alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

.auth-box .alert-success {
  background: var(--auth-success-bg);
  color: var(--auth-success-text);
  border-color: var(--auth-success-border);
}

.auth-box .alert-error {
  background: var(--auth-error-bg);
  color: var(--auth-error-text);
  border-color: var(--auth-error-border);
}

/* ── Fields (NOT .input-group — Bootstrap conflict) ─────── */
.auth-form .auth-field-group {
  display: block;
  width: 100%;
  margin-bottom: 20px;
  clear: both;
}

.auth-form .auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  gap: 12px;
}

.auth-form .auth-field-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-label);
  margin-bottom: 7px;
}

.auth-form .auth-label-row label {
  margin-bottom: 0;
}

.auth-form .auth-forgot-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-brand);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.auth-form .form-control {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--auth-text);
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-form .form-control:hover {
  border-color: var(--auth-input-hover-border);
}

.auth-form .form-control:focus {
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 3px var(--auth-brand-ring);
  outline: none;
}

.auth-form .form-control::placeholder {
  color: var(--auth-placeholder);
}

.auth-form .auth-field-group.has-error .form-control {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.auth-form .error-msg {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #dc2626;
  clear: both;
}

.auth-form .auth-password-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.auth-form .auth-password-wrap .form-control {
  padding-right: 44px;
}

.auth-form .password-eye {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--auth-eye);
  font-size: 15px;
  z-index: 2;
  background: transparent;
  border: none;
}

.auth-form .password-eye:hover {
  color: var(--auth-eye-hover);
}

.auth-form .signin-btn {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: none;
  border-radius: 6px;
  background: var(--auth-brand);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.auth-form .signin-btn:hover {
  background: var(--auth-brand-hover);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.28);
}

.auth-form .signin-btn:active {
  background: #155e75;
}

.auth-form .signin-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--auth-brand-ring);
}

.auth-form .signin-btn.is-loading {
  cursor: wait;
  opacity: 0.92;
  pointer-events: none;
}

.auth-btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authBtnSpin 0.65s linear infinite;
  flex-shrink: 0;
}

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

.auth-form .signin-btn:not(.is-loading):active {
  transform: scale(0.985);
  transition: transform 0.1s;
}

/* Kill Bootstrap .input-group table layout inside auth forms */
.auth-form .input-group {
  display: block !important;
  width: 100% !important;
  float: none !important;
  position: static !important;
}

/* ── Footer ───────────────────────────────────────────────── */
.auth-page-footer {
  margin-top: 28px;
  text-align: center;
}

.auth-page-footer p {
  font-size: 12px;
  color: var(--auth-footer);
  margin: 0 0 4px;
  line-height: 1.55;
}

.auth-page-footer-note {
  font-size: 11px !important;
  color: var(--auth-footer-note) !important;
}

/* ── Theme toggle (auth pages) ──────────────────────────── */
.auth-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  background: var(--auth-surface);
  color: var(--auth-muted);
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--auth-shadow);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.auth-theme-toggle:hover {
  color: var(--auth-brand);
  border-color: rgba(8, 145, 178, 0.35);
}

[data-ent-theme="dark"] .auth-logo {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 520px) {
  .auth-box-header {
    padding: 28px 24px 20px;
  }

  .auth-box-body {
    padding: 24px 24px 28px;
  }

  .auth-box-header h1 {
    font-size: 21px;
  }

  .auth-logo {
    max-width: 190px;
  }
}
