* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f4f7fb;
  color: #152033;
  font-family: 'Poppins', sans-serif;
}

:root {
  --primary-color: #0b1f4d;
  --primary-color-dark: #061633;
  --accent-color: #d4af37;
  --accent-color-bright: #ffd700;
  --theme-text: #fff8dc;
  --theme-muted: #dec978;
  --theme-border: rgba(212, 175, 55, 0.38);
}

html[data-theme-color="red"] {
  --primary-color: #991b1b;
  --primary-color-dark: #450a0a;
  --accent-color: #ef4444;
  --accent-color-bright: #fecaca;
  --theme-text: #fff1f2;
  --theme-muted: #fee2e2;
  --theme-border: rgba(239, 68, 68, 0.42);
}

html[data-theme-color="black"] {
  --primary-color: #111827;
  --primary-color-dark: #020617;
  --accent-color: #64748b;
  --accent-color-bright: #cbd5e1;
  --theme-text: #f8fafc;
  --theme-muted: #cbd5e1;
  --theme-border: rgba(100, 116, 139, 0.46);
}

html[data-theme-color="green"] {
  --primary-color: #14532d;
  --primary-color-dark: #052e16;
  --accent-color: #22c55e;
  --accent-color-bright: #bbf7d0;
  --theme-text: #f0fdf4;
  --theme-muted: #dcfce7;
  --theme-border: rgba(34, 197, 94, 0.42);
}

html[data-theme-color="blue"] {
  --primary-color: #1d4ed8;
  --primary-color-dark: #1e3a8a;
  --accent-color: #38bdf8;
  --accent-color-bright: #bae6fd;
  --theme-text: #eff6ff;
  --theme-muted: #dbeafe;
  --theme-border: rgba(56, 189, 248, 0.42);
}

html[data-theme-color="emerald"] {
  --primary-color: #064e3b;
  --primary-color-dark: #022c22;
  --accent-color: #34d399;
  --accent-color-bright: #a7f3d0;
  --theme-text: #ecfdf5;
  --theme-muted: #bbf7d0;
  --theme-border: rgba(52, 211, 153, 0.42);
}

html[data-theme-color="royal"] {
  --primary-color: #1e3a8a;
  --primary-color-dark: #172554;
  --accent-color: #60a5fa;
  --accent-color-bright: #bfdbfe;
  --theme-text: #eff6ff;
  --theme-muted: #dbeafe;
  --theme-border: rgba(96, 165, 250, 0.42);
}

html[data-theme-color="crimson"] {
  --primary-color: #7f1d1d;
  --primary-color-dark: #450a0a;
  --accent-color: #fb7185;
  --accent-color-bright: #fecdd3;
  --theme-text: #fff1f2;
  --theme-muted: #ffe4e6;
  --theme-border: rgba(251, 113, 133, 0.42);
}

html[data-theme-color="graphite"] {
  --primary-color: #1f2937;
  --primary-color-dark: #111827;
  --accent-color: #f59e0b;
  --accent-color-bright: #fde68a;
  --theme-text: #f9fafb;
  --theme-muted: #e5e7eb;
  --theme-border: rgba(245, 158, 11, 0.42);
}

html[data-theme-color="violet"] {
  --primary-color: #4c1d95;
  --primary-color-dark: #2e1065;
  --accent-color: #a78bfa;
  --accent-color-bright: #ddd6fe;
  --theme-text: #f5f3ff;
  --theme-muted: #ede9fe;
  --theme-border: rgba(167, 139, 250, 0.42);
}

html[data-theme-color="cyan"] {
  --primary-color: #164e63;
  --primary-color-dark: #083344;
  --accent-color: #22d3ee;
  --accent-color-bright: #a5f3fc;
  --theme-text: #ecfeff;
  --theme-muted: #cffafe;
  --theme-border: rgba(34, 211, 238, 0.42);
}

