/**
 * SiRiMailer Pro - Login
 * Aligned with admin shell navy (#0B1E59) + PRO accent (#00a6ff)
 */

/* ============================================
   CSS VARIABLES & DESIGN TOKENS
   ============================================ */

:root {
  /* Color Palette — shell-matched */
  --color-primary: #0B1E59;
  --color-primary-dark: #071438;
  --color-primary-hover: #14306f;
  --color-primary-light: #E8EEF8;
  --color-accent: #00a6ff;
  --color-accent-soft: rgba(0, 166, 255, 0.14);
  --color-error: #D32F2F;
  --color-success: #2E7D32;
  --color-warning: #F57C00;
  --color-info: #0277BD;
  --color-text-primary: #121826;
  --color-text-secondary: #5B6578;
  --color-text-tertiary: #8B93A7;
  --color-border: #E2E6EF;
  --color-border-light: #F3F5F9;
  --color-bg: #F5F7FB;
  --color-bg-white: #FFFFFF;
  --color-hero-dark: #0B1E59;
  --color-hero-darker: #071438;
  --color-page-wash-start: #E8EEF6;
  --color-page-wash-end: #F4F7FC;

  /* Spacing Scale */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
  --spacing-3xl: 48px;
  --spacing-4xl: 64px;

  /* Typography */
  --font-family-primary: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', monospace;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --font-size-3xl: 40px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Sizing */
  --size-input-height: 48px;
  --size-button-height: 48px;
  --size-button-height-mobile: 52px;
  --size-touch-target: 48px;
  --size-border-radius-sm: 8px;
  --size-border-radius-md: 12px;
  --size-border-radius-lg: 16px;
  --size-focus-ring: 3px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background:
    radial-gradient(1200px 600px at 12% 10%, rgba(0, 166, 255, 0.10), transparent 55%),
    radial-gradient(900px 500px at 90% 85%, rgba(11, 30, 89, 0.10), transparent 50%),
    linear-gradient(160deg, var(--color-page-wash-start) 0%, var(--color-page-wash-end) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .login-wrapper,
  .feature-item {
    animation: none;
  }

  .feature-item:hover {
    transform: none;
  }
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
  width: 100%;
  max-width: 1280px;
  height: auto;
}

.login-wrapper {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  background: var(--color-bg-white);
  border-radius: var(--size-border-radius-lg);
  overflow: hidden;
  box-shadow:
    0 24px 48px rgba(11, 30, 89, 0.14),
    0 2px 6px rgba(11, 30, 89, 0.06);
  min-height: 640px;
  border: 1px solid rgba(11, 30, 89, 0.06);
  animation: loginEnter 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes loginEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   HERO/BRANDING SECTION
   ============================================ */

.login-hero {
  background:
    linear-gradient(155deg, #14306f 0%, #0B1E59 42%, #071438 100%);
  color: var(--color-bg-white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--spacing-3xl) var(--spacing-2xl);
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Layer 1: faint repeating dot grid (subtle "map" feel), fixed px tile so
     dot size stays consistent regardless of panel height.
     Layer 2: dashed flight route + plane, a small ship + gantry crane
     silhouette positioned in the panel's empty lower-right quadrant so it
     never overlaps the heading, feature list or footer text.
     Layer 3: soft glow for depth. */
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.2) 1px, transparent 1.5px),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 620"><g fill="none" stroke="white"><path d="M 235 500 Q 300 400 368 210" stroke-width="1.5" stroke-dasharray="1,8" stroke-linecap="round" opacity="0.32"/><g transform="translate(348,195) rotate(-25)" opacity="0.4"><path d="M0 0 L 26 2 L 34 6 L 26 8 L 20 14 L 16 8 L 0 6 L 6 3 Z" fill="white" stroke="none"/></g><g transform="translate(248,513)" opacity="0.28" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M0 40 Q4 23 14 20 L66 20 Q76 23 80 40 Z"/><rect x="10" y="20" width="10" height="10"/><rect x="24" y="6" width="14" height="14"/><rect x="41" y="6" width="14" height="14"/><rect x="58" y="6" width="14" height="14"/><line x1="0" y1="40" x2="80" y2="40"/></g><g transform="translate(340,475)" opacity="0.2" stroke-width="2" stroke-linecap="round"><line x1="0" y1="60" x2="0" y2="0"/><line x1="0" y1="0" x2="40" y2="0"/><line x1="0" y1="14" x2="26" y2="14"/><line x1="26" y1="0" x2="26" y2="14"/></g></g></svg>'),
    radial-gradient(circle at 85% 8%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
  background-size: 46px 46px, 100% 100%, 100% 100%;
  background-position: 0 0, 0 0, 0 0;
  background-repeat: repeat, no-repeat, no-repeat;
  pointer-events: none;
}

.login-hero-content {
  position: relative;
  z-index: 1;
}

.login-hero-brand {
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(0, 166, 255, 0.28), rgba(255, 255, 255, 0.08));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.login-brand-text {
  min-width: 0;
}

.login-hero h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--spacing-sm) 0;
  letter-spacing: -0.5px;
  line-height: var(--line-height-tight);
}

