/* ═══════════════════════════════════════════════════════════════
   TRANSSPARK — Enterprise Fleet Management Login Styles
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --navy-bg:      #071B35;
  --navy-surface: #0B2546;
  --navy-dark:    #041122;
  --blue-primary: #2563EB;
  --blue-hover:   #1D4ED8;
  --blue-active:  #1E40AF;
  --blue-tint:    rgba(37, 99, 235, 0.12);
  --white:        #FFFFFF;
  --bg-page:      #F8FAFC;
  --bg-input:     #F8FAFC;
  --text-dark:    #0F172A;
  --text-body:    #334155;
  --text-muted:   #64748B;
  --text-light:   #94A3B8;
  --border-color: #E2E8F0;
  --border-focus: #2563EB;
  --error-bg:     #FEF2F2;
  --error-text:   #DC2626;
  --error-border: #FECACA;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md:    0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg:    0 12px 32px -4px rgba(15, 23, 42, 0.1);
  --transition:   180ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body.login-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Split Layout Container ──────────────────────────────── */
.login-wrapper {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   LEFT BRAND PANEL (DESKTOP)
   ═══════════════════════════════════════════════════════════════ */
.login-brand {
  position: relative;
  flex: 0 0 45%;
  max-width: 45%;
  background: linear-gradient(155deg, var(--navy-bg) 0%, var(--navy-dark) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3.5rem 4rem;
  overflow: hidden;
  color: var(--white);
  user-select: none;
}

/* Subtle decorative glow & rings */
.brand-decor-glow {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, rgba(7, 27, 53, 0) 70%);
  pointer-events: none;
}

.brand-decor-ring {
  position: absolute;
  top: 55%;
  right: -160px;
  transform: translateY(-50%);
  width: 440px;
  height: 440px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.brand-decor-ring-sm {
  position: absolute;
  bottom: 8%;
  left: 10%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(37, 99, 235, 0.08);
  pointer-events: none;
}

/* Top Branding */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--blue-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.brand-logo-icon svg {
  width: 22px;
  height: 22px;
  fill: #FFFFFF;
}

.brand-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

/* Main Brand Content */
.brand-content {
  position: relative;
  z-index: 2;
  margin: auto 0;
  padding: 2rem 0;
}

.brand-headline {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  margin-bottom: 1.25rem;
}

.brand-headline span {
  color: #60A5FA;
}

.brand-description {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
  max-width: 460px;
  margin-bottom: 2.5rem;
}

/* 3 Real Capability Cards */
.brand-visual {
  width: 100%;
}

.fleet-cards {
  display: flex;
  gap: 12px;
}

.fleet-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  flex: 1;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

.fleet-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.fleet-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fleet-card-icon.vehicles {
  background: rgba(37, 99, 235, 0.2);
  color: #60A5FA;
}

.fleet-card-icon.team {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.fleet-card-icon.analytics {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

.fleet-card-icon svg {
  width: 18px;
  height: 18px;
}

.fleet-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fleet-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.fleet-card-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

/* Left Brand Footer */
.brand-footer {
  position: relative;
  z-index: 2;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   RIGHT LOGIN PANEL
   ═══════════════════════════════════════════════════════════════ */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background-color: var(--white);
  position: relative;
}

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

/* Form Top Logo */
.form-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}

.form-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--navy-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-logo-icon svg {
  width: 20px;
  height: 20px;
  fill: #FFFFFF;
}

.form-logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

/* Headings */
.form-header {
  margin-bottom: 1.75rem;
}

.form-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 6px;
}

.form-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Error Alert ─────────────────────────────────────────── */
.login-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  animation: slideDown 0.25s ease-out;
}

.login-error-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--error-text);
  margin-top: 1px;
}

.login-error-icon svg {
  width: 20px;
  height: 20px;
}

.login-error-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--error-text);
  line-height: 1.45;
}

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

/* ── Form Field Groups ───────────────────────────────────── */
.field-group {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 7px;
}

.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.field-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.field-input.password-input {
  padding-right: 48px;
}

.field-input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

.field-input:hover {
  border-color: #CBD5E1;
  background-color: #FFFFFF;
}

.field-input:focus {
  border-color: var(--border-focus);
  background-color: var(--white);
  box-shadow: 0 0 0 4px var(--blue-tint);
}

.field-input.has-error {
  border-color: var(--error-text);
  background-color: #FFF5F5;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Password Toggle Button */
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.password-toggle:hover {
  color: var(--text-dark);
  background-color: rgba(0, 0, 0, 0.05);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--blue-primary);
  outline-offset: 1px;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* ── Options Row (Remember Me / Forgot Password) ─────────── */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.checkbox-wrap input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-color);
  border-radius: 5px;
  background-color: var(--white);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-wrap input[type="checkbox"]:hover {
  border-color: #94A3B8;
}

.checkbox-wrap input[type="checkbox"]:checked {
  background-color: var(--blue-primary);
  border-color: var(--blue-primary);
}

.checkbox-wrap input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-wrap input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--blue-tint);
}

.checkbox-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-body);
}

.forgot-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--blue-primary);
  text-decoration: none;
  transition: color var(--transition);
}

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

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

/* ── Primary Submit Button ───────────────────────────────── */
.btn-login {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  background-color: var(--blue-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: background-color var(--transition), box-shadow var(--transition), transform 80ms ease;
}

.btn-login:hover:not(:disabled) {
  background-color: var(--blue-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-login:active:not(:disabled) {
  background-color: var(--blue-active);
  transform: scale(0.99);
}

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

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

/* Spinner */
.btn-login .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn-login.is-loading .spinner {
  display: block;
}

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

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

.btn-loading-text {
  display: none;
}

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

/* ── Footer ──────────────────────────────────────────────── */
.form-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.form-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-footer a {
  color: var(--blue-primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}

.form-footer a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.form-footer a:focus-visible {
  outline: 2px solid var(--blue-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════ */

/* Tablet Layout (768px – 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
  .login-brand {
    flex: 0 0 42%;
    max-width: 42%;
    padding: 2.5rem 2rem;
  }

  .brand-headline {
    font-size: 2.2rem;
  }

  .brand-description {
    font-size: 0.95rem;
  }

  .fleet-cards {
    flex-direction: column;
    gap: 8px;
  }

  .fleet-card {
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
  }

  .login-form-panel {
    padding: 2.5rem 2rem;
  }
}

/* Mobile Layout (< 768px) */
@media (max-width: 767px) {
  .login-wrapper {
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-page);
  }

  .login-brand {
    display: none;
  }

  .login-form-panel {
    padding: 2rem 1.25rem;
    background-color: var(--bg-page);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .login-form-container {
    max-width: 100%;
    background-color: var(--white);
    padding: 2.25rem 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
  }

  .form-heading {
    font-size: 1.5rem;
  }

  .form-subtitle {
    font-size: 0.875rem;
  }

  .form-options {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
}

/* Ultra-compact Mobile (< 390px) */
@media (max-width: 389px) {
  .login-form-panel {
    padding: 1.25rem 0.75rem;
  }

  .login-form-container {
    padding: 1.75rem 1.15rem;
    border-radius: var(--radius-lg);
  }

  .form-heading {
    font-size: 1.35rem;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
