/* ============================================================
   signin.css — TireGuy App / Tire Data Metrics
   Sign-in page styles
   ============================================================ */

/* ── PAGE SHELL ── */
.si-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;

  /* Brand background — dark: bg4 (high-contrast gears), light: bg3 (purple gears) */
  background-image: url('/images/bg4.png');
  background-size: cover;
  background-position: center;
}

/* Dark overlay on background */
.si-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(8, 8, 15, 0.50) 0%,
    rgba(30, 10, 55, 0.45) 50%,
    rgba(8, 8, 15, 0.55) 100%
  );
  z-index: 0;
}

/* Grain texture */
.si-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--tdm-grain-opacity);
  pointer-events: none;
  z-index: 1;
}

/* ── CARD ── */
.si-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  background: var(--tdm-elevated);
  border: 1px solid var(--tdm-border);
  border-radius: 16px;
  padding: 2.4rem 2.4rem 2rem;
  box-shadow:
    0 0 0 1px rgba(var(--tdm-purple-rgb), 0.08),
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(var(--tdm-purple-rgb), 0.08);
}

/* ── CARD ── */
.si-card-600 {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    background: var(--tdm-elevated);
    border: 1px solid var(--tdm-border);
    border-radius: 16px;
    padding: 2.4rem 2.4rem 2rem;
    box-shadow: 0 0 0 1px rgba(var(--tdm-purple-rgb), 0.08), 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 80px rgba(var(--tdm-purple-rgb), 0.08);
}

/* ── LOGO ── */
.si-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.8rem;
}

.si-logo {
  height: 36px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(var(--tdm-purple-rgb), 0.55));
}

.si-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.si-brand-name {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--tdm-chrome);
}

.si-brand-sub {
  font-family: 'Barlow', sans-serif;
  font-size: 0.63rem;
  font-weight: 500;
  color: var(--tdm-text);
  letter-spacing: 0.04em;
}

/* ── HEADINGS ── */
.si-heading {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--tdm-white);
  line-height: 1;
  margin: 0 0 0.3rem;
}

.si-sub {
  font-size: 0.82rem;
  color: var(--tdm-text);
  margin: 0 0 1.8rem;
}

/* ── FIELDS ── */
.si-field-wrap {
  margin-bottom: 1.1rem;
}

.si-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tdm-chrome);
  margin-bottom: 0.4rem;
}

.si-label-req::after {
    content: ' *';
    color: var(--tdm-red);
    opacity: 1;
}

.si-input-wrap {
  position: relative;
}

.si-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tdm-text);
  font-size: 0.85rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.si-input {
  width: 100%;
  padding: 0.62rem 0.9rem 0.62rem 2.4rem;
  background: #20203c;
  border: 1px solid rgba(139, 92, 246, 0.32);
  border-radius: 8px;
  color: #e8e8ff;
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color-scheme: dark;
}

.si-input::placeholder {
  color: #6868a0;
}

.si-input:focus {
  border-color: var(--tdm-purple);
  box-shadow: 0 0 0 3px rgba(var(--tdm-purple-rgb), 0.18);
}

.si-input:focus + .si-input-icon,
.si-input-wrap:focus-within .si-input-icon {
  color: var(--tdm-purple);
}
.si-form-hint {
    font-family: 'Barlow', sans-serif;
    font-size: 0.75rem;
    color: var(--tdm-text);
    opacity: 0.7;
}
/* Password toggle */
.si-pw-toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.2rem 0.3rem;
  color: var(--tdm-text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  line-height: 1;
}

.si-pw-toggle:hover { color: var(--tdm-chrome); }

/* Validation */
.si-field-wrap.was-invalid .si-input {
  border-color: var(--tdm-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.si-invalid-msg {
  display: none;
  font-size: 0.72rem;
  color: var(--tdm-red);
  margin-top: 0.3rem;
}

.si-field-wrap.was-invalid .si-invalid-msg {
  display: block;
}

/* ── REMEMBER + FORGOT ROW ── */
.si-row-aux {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.2rem 0 1.4rem;
  gap: 0.5rem;
}

/* Custom checkbox */
.si-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--tdm-text);
  user-select: none;
}