.login-hero .brand-pro {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  margin-left: 4px;
}

.login-hero .tagline {
  font-size: var(--font-size-base);
  opacity: 0.95;
  margin-bottom: var(--spacing-md);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-hero .subtitle {
  font-size: var(--font-size-sm);
  opacity: 0.9;
  margin-bottom: var(--spacing-xl);
}

/* Features List */
.hero-features {
  margin-top: var(--spacing-2xl);
  margin-bottom: auto;
}

.feature-item {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  align-items: flex-start;
  padding: var(--spacing-md);
  border-radius: var(--size-border-radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
  animation: featureIn 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.feature-item:nth-child(1) { animation-delay: 80ms; }
.feature-item:nth-child(2) { animation-delay: 160ms; }
.feature-item:nth-child(3) { animation-delay: 240ms; }

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

.feature-item:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(0, 166, 255, 0.35);
  transform: translateX(3px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 166, 255, 0.22);
  border-radius: var(--size-border-radius-md);
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-content h3 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 4px 0;
  line-height: var(--line-height-tight);
}

.feature-content p {
  font-size: var(--font-size-xs);
  opacity: 0.85;
  margin: 0;
  line-height: var(--line-height-tight);
}

.hero-footer {
  margin-top: auto;
  padding-top: var(--spacing-2xl);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: var(--font-size-xs);
  opacity: 0.72;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

/* ============================================
   FORM SECTION
   ============================================ */

.login-form-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--spacing-3xl) var(--spacing-3xl);
  background: var(--color-bg-white);
  position: relative;
}

.login-form-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--color-accent), rgba(11, 30, 89, 0.35));
}

.login-form-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-form-header {
  margin-bottom: var(--spacing-xl);
}

.login-form-header h2 {
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
}

.login-form-header .welcome-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 0;
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
}

.login-form-header .description {
  display: none;
}

/* ============================================
   FORM STYLES
   ============================================ */

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  position: relative;
}

.form-label {
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--color-error);
  font-weight: var(--font-weight-bold);
}

.form-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  height: var(--size-input-height);
  padding: var(--spacing-md) var(--spacing-lg);
  padding-left: 44px;
  font-size: var(--font-size-base);
  font-family: var(--font-family-primary);
  border: 1px solid #E8E8E8;
  border-radius: var(--size-border-radius-sm);
  background: #FFFFFF;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  appearance: none;
}

.form-input::placeholder {
  color: var(--color-text-tertiary);
}

.form-input:hover {
  border-color: #CCCCCC;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-input:disabled {
  background: var(--color-border-light);
  color: var(--color-text-tertiary);
  cursor: not-allowed;
}

