/* ================================================================
   SmartMiles — custom styles shared across all pages (auth + dash).
   Loaded after preline.css so overrides work naturally.
   ================================================================ */

/* -- Design tokens (auth dark theme) ------------------------------ */
:root {
  --sm-primary: #7bd942;
  --sm-primary-dim: #7bd94233;
  --sm-forest: #163300;
  --sm-forest-mid: #2d5a11;
  --sm-dark: #0e1f00;
  --sm-dark-card: #163300;
  --sm-dark-border: #224400;
  --sm-text: #d4d4d4;
  --sm-text-dim: #737373;
  --sm-surface: #F5F5F0;
  --sm-surface-border: #e5e5dc;
}

/* -- Phone mockup ------------------------------------------------- */
.sm-phone-frame {
  background: var(--sm-forest);
  border-radius: 32px;
  padding: 8px;
  box-shadow: 0 25px 50px -12px rgba(22, 51, 0, 0.25);
}
.sm-phone-screen {
  border-radius: 24px;
  overflow: hidden;
}

/* -- Auth layout -------------------------------------------------- */
.sm-brand-bg {
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(22, 51, 0, 0.04), transparent),
    radial-gradient(ellipse 60% 80% at 30% 70%, rgba(22, 51, 0, 0.02), transparent),
    var(--sm-surface);
}

.sm-grid-overlay {
  background-image:
    linear-gradient(rgba(22, 51, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 51, 0, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* -- Animations --------------------------------------------------- */
.sm-route-line {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: draw-route 3s ease-out forwards;
}
@keyframes draw-route {
  to { stroke-dashoffset: 0; }
}

.sm-dot-pulse {
  animation: dot-pulse 2.5s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.sm-fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fade-up 0.5s ease-out forwards;
}
.sm-fade-in-1 { animation-delay: 0.1s; }
.sm-fade-in-2 { animation-delay: 0.2s; }
.sm-fade-in-3 { animation-delay: 0.35s; }
.sm-fade-in-4 { animation-delay: 0.5s; }
.sm-fade-in-5 { animation-delay: 0.65s; }
@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}

/* -- Inputs ------------------------------------------------------- */
.sm-input {
  background: var(--sm-dark-card);
  border: 1px solid var(--sm-dark-border);
  color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sm-input:focus {
  border-color: var(--sm-primary);
  box-shadow: 0 0 0 3px rgba(123, 217, 66, 0.15);
  outline: none;
}
.sm-input::placeholder {
  color: var(--sm-text-dim);
}

/* -- Buttons ------------------------------------------------------ */
.sm-btn-social {
  background: #fff;
  color: #1a1a1a;
  transition: background 0.15s, transform 0.1s;
}
.sm-btn-social:hover { background: #f0f0f0; }
.sm-btn-social:active { transform: scale(0.985); }

.sm-btn-primary {
  background: var(--sm-primary);
  color: var(--sm-dark);
  transition: background 0.15s, transform 0.1s;
}
.sm-btn-primary:hover { background: #6cc938; }
.sm-btn-primary:active { transform: scale(0.985); }
.sm-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.sm-btn-primary:disabled:hover { background: var(--sm-primary); }

.sm-btn-secondary {
  background: transparent;
  color: var(--sm-text);
  border: 1px solid var(--sm-dark-border);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.sm-btn-secondary:hover { background: var(--sm-dark-card); border-color: #2d5a11; }
.sm-btn-secondary:active { transform: scale(0.985); }

/* -- Button loading spinner ---------------------------------------- */
.sm-btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sm-spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes sm-spin {
  to { transform: rotate(360deg); }
}

/* -- Divider ------------------------------------------------------ */
.sm-divider-line {
  height: 1px;
  background: var(--sm-dark-border);
  flex: 1;
}

/* -- Error list --------------------------------------------------- */
.sm-errorlist {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}
.sm-errorlist li {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  border: 1px solid rgba(127, 29, 29, 0.4);
}

/* -- OTP code boxes ----------------------------------------------- */
.sm-otp-real-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.sm-otp-box {
  flex: 1;
  height: 56px;
  border-radius: 12px;
  border: 1px solid var(--sm-dark-border);
  background: var(--sm-dark-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 32px;
  font-weight: 900;
  color: var(--sm-primary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.sm-otp-box.sm-otp-focused {
  border-color: var(--sm-primary);
}
.sm-otp-box.sm-otp-focused::after {
  content: '';
  width: 2px;
  height: 24px;
  background: var(--sm-primary);
  border-radius: 1px;
  animation: otp-blink 1s step-end infinite;
}
.sm-otp-box.sm-otp-filled {
  background: var(--sm-forest);
  border-color: var(--sm-forest);
  color: #fff;
}
.sm-otp-box.sm-otp-filled.sm-otp-focused::after {
  display: none;
}
@keyframes otp-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
