/* ============================================================
   LOGIN PAGE CSS
   Lokasi: static/auth/css/login.css
   Diekstrak dari <style> inline di login.html
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-500: #4361ee;
  --brand-600: #3b4fd8;
  --brand-700: #3a0ca3;
  --accent:    #f72585;
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 28px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(17,24,39,.06);
  --shadow-lg: 0 16px 40px rgba(17,24,39,.10);

  --transition: all .2s cubic-bezier(.4,0,.2,1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  background: var(--gray-50);
}

/* ============================================================
   LAYOUT - SPLIT SCREEN
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}

/* ============================================================
   PANEL KIRI - BRANDING
   ============================================================ */
.brand-panel {
  position: relative;
  background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 600px; /* reserve — cegah CLS */
}
.brand-panel::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(247,37,133,.25), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.brand-panel::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(34,211,238,.18), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

.brand-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.25));
  background: rgba(255,255,255,.95);
  padding: 6px 10px;
  border-radius: 12px;
}
.brand-name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-name small {
  display: block;
  font-size: .68rem;
  font-weight: 500;
  opacity: .75;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: 2px;
}

.brand-middle {
  position: relative;
  z-index: 2;
  max-width: 460px;
}
.brand-middle h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.brand-middle h2 .accent {
  background: linear-gradient(90deg, #fbbf24, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-middle p {
  font-size: .95rem;
  color: rgba(255,255,255,.82);
  line-height: 1.7;
  margin-bottom: 28px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
.brand-feature:hover {
  background: rgba(255,255,255,.14);
  transform: translateX(4px);
}
.brand-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.brand-feature-text {
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.4;
}
.brand-feature-text strong {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 2px;
}

.brand-bottom {
  position: relative;
  z-index: 2;
  font-size: .72rem;
  color: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.brand-bottom a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: var(--transition);
}
.brand-bottom a:hover {
  color: #fff;
  text-decoration: underline;
}
.brand-bottom .sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
}

/* ============================================================
   PANEL KANAN - FORM LOGIN
   ============================================================ */
.form-panel {
  background: #fff;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
.form-container {
  width: 100%;
  max-width: 420px;
}

.form-header {
  margin-bottom: 28px;
}
.form-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.form-header p {
  font-size: .9rem;
  color: var(--gray-500);
  margin: 0;
}

/* ============================================================
   FORM INPUTS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label i {
  color: var(--brand-500);
  margin-right: 4px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  transition: var(--transition);
  overflow: hidden;
}
.input-wrap:focus-within {
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-50);
}
.input-wrap .input-icon {
  padding: 0 14px;
  color: var(--gray-400);
  font-size: 1rem;
  display: flex;
  align-items: center;
}
.input-wrap:focus-within .input-icon {
  color: var(--brand-500);
}
.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 13px 14px 13px 0;
  font-size: .92rem;
  font-family: inherit;
  color: var(--gray-900);
  width: 100%;
}
.input-wrap input::placeholder {
  color: var(--gray-400);
}
.input-wrap .input-action {
  border: none;
  background: transparent;
  padding: 0 14px;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.input-wrap .input-action:hover {
  color: var(--brand-500);
}

.input-wrap.has-error {
  border-color: var(--danger);
  background: #fef2f2;
}
.input-wrap.has-error .input-icon {
  color: var(--danger);
}

/* ============================================================
   CAPTCHA BOX - 6 DIGIT ANGKA
   ============================================================ */
.captcha-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 2px dashed var(--brand-500);
  border-radius: var(--radius);
  margin-bottom: 10px;
  user-select: none;
  position: relative;
  overflow: hidden;
  min-height: 72px; /* reserve — cegah CLS */
}
.captcha-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(67,97,238,.04) 10px, rgba(67,97,238,.04) 11px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(247,37,133,.03) 10px, rgba(247,37,133,.03) 11px);
  pointer-events: none;
}
.captcha-digits {
  display: flex;
  gap: 8px;
  z-index: 1;
  flex-wrap: wrap;
}
.captcha-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 48px;
  background: #fff;
  border: 1.5px solid var(--brand-100);
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-700);
  font-family: 'Courier New', monospace;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative;
}
.captcha-digit:nth-child(odd) {
  transform: rotate(-3deg);
}
.captcha-digit:nth-child(even) {
  transform: rotate(3deg);
}
.captcha-digit:hover {
  transform: rotate(0deg) scale(1.05);
  border-color: var(--brand-500);
}
.captcha-digit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, rgba(247,37,133,.15) 50%, transparent 55%);
  pointer-events: none;
  border-radius: 10px;
}