.si-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.si-check-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  border-radius: 4px;
  background: #20203c;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.si-check-box::after {
  content: '';
  display: none;
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.si-checkbox:checked + .si-check-box {
  background: var(--tdm-purple);
  border-color: var(--tdm-purple);
}

.si-checkbox:checked + .si-check-box::after {
  display: block;
}

.si-checkbox:focus-visible + .si-check-box {
  box-shadow: 0 0 0 3px rgba(var(--tdm-purple-rgb), 0.25);
}

/* Links */
.si-link {
  font-size: 0.82rem;
  color: var(--tdm-purple);
  text-decoration: none;
  transition: color 0.2s ease;
}

.si-link:hover { color: var(--tdm-purple-hi); }
.si-link:focus-visible {
  outline: 2px solid var(--tdm-purple);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── SUBMIT BUTTON ── */
.si-btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.72rem 1.5rem;
  background: var(--tdm-purple);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    background 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 18px rgba(var(--tdm-purple-rgb), 0.35);
  margin-bottom: 0.3rem;
}

.si-btn-arrow {
  font-size: 1.3rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.si-btn-submit:hover {
  background: var(--tdm-purple-hi);
  box-shadow: 0 6px 24px rgba(var(--tdm-purple-rgb), 0.5);
  transform: translateY(-1px);
}

.si-btn-submit:hover .si-btn-arrow {
  transform: translateX(3px);
}

.si-btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(var(--tdm-purple-rgb), 0.3);
}

.si-btn-submit:focus-visible {
  outline: 2px solid var(--tdm-purple-hi);
  outline-offset: 3px;
}

/* ── REGISTER LINK ── */
.si-register {
  text-align: center;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--tdm-border);
  font-size: 0.82rem;
  color: var(--tdm-text);
}

.si-link-hi {
  font-weight: 600;
  color: var(--tdm-purple);
}

.si-link-hi:hover { color: var(--tdm-purple-hi); }

/* ── THEME TOGGLE ── */
.si-theme-wrap {
  position: fixed;
  top: 1rem;
  right: 1.2rem;
  z-index: 100;
}

.si-theme-menu {
  background: var(--tdm-elevated);
  border: 1px solid var(--tdm-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 140px;
}

.si-theme-menu .dropdown-item {
  color: var(--tdm-chrome);
  font-size: 0.82rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  margin: 0.15rem 0.25rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.si-theme-menu .dropdown-item:hover {
  background: rgba(var(--tdm-purple-rgb), 0.15);
  color: var(--tdm-purple-hi);
}

/* ── LIGHT MODE OVERRIDES ── */
[data-bs-theme="light"] .si-page { background-image: url('/images/bg3.png'); }

[data-bs-theme="light"] .si-card {
  background: #ffffff;
  border-color: rgba(109, 40, 217, 0.16);
  box-shadow:
    0 0 0 1px rgba(109, 40, 217, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.10),
    0 0 60px rgba(109, 40, 217, 0.06);
}

[data-bs-theme="light"] .si-page::before {
  background: linear-gradient(
    145deg,
    rgba(220, 215, 245, 0.78) 0%,
    rgba(200, 190, 240, 0.72) 50%,
    rgba(220, 215, 245, 0.82) 100%
  );
}

[data-bs-theme="light"] .si-input {
  background: #f5f5fa;
  border-color: rgba(109, 40, 217, 0.28);
  color: #2d2d4a;
  color-scheme: light;
}

[data-bs-theme="light"] .si-input::placeholder { color: #9090b8; }

[data-bs-theme="light"] .si-input:focus {
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.14);
}

[data-bs-theme="light"] .si-check-box {
  background: #f5f5fa;
  border-color: rgba(109, 40, 217, 0.35);
}

[data-bs-theme="light"] .si-pw-toggle { color: #9090b8; }
[data-bs-theme="light"] .si-pw-toggle:hover { color: #2d2d4a; }

[data-bs-theme="light"] .si-theme-menu {
  background: #ffffff;
  border-color: rgba(109, 40, 217, 0.16);
}

[data-bs-theme="light"] .si-theme-menu .dropdown-item { color: #2d2d4a; }

[data-bs-theme="light"] .si-theme-menu .dropdown-item:hover {
  background: rgba(109, 40, 217, 0.08);
  color: #6d28d9;
}

/* ── MOBILE ── */
@media (max-width: 480px) {
  .si-card {
    padding: 1.8rem 1.4rem 1.5rem;
    border-radius: 12px;
  }

  .si-heading { font-size: 1.45rem; }
}

.vf-card {
    max-width: 400px;
    text-align: center;
}

    .vf-card .si-logo-wrap {
        justify-content: center;
    }

/* ── 2FA BADGE ── */
.vf-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--tdm-purple);
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 24px;
    padding: 0.35rem 1rem;
    margin-bottom: 0.8rem;
}

/* Destination email */
.vf-sub {
    line-height: 1.6;
}

.vf-destination {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--tdm-chrome);
    font-weight: 700;
}

/* ── OTP ROW ── */
.vf-otp-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.6rem 0 0.5rem;
}

.vf-sep {
    color: var(--tdm-text);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.1rem;
    user-select: none;
}

/* ── DIGIT INPUTS ── */
.vf-digit {
    width: 48px;
    height: 58px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tdm-white);
    background: #20203c;
    border: 1.5px solid rgba(139, 92, 246, 0.32);
    border-radius: 10px;
    outline: none;
    caret-color: var(--tdm-purple);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    color-scheme: dark;
    /* Remove spinner on number inputs */
    -moz-appearance: textfield;
}

    .vf-digit::-webkit-outer-spin-button,
    .vf-digit::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }

    .vf-digit:focus {
        border-color: var(--tdm-purple);
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 2px 8px rgba(139, 92, 246, 0.15);
        background: #28284a;
    }

    /* Filled digit */
    .vf-digit.filled {
        border-color: rgba(139, 92, 246, 0.55);
        background: #22224a;
    }

    /* Error state */
    .vf-digit.vf-invalid {
        border-color: var(--tdm-red);
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
        animation: vf-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    }