html[data-theme-color="rose"] {
  --primary-color: #831843;
  --primary-color-dark: #500724;
  --accent-color: #f472b6;
  --accent-color-bright: #fbcfe8;
  --theme-text: #fff1f2;
  --theme-muted: #fce7f3;
  --theme-border: rgba(244, 114, 182, 0.42);
}

html[data-theme-color="olive"] {
  --primary-color: #3f6212;
  --primary-color-dark: #1a2e05;
  --accent-color: #a3e635;
  --accent-color-bright: #d9f99d;
  --theme-text: #f7fee7;
  --theme-muted: #ecfccb;
  --theme-border: rgba(163, 230, 53, 0.42);
}

html[data-theme-color="copper"] {
  --primary-color: #7c2d12;
  --primary-color-dark: #431407;
  --accent-color: #fb923c;
  --accent-color-bright: #fed7aa;
  --theme-text: #fff7ed;
  --theme-muted: #ffedd5;
  --theme-border: rgba(251, 146, 60, 0.42);
}

#preloader {
  position: fixed;
  inset: 0;
  z-index: 1999;
  display: flex;
  background-color: rgba(0, 0, 0, 0.58);
  background-image: url('../../backend/images/lg.gif');
  background-position: center;
  background-repeat: no-repeat;
  background-size: 96px 96px;
}

a {
  color: var(--primary-color);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-color-dark);
  text-decoration: none;
}

#app,
main {
  min-height: 100vh;
}

main.py-4 {
  padding: 0 !important;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: 100vh;
}

.auth-hero {
  position: relative;
  min-height: 100vh;
  background-image: url('../images/login.jpg');
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, rgba(23, 37, 84, 0.94), rgba(39, 60, 117, 0.68) 52%, rgba(212, 175, 55, 0.22));
}

.auth-hero__overlay {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  max-width: 760px;
  padding: 64px;
  color: #fff;
}

.auth-eyebrow {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-hero h1 {
  margin: 0;
  max-width: 640px;
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 600;
  line-height: 1.02;
}

.auth-hero p:last-child {
  max-width: 580px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 17px;
  line-height: 1.8;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 247, 251, 0.96) 48%, rgba(255, 248, 225, 0.92) 100%),
    #f7fafc;
}

.card-signin {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 490px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 75px rgba(15, 27, 45, 0.18);
}

.card-signin::before {
  content: "";
  display: block;
  height: 9px;
  background: linear-gradient(90deg, var(--primary-color-dark) 0%, var(--primary-color) 50%, var(--accent-color) 100%);
}

.card-signin .card-body {
  padding: 44px;
}

.brand-lockup {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.logo {
  display: block;
  width: auto;
  max-width: min(260px, 100%);
  max-height: 92px;
  object-fit: contain;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.18);
}

.auth-heading {
  margin-bottom: 30px;
  text-align: center;
}

.auth-heading p {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 14px;
  padding: 8px 13px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 999px;
  background: #fff8dc;
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-heading h2 {
  margin: 0;
  color: #0f1f34;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.12;
}

.auth-heading span {
  display: block;
  margin-top: 10px;
  color: #6a7688;
  font-size: 14px;
  line-height: 1.5;
}

.alert {
  border-radius: 8px;
  font-size: 14px;
}

.alert-success {
  color: #164626;
  background-color: #e9f8ee;
  border-color: #9bd5ad;
}

.form-signin {
  width: 100%;
}

.form-signin .form-group {
  margin-bottom: 20px;
}

.form-signin label,
.label-row label {
  margin-bottom: 8px;
  color: #12223a;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.forgot-link {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
}

.form-signin .form-control {
  height: 56px;
  border: 2px solid #dbe4ee;
  border-radius: 8px;
  background: #f9fbfe;
  color: #111827;
  font-size: 16px;
  padding: 14px 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-signin .form-control::placeholder {
  color: #9aa6b8;
}

.form-signin .form-control:focus {
  border-color: var(--accent-color);
  background: #fff;
  box-shadow: 0 0 0 5px rgba(212, 175, 55, 0.16);
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 58px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #526176;
  transform: translateY(-50%);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.password-toggle:hover,
.password-toggle:focus {
  background: #fff8dc;
  color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.14);
  outline: 0;
}

.password-toggle[aria-pressed="true"] {
  background: #fff8f1;
  color: var(--accent-color);
}

.password-toggle__icon {
  position: relative;
  display: block;
  width: 21px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% / 58%;
}

.password-toggle__icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.password-toggle[aria-pressed="true"] .password-toggle__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 29px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-38deg);
}