/* Keeps autofilled fields visually consistent with a manually-typed field;
   without this, Chrome/Safari tint autofilled inputs yellow/blue, making
   username and password look inconsistent whenever autofill is used. */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-text-primary);
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset;
  box-shadow: 0 0 0 1000px #FFFFFF inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* Icon prefix inside input */
.form-input-icon {
  position: absolute;
  left: var(--spacing-lg);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  font-size: 18px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.form-input-wrapper:focus-within .form-input-icon {
  color: var(--color-accent);
}

/* Password toggle button */
.input-with-icon .form-input {
  padding-right: 44px;
}

.input-icon {
  position: absolute;
  right: var(--spacing-lg);
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--size-border-radius-sm);
}

.input-icon:hover {
  color: var(--color-accent);
}

.input-icon:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--size-border-radius-sm);
}

/* Form error message */
.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  animation: slideDown var(--transition-fast) ease-out;
}

.form-error i {
  flex-shrink: 0;
  font-size: var(--font-size-sm);
}

.form-group.has-error .form-input {
  border-color: var(--color-error);
  background-color: rgba(211, 47, 47, 0.02);
}

.form-group.has-error .form-input:focus {
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.08);
}

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

/* ============================================
   FORM CONTROLS
   ============================================ */

/* Checkbox for "Remember me" */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  user-select: none;
}

.checkbox-input {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-bg-white);
  flex-shrink: 0;
}

.checkbox-input:hover {
  border-color: var(--color-primary);
  background: var(--color-accent-soft);
}

.checkbox-input:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="white"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}

