:root {
  --bg: #f4f7fb;
  --bg-secondary: #eef3f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d9e2ec;
  --primary: #1f4d8f;
  --primary-hover: #173b6d;
  --primary-soft: rgba(31, 77, 143, 0.10);
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #b91c1c;
  --input-bg: #f9fafb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 77, 143, 0.08), transparent 30%),
    radial-gradient(circle at bottom right, rgba(31, 77, 143, 0.06), transparent 25%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: 430px;
}

.login-card {
  background: var(--card);
  border: 1px solid rgba(217, 226, 236, 0.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-header {
  padding: 32px 32px 18px;
  text-align: center;
}

.brand-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(31, 77, 143, 0.22);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-body {
  padding: 24px 32px 32px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-border);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  line-height: 1.4;
}

.alert-content strong {
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-error {
  border-color: #dc2626;
  background: #fff8f8;
}

.input-error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.password-field {
  position: relative;
}

.password-input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.password-toggle:hover {
  background: rgba(31, 77, 143, 0.08);
  color: var(--primary);
}

.password-toggle:focus {
  outline: none;
  background: rgba(31, 77, 143, 0.08);
  box-shadow: 0 0 0 3px rgba(31, 77, 143, 0.12);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hidden {
  display: none;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.submit-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 77, 143, 0.18);
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--primary-hover), #1d4ed8);
}

.submit-btn:disabled {
  opacity: 0.88;
  cursor: not-allowed;
  transform: none;
}

.submit-btn.loading {
  pointer-events: none;
}

.submit-btn-text {
  line-height: 1;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: none;
}

.submit-btn.loading .spinner {
  display: inline-block;
}

.login-footer-text {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 16px;
  }

  .login-header {
    padding: 24px 20px 14px;
  }

  .login-body {
    padding: 20px 20px 24px;
  }

  .login-title {
    font-size: 24px;
  }

  .brand-icon {
    width: 58px;
    height: 58px;
    font-size: 22px;
  }
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.brand-logo img {
  max-width: 180px;
  max-height: 70px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}