/* Login OBE UPI-YPTK - desain modern, responsif */

:root {
  --brand-1: #1e3a8a;
  --brand-2: #0f766e;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text: #0f172a;
  --muted: #64748b;
  --surface: #ffffff;
  --field: #f8fafc;
  --field-border: #e2e8f0;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #e2e8f0;
    --muted: #94a3b8;
    --surface: #0f172a;
    --field: #1e293b;
    --field-border: #334155;
    --danger-bg: #450a0a;
    --danger-text: #fca5a5;
    --danger-border: #7f1d1d;
  }
}

:root[data-theme="dark"] {
  --text: #e2e8f0;
  --muted: #94a3b8;
  --surface: #0f172a;
  --field: #1e293b;
  --field-border: #334155;
  --danger-bg: #450a0a;
  --danger-text: #fca5a5;
  --danger-border: #7f1d1d;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 100%);
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Dekorasi lingkaran samar di latar */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
body::before { width: 420px; height: 420px; top: -140px; left: -120px; }
body::after  { width: 300px; height: 300px; bottom: -110px; right: -80px; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  padding: 36px 32px 28px;
  animation: rise 0.45s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 16px;
  background: var(--field);
  padding: 8px;
  margin-bottom: 14px;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.brand p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.alert {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.alert.show { display: flex; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.control {
  position: relative;
}

.control > i.icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.control input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--field-border);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.control input::placeholder { color: var(--muted); opacity: 0.7; }

.control input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
  background: var(--surface);
}

.toggle-pass {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toggle-pass:hover { color: var(--text); background: var(--field); }
.toggle-pass:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-submit {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--brand-2) 100%);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 10px 20px -8px rgba(37, 99, 235, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit:hover { box-shadow: 0 14px 24px -8px rgba(37, 99, 235, 0.6); }
.btn-submit:active { transform: scale(0.99); }
.btn-submit:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.4); outline-offset: 2px; }
.btn-submit[disabled] { opacity: 0.75; cursor: wait; }

.btn-submit .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .label { opacity: 0.85; }

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

.card-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.card-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.card-footer a:hover { text-decoration: underline; }

/* Layar kecil */
@media (max-width: 420px) {
  .login-card { padding: 28px 22px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card, .btn-submit .spinner { animation: none; }
}