.checkbox-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.checkbox-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  border: none;
  border-radius: var(--size-border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  appearance: none;
  font-family: var(--font-family-primary);
  min-height: var(--size-button-height);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Primary button */
.btn-primary {
  background: linear-gradient(180deg, #14306f 0%, var(--color-primary) 100%);
  color: var(--color-bg-white);
  width: 100%;
  height: var(--size-button-height);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  box-shadow: 0 10px 22px rgba(11, 30, 89, 0.28);
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #1a3b82 0%, var(--color-primary-hover) 100%);
  box-shadow: 0 14px 28px rgba(11, 30, 89, 0.34);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-primary:disabled {
  background: var(--color-text-tertiary);
}

/* Button with loading state */
.btn.is-loading {
  position: relative;
  color: transparent;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--color-bg-white);
  animation: spin var(--transition-slow) linear infinite;
}

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

/* ============================================
   FORM FOOTER & LINKS
   ============================================ */

.form-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
  flex-wrap: wrap;
}

.remember-me-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.forgot-password-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.forgot-password-link {
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}

.forgot-password-link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.forgot-password-link:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   DIVIDER & SECURITY
   ============================================ */

.form-divider {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin: var(--spacing-xl) 0;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

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

.security-info {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(135deg, var(--color-primary-light), #F8FBFF);
  border-radius: var(--size-border-radius-sm);
  border: 1px solid rgba(11, 30, 89, 0.08);
}

.security-icon {
  font-size: var(--font-size-lg);
  color: var(--color-accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.security-icon svg path {
  stroke: var(--color-accent);
}

.security-icon svg {
  width: 100%;
  height: 100%;
}

.security-content h3 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 4px 0;
}

.security-content p {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: var(--line-height-tight);
}

/* ============================================
   MESSAGES (ALERTS, ERRORS, SUCCESS)
   ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  border-radius: var(--size-border-radius-sm);
  border-left: 4px solid;
  font-size: var(--font-size-sm);
  animation: slideDown var(--transition-fast) ease-out;
  margin-bottom: var(--spacing-lg);
}

.alert-icon {
  flex-shrink: 0;
  font-size: var(--font-size-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-content {
  flex: 1;
}

.alert-message {
  margin: 0;
  line-height: var(--line-height-normal);
}

.alert-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  padding: 0;
  font-size: var(--font-size-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-close:hover {
  opacity: 1;
}

/* Success message */
.alert-success {
  background-color: rgba(46, 125, 50, 0.06);
  border-left-color: var(--color-success);
  color: var(--color-success);
}

.alert-success .alert-icon {
  color: var(--color-success);
}

/* Error message */
.alert-error {
  background-color: rgba(211, 47, 47, 0.06);
  border-left-color: var(--color-error);
  color: var(--color-error);
}

.alert-error .alert-icon {
  color: var(--color-error);
}

/* Warning message */
.alert-warning {
  background-color: rgba(245, 127, 0, 0.06);
  border-left-color: var(--color-warning);
  color: #E65100;
}

.alert-warning .alert-icon {
  color: var(--color-warning);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 20, 56, 0.42);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-overlay.is-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin var(--transition-slow) linear infinite;
  box-shadow: 0 12px 32px rgba(7, 20, 56, 0.35);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .login-wrapper {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-hero {
    min-height: 0;
    padding: var(--spacing-2xl);
    justify-content: flex-start;
  }

  .login-form-container {
    padding: var(--spacing-2xl);
  }

  .login-form-container::before {
    width: 100%;
    height: 3px;
    left: 0;
    top: 0;
    background: linear-gradient(90deg, var(--color-accent), rgba(11, 30, 89, 0.35));
  }

  .login-hero h1 {
    font-size: var(--font-size-2xl);
  }

  .hero-features {
    margin-top: var(--spacing-xl);
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .remember-me-wrapper,
  .forgot-password-wrapper {
    width: 100%;
    justify-content: center;
  }
}

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
  body {
    padding: var(--spacing-md);
  }

  .login-wrapper {
    min-height: auto;
    border-radius: var(--size-border-radius-md);
  }

  .login-hero {
    min-height: 0;
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-lg);
    justify-content: flex-start;
  }

  .login-hero-brand {
    margin-bottom: var(--spacing-md);
    align-items: center;
  }

  .login-brand-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .login-hero h1 {
    font-size: 22px;
  }

  .login-hero .tagline {
    font-size: 11px;
    margin-bottom: 0;
  }

  .login-hero .subtitle,
  .hero-features,
  .hero-footer {
    display: none;
  }

  .login-form-container {
    padding: var(--spacing-xl) var(--spacing-lg);
  }

  .login-form-header h2 {
    font-size: var(--font-size-xl);
  }

  .login-form-header .welcome-text,
  .login-form-header .description {
    font-size: var(--font-size-sm);
  }

  .btn-primary {
    height: var(--size-button-height-mobile);
  }

  .form-input {
    font-size: 16px;
    height: 48px;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .remember-me-wrapper,
  .forgot-password-wrapper {
    width: 100%;
    justify-content: center;
  }

  .security-info {
    margin-bottom: 0;
  }

  .form-divider {
    margin: var(--spacing-lg) 0;
  }

  /* Keep only the safe tiled dot pattern on short mobile heroes. */
  .login-hero::before {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.2) 1px, transparent 1.5px);
    background-size: 46px 46px;
    background-position: 0 0;
    background-repeat: repeat;
  }
}

/* Small mobile (< 360px) */
@media (max-width: 360px) {
  .login-form-container,
  .login-hero {
    padding: var(--spacing-lg);
  }

  .login-hero-brand {
    margin-bottom: var(--spacing-md);
  }

  .login-hero h1 {
    font-size: 20px;
  }

  .login-form-header h2 {
    font-size: var(--font-size-lg);
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: more) {
  .form-input {
    border-width: 2px;
  }

  .btn {
    border: 2px solid currentColor;
  }

  .alert {
    border-left-width: 6px;
  }
}

/* ============================================
   DARK MODE (Future support)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* Can be extended when dark mode is needed */
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  body {
    background: white;
  }

  .login-wrapper {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