.invalid-feedback {
  margin-top: 8px;
  text-align: left;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 18px;
}

.custom-control-label {
  color: #344257;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.custom-control-label::before,
.custom-control-label::after {
  top: 0.15rem;
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
  border-color: var(--accent-color);
  background-color: var(--accent-color);
}

.terms-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 24px;
  padding: 15px;
  border: 1px solid #ffd9bc;
  border-radius: 8px;
  background: #fff8f1;
}

.terms-check input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--accent-color);
}

.terms-check label {
  margin: 0;
  color: #3f4d61;
  font-size: 13px;
  line-height: 1.55;
}

.terms-check a {
  font-weight: 600;
}

.btn-login {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary-color-dark) 0%, var(--primary-color) 52%, var(--accent-color) 100%);
  background-size: 160% 100%;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 18px 34px rgba(212, 175, 55, 0.26), 0 12px 26px rgba(39, 60, 117, 0.22);
  transition: background-position 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-login:hover,
.btn-login:focus {
  background-position: 100% 0;
  box-shadow: 0 22px 40px rgba(212, 175, 55, 0.32), 0 14px 30px rgba(39, 60, 117, 0.24);
  transform: translateY(-2px);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-register {
  display: block;
  color: #111827;
  font-size: 15px !important;
  text-align: center;
}

select.form-control {
  min-height: 50px;
}

@media (max-width: 991px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    display: none;
  }

  .auth-panel {
    align-items: flex-start;
    min-height: 100svh;
    padding: 0;
  }

  .card-signin {
    max-width: none;
    min-height: 100svh;
    border-radius: 0;
    box-shadow: none;
  }

  .card-signin .card-body {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 575px) {
  #app,
  main,
  .auth-shell,
  .auth-panel {
    min-height: 100svh;
  }

  .auth-hero {
    display: none;
  }

  .auth-panel {
    align-items: stretch;
    padding: 10px;
  }

  .card-signin {
    display: flex;
    max-width: none;
    min-height: calc(100svh - 20px);
    box-shadow: 0 16px 42px rgba(15, 27, 45, 0.14);
  }

  .card-signin::before {
    height: 6px;
  }

  .card-signin .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    padding: 18px 16px;
  }

  .brand-lockup {
    margin-bottom: 12px;
  }

  .logo {
    max-height: 58px;
    max-width: min(210px, 100%);
    padding: 9px 12px;
    border-radius: 8px;
  }

  .auth-heading {
    margin-bottom: 16px;
  }

  .auth-heading p {
    margin-bottom: 8px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .auth-heading h2 {
    font-size: 22px;
  }

  .auth-heading span {
    margin-top: 6px;
    font-size: 12px;
  }

  .form-signin .form-group {
    margin-bottom: 12px;
  }

  .form-signin label,
  .label-row label {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .forgot-link {
    font-size: 11px;
  }

  .form-signin .form-control {
    height: 46px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .password-field .form-control {
    padding-right: 50px;
  }

  .password-toggle {
    right: 7px;
    width: 34px;
    height: 34px;
  }

  .password-toggle__icon {
    width: 19px;
    height: 13px;
  }

  .auth-options {
    margin: 0 0 10px;
  }

  .custom-control-label {
    font-size: 12px;
  }

  .terms-check {
    margin-bottom: 14px;
    padding: 10px;
  }

  .terms-check label {
    font-size: 11px;
    line-height: 1.4;
  }

  .btn-login {
    min-height: 48px;
    font-size: 13px;
  }
}

@media (max-width: 575px) and (max-height: 680px) {
  .card-signin .card-body {
    justify-content: flex-start;
  }

  .auth-heading span {
    display: none;
  }

  .logo {
    max-height: 48px;
    padding: 8px 10px;
  }

  .auth-heading h2 {
    font-size: 20px;
  }
}

/* Dark blue and gold theme override */
body {
  background: #fff;
  color: var(--primary-color-dark);
}

a,
a:visited,
.forgot-link,
.terms-check a {
  color: var(--accent-color-bright);
}

a:hover,
a:focus {
  color: var(--accent-color);
}

.auth-hero::before {
  background:
    linear-gradient(115deg, rgba(6, 22, 51, 0.96), rgba(11, 31, 77, 0.78) 56%, rgba(212, 175, 55, 0.28));
}

.auth-hero__overlay,
.auth-hero p:last-child,
.auth-eyebrow {
  color: var(--theme-text);
}

.auth-panel {
  background:
    linear-gradient(135deg, rgba(6, 22, 51, 0.98) 0%, rgba(11, 31, 77, 0.96) 58%, rgba(212, 175, 55, 0.24) 100%),
    var(--primary-color-dark);
}

.card-signin {
  background: var(--primary-color);
  border-color: var(--theme-border);
  box-shadow: 0 26px 75px rgba(0, 0, 0, 0.34);
}

.card-signin::before {
  background: linear-gradient(90deg, var(--primary-color-dark) 0%, var(--primary-color) 48%, var(--accent-color-bright) 100%);
}

.auth-heading p,
.terms-check,
.password-toggle:hover,
.password-toggle:focus,
.password-toggle[aria-pressed="true"] {
  background: rgba(212, 175, 55, 0.14);
  border-color: var(--theme-border);
  color: var(--accent-color-bright);
}

.auth-heading h2,
.form-signin label,
.label-row label,
.custom-control-label,
.terms-check label,
.btn-register {
  color: var(--theme-text);
}

.auth-heading span,
.password-toggle,
.form-signin .form-control::placeholder {
  color: var(--theme-muted);
}

.form-signin .form-control,
select.form-control {
  background: #102b66;
  border-color: var(--theme-border);
  color: var(--theme-text);
}

.form-signin .form-control:focus {
  background: #102b66;
  border-color: var(--accent-color-bright);
  color: var(--theme-text);
  box-shadow: 0 0 0 5px rgba(212, 175, 55, 0.18);
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
  border-color: var(--accent-color-bright);
  background-color: var(--accent-color);
}

.btn-login,
.btn-primary {
  background: linear-gradient(90deg, var(--primary-color-dark) 0%, var(--primary-color) 52%, var(--accent-color) 100%);
  border-color: var(--accent-color);
  color: var(--theme-text);
}

.btn-login:hover,
.btn-login:focus,
.btn-primary:hover,
.btn-primary:focus {
  background-position: 100% 0;
  border-color: var(--accent-color-bright);
  color: var(--primary-color-dark);
}

.alert,
.alert-success,
.alert-danger,
.alert-warning,
.alert-info {
  background: #102b66;
  border: 1px solid var(--theme-border);
  color: var(--accent-color-bright);
}

.password-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--theme-border);
}

.password-toggle__icon {
  border: 2px solid currentColor;
  border-radius: 50% / 58%;
  display: block;
  height: 14px;
  line-height: 1;
  position: relative;
  width: 22px;
}

.password-toggle__icon::before {
  background: currentColor;
  border-radius: 50%;
  content: "" !important;
  height: 6px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
}

.password-toggle__icon::after {
  content: none;
}

.password-toggle[aria-pressed="true"] .password-toggle__icon::after {
  background: currentColor;
  border-radius: 999px;
  content: "" !important;
  height: 2px;
  left: -5px;
  position: absolute;
  top: 50%;
  transform: rotate(-38deg);
  width: 32px;
}