.captcha-refresh {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: var(--brand-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  z-index: 1;
}
.captcha-refresh:hover {
  background: var(--brand-500);
  color: #fff;
  transform: rotate(180deg);
}
.captcha-refresh.spin i {
  animation: spin .8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-hint {
  font-size: .72rem;
  color: var(--gray-500);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.4;
}

.error-text {
  color: var(--danger);
  font-size: .72rem;
  margin-top: 4px;
  display: block;
}

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */
.btn-submit {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  font-family: inherit;
  letter-spacing: .01em;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(67,97,238,.25);
  position: relative;
  overflow: hidden;
}
.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(67,97,238,.35);
}
.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}
.btn-submit:disabled {
  opacity: .7;
  cursor: wait;
}
.btn-submit .spinner-border {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* ============================================================
   FOOTER & INFO
   ============================================================ */
.form-footer-info {
  margin-top: 20px;
  text-align: center;
  font-size: .78rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.form-footer-info .badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d1fae5;
  color: #047857;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--gray-400);
  font-size: .72rem;
}
.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.security-notice {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .72rem;
  color: var(--gray-500);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
}
.security-notice i {
  color: var(--brand-500);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   ALERT MESSAGES
   ============================================================ */
.alert-flash {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .82rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid;
  animation: slideDown .3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.alert-flash.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.alert-flash.alert-danger i { color: #dc2626; }
.alert-flash.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.alert-flash.alert-success i { color: #16a34a; }
.alert-flash.alert-warning {
  background: #fefce8;
  border-color: #fde68a;
  color: #854d0e;
}
.alert-flash.alert-warning i { color: #ca8a04; }
.alert-flash.alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.alert-flash.alert-info i { color: #2563eb; }
.alert-flash i {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-flash .btn-close {
  margin-left: auto;
  padding: 0;
  background-size: 12px;
  opacity: .5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .login-wrapper {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    padding: 32px 24px;
    min-height: auto;
  }
  .brand-middle {
    margin: 24px 0;
  }
  .brand-middle h2 {
    font-size: 1.5rem;
  }
  .brand-features {
    display: none;
  }
  .form-panel {
    padding: 32px 24px;
  }
}
@media (max-width: 480px) {
  .brand-panel { padding: 24px 18px; }
  .form-panel { padding: 24px 18px; }
  .form-header h1 { font-size: 1.4rem; }
  .captcha-digit {
    width: 36px;
    height: 42px;
    font-size: 1.25rem;
  }
  .brand-middle h2 { font-size: 1.25rem; }
  .brand-middle p { font-size: .85rem; }
}

/* ============================================================
   OPTIMASI PERFORMA (TAMBAHAN)
   ============================================================ */

/* Font display swap */
@font-face {
  font-family: 'Inter';
  font-display: swap;
}

/* GPU acceleration */
.brand-panel,
.form-panel,
.captcha-digit,
.btn-submit {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Respect user preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   TAB NAVIGATION (BARU)
   ============================================================ */
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 24px;
  position: relative;
}

.login-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: .01em;
  position: relative;
}

.login-tab i {
  font-size: 1rem;
  transition: var(--transition);
}

.login-tab:hover:not(.active) {
  color: var(--gray-700);
  background: rgba(255, 255, 255, 0.6);
}

.login-tab.active {
  background: #fff;
  color: var(--brand-500);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
}

.login-tab.active i {
  color: var(--brand-500);
}

/* ============================================================
   TAB CONTENT PANEL
   ============================================================ */
.tab-content-panel {
  display: none;
  animation: tabFadeIn .3s ease;
}

.tab-content-panel.active {
  display: block;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   QUICK 2FA — INFO BOX
   ============================================================ */
.quick-info-box {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  margin-bottom: 22px;
  align-items: flex-start;
}

.quick-info-box i {
  color: #16a34a;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.quick-info-box strong {
  display: block;
  font-size: .85rem;
  color: #166534;
  margin-bottom: 4px;
  font-weight: 700;
}

.quick-info-box p {
  margin: 0;
  font-size: .78rem;
  color: #15803d;
  line-height: 1.55;
}

/* ============================================================
   QUICK 2FA — CODE INPUT (KOTAK)
   ============================================================ */
.quick-code-input {
  font-family: 'Courier New', monospace !important;
  font-size: 1.5rem !important;
  letter-spacing: 0.5rem !important;
  text-align: center !important;
  font-weight: 700 !important;
  color: var(--brand-700) !important;
}

.quick-code-input::placeholder {
  letter-spacing: 0.3rem;
  color: var(--gray-400);
  font-weight: 400;
}

/* ============================================================
   QUICK 2FA — SUBMIT BUTTON (GREEN)
   ============================================================ */
.btn-submit-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  box-shadow: 0 8px 20px rgba(16, 185, 129, .3) !important;
}

.btn-submit-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 185, 129, .4) !important;
}

/* ============================================================
   QUICK 2FA — HELP FOOTER
   ============================================================ */
.quick-help-footer {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius);
  text-align: center;
}

.quick-help-footer p {
  margin: 0;
  font-size: .78rem;
  color: var(--gray-500);
  line-height: 1.6;
}

.quick-help-footer p i {
  color: var(--brand-500);
  margin-right: 4px;
}

.quick-help-footer small {
  display: inline-block;
  margin-top: 6px;
  font-size: .72rem;
  color: var(--gray-400);
  line-height: 1.5;
}

/* ============================================================
   RESPONSIVE - TABS
   ============================================================ */
@media (max-width: 480px) {
  .login-tabs {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .login-tab {
    padding: 10px 12px;
    font-size: .8rem;
  }
  .quick-code-input {
    font-size: 1.25rem !important;
    letter-spacing: 0.3rem !important;
  }
}