/* ============================================
   Login Page — E-Library MIKHB
   ============================================ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --sidebar: #0F172A;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --success: #16A34A;
  --danger: #DC2626;
  --text: #1E293B;
  --muted: #64748B;
  --border: #E2E8F0;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.login-wrapper {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}

/* ============================================
   Panel Kiri — Branding
   ============================================ */
.login-brand {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35), transparent 70%);
  top: -120px;
  right: -120px;
  border-radius: 50%;
  pointer-events: none;
}

.login-brand::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent 70%);
  bottom: -80px;
  left: -80px;
  border-radius: 50%;
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
}

/* ===== Logo MIKHB ===== */
.brand-logo {
  width: 72px;
  height: 72px;
  background: #fff;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  padding: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-content h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.brand-content > p {
  color: #94A3B8;
  font-size: 15px;
  margin-bottom: 40px;
}

.brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #CBD5E1;
  font-size: 14px;
}

.brand-features li::before {
  content: '✓';
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: rgba(37, 99, 235, 0.2);
  color: #60A5FA;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.brand-footer {
  color: #64748B;
  font-size: 12px;
  position: relative;
  z-index: 1;
}

/* ============================================
   Panel Kanan — Form
   ============================================ */
.login-form-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--surface);
}

.form-container {
  width: 100%;
  max-width: 400px;
}

.form-header {
  margin-bottom: 32px;
}

.form-header h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.form-header p {
  color: var(--muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 44px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: all 0.2s;
  outline: none;
}

.input-wrapper input::placeholder {
  color: #94A3B8;
}

.input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
  color: var(--primary);
}

.input-wrapper input.is-invalid {
  border-color: var(--danger);
}

.input-wrapper input.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.toggle-password:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.error-text {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
  min-height: 14px;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 24px;
  font-size: 13px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.link-forgot {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.link-forgot:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ============================================
   Button Login
   ============================================ */
.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-login:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   Alert
   ============================================ */
.alert {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border-left: 4px solid;
  animation: slideDown 0.3s ease;
}

.alert.error {
  background: #FEF2F2;
  color: #991B1B;
  border-color: var(--danger);
}

.alert.success {
  background: #F0FDF4;
  color: #166534;
  border-color: var(--success);
}

.alert.warning {
  background: #FFFBEB;
  color: #92400E;
  border-color: #D97706;
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease;
  z-index: 999;
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: #D97706; }

/* ============================================
   Animations
   ============================================ */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .login-wrapper {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-form-panel {
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  .login-form-panel {
    padding: 24px 16px;
  }

  .form-header h2 {
    font-size: 22px;
  }

  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ============================================
   FIX: Atribut hidden harus selalu menang
   ============================================ */
[hidden] {
  display: none !important;
}

.btn-text[hidden],
.btn-loader[hidden] {
  display: none !important;
}

/* ============================================
   Form Badge (di atas judul)
   ============================================ */
.form-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #EFF6FF;
  color: #2563EB;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.form-badge svg { width: 13px; height: 13px; }

/* ============================================
   Divider + Switch Login
   ============================================ */
.login-divider {
  position: relative;
  text-align: center;
  margin: 24px 0 20px;
}

.login-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #E2E8F0;
}

.login-divider span {
  position: relative;
  background: #fff;
  padding: 0 12px;
  font-size: 12px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.login-switch {
  text-align: center;
}

.login-switch-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  color: #1E293B;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}

.login-switch-link:hover {
  border-color: #2563EB;
  color: #2563EB;
  background: #EFF6FF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.1);
}

.login-switch-link svg { width: 16px; height: 16px; }