/* ============================================================
   MEA ECOSYSTEM — Login Page
   /auth/login/style.css
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:           #081120;
  --card:         #101827;
  --border:       #1D293D;
  --text:         #F8FAFC;
  --muted:        #94A3B8;
  --primary:      #DFF4FF;
  --accent:       #7EC8FF;
  --error-bg:     rgba(239, 68, 68, 0.08);
  --error-border: rgba(239, 68, 68, 0.30);
  --error-text:   #FCA5A5;
  --font-heading: 'Bebas Neue', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --radius:       12px;
  --radius-sm:    8px;
  --transition:   0.2s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  /* Subtle grid texture */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(126,200,255,0.07) 0%, transparent 60%),
    linear-gradient(rgba(29,41,61,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29,41,61,0.3) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 24px;
  background: rgba(8, 17, 32, 0.80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(29, 41, 61, 0.6);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 40px;
  min-height: 100dvh;
}

/* ============================================================
   LOGIN CARD
   ============================================================ */
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow:
    0 0 0 1px rgba(126, 200, 255, 0.04),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(126, 200, 255, 0.04);
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---- Card Header ---- */
.card-header {
  text-align: center;
  margin-bottom: 32px;
}

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 12px;
  opacity: 0.85;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 300;
}

/* ============================================================
   ALERT
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  line-height: 1.5;
  animation: alertIn 0.25s ease both;
}

/* Hidden state — gunakan class, bukan attribute hidden */
.alert--hidden {
  display: none !important;
}

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

.alert--error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.alert__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forgot-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity var(--transition);
}

.forgot-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ---- Input Wrapper ---- */
.field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  flex-shrink: 0;
}

.field-input {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0 44px 0 42px;
  outline: none;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
  -webkit-appearance: none;
}

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

.field-input:focus {
  border-color: rgba(126, 200, 255, 0.5);
  background: rgba(126, 200, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(126, 200, 255, 0.08);
}

.field-input:invalid:not(:placeholder-shown) {
  border-color: rgba(239, 68, 68, 0.4);
}

/* ---- Show Password Toggle ---- */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color var(--transition);
}

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

.eye-icon {
  width: 16px;
  height: 16px;
}

/* ============================================================
   REMEMBER ME CHECKBOX
   ============================================================ */
.remember-row {
  margin-top: -4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--transition),
    background var(--transition);
  position: relative;
}

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

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

.checkbox-input:focus + .checkbox-custom {
  box-shadow: 0 0 0 3px rgba(126, 200, 255, 0.12);
}

.checkbox-text {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ============================================================
   LOGIN BUTTON
   ============================================================ */
.btn-login {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: #081120;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  transition:
    opacity var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-login:hover:not(:disabled)::before {
  opacity: 1;
}

.btn-login:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(126, 200, 255, 0.3);
  transform: translateY(-1px);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ---- Loading state — controlled via JS class on button ---- */
.btn-loading {
  display: none;
  align-items: center;
  gap: 8px;
}

.btn-login.is-loading .btn-text    { display: none; }
.btn-login.is-loading .btn-loading { display: flex; }

/* ---- Eye toggle — controlled via JS class ---- */
.eye-closed { display: none; }
.show-password .eye-open   { display: none; }
.show-password .eye-closed { display: block; }

/* ---- Spinner ---- */
.spinner {
  width: 16px;
  height: 16px;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

/* ============================================================
   REGISTER LINK
   ============================================================ */
.register-link {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.register-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition);
}

.register-link a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(29, 41, 61, 0.5);
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.6;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ============================================================
   DIVIDER (optional utility)
   ============================================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.5;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 20px;
    border-radius: var(--radius);
    margin: 0 4px;
  }

  .card-title {
    font-size: 1.7rem;
  }

  .header {
    padding: 14px 16px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 28px 16px;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