@keyframes vf-shake {
    10%, 90% {
        transform: translateX(-2px);
    }

    20%, 80% {
        transform: translateX(3px);
    }

    30%, 50%, 70% {
        transform: translateX(-3px);
    }

    40%, 60% {
        transform: translateX(3px);
    }
}

/* Success state */
.vf-digit.vf-success {
    border-color: var(--tdm-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ── ERROR MESSAGE ── */
.vf-error {
    min-height: 1.4rem;
    font-size: 0.75rem;
    color: var(--tdm-red);
    text-align: center;
    margin-bottom: 0.6rem;
    transition: opacity 0.2s ease;
}

/* ── SUBMIT BUTTON ── */
.vf-btn-submit {
    margin-top: 0.4rem;
}

/* ── FOOTER ── */
.vf-footer {
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--tdm-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.vf-resend-wrap {
    font-size: 0.82rem;
    color: var(--tdm-text);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.vf-resend-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-family: 'Barlow', sans-serif;
    color: var(--tdm-purple);
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s ease;
}

    .vf-resend-btn:hover {
        color: var(--tdm-purple-hi);
    }

    .vf-resend-btn:disabled {
        color: var(--tdm-text);
        cursor: default;
    }

.vf-countdown {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--tdm-text);
}

.vf-back-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
}

/* ── LIGHT MODE OVERRIDES ── */
[data-bs-theme="light"] .vf-badge {
    color: #6d28d9;
    background: rgba(109, 40, 217, 0.08);
    border-color: rgba(109, 40, 217, 0.22);
}

[data-bs-theme="light"] .vf-digit {
    background: #f5f5fa;
    border-color: rgba(109, 40, 217, 0.28);
    color: #2d2d4a;
    color-scheme: light;
}

    [data-bs-theme="light"] .vf-digit:focus {
        border-color: #6d28d9;
        box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.14), 0 2px 8px rgba(109, 40, 217, 0.1);
        background: #eeeef8;
    }

    [data-bs-theme="light"] .vf-digit.filled {
        background: #ebebf5;
        border-color: rgba(109, 40, 217, 0.45);
    }

[data-bs-theme="light"] .vf-resend-btn {
    color: #6d28d9;
}

    [data-bs-theme="light"] .vf-resend-btn:hover {
        color: #7c3aed;
    }

/* ── MOBILE ── */
@media (max-width: 480px) {
    .vf-digit {
        width: 42px;
        height: 52px;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    .vf-otp-row {
        gap: 0.35rem;
    }
}
