:root {
  --rf-bg: #0B0F19;
  --rf-surface: #131826;
  --rf-border: #232a3b;
  --rf-primary: #3B82F6;
  --rf-accent: #06B6D4;
  --rf-text: #F8FAFC;
  --rf-text-muted: #9CA3AF;
}

/* Light theme variables for authenticated app */
:root[data-theme="light"],
body.rf-light-theme {
  --rf-bg-light: #F8FAFC;
  --rf-surface-light: #FFFFFF;
  --rf-border-light: #E2E8F0;
  --rf-primary: #3B82F6;
  --rf-accent: #06B6D4;
  --rf-text-light: #1E293B;
  --rf-text-muted-light: #64748B;
  --rf-sidebar-bg: #1E293B;
  --rf-sidebar-text: #F8FAFC;
  --rf-sidebar-hover: #334155;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--rf-bg), 0 0 0 0.25rem var(--rf-primary);
}

html {
  position: relative;
  min-height: 100%;
}

body.rf-theme {
  margin-bottom: 60px;
  background-color: var(--rf-bg);
  color: var(--rf-text);
}

.bg-brand-surface {
  background-color: var(--rf-surface) !important;
}

.border-brand {
  border-color: var(--rf-border) !important;
}

.rf-theme .navbar-brand.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--rf-text);
}

.rf-theme .navbar-brand.brand-logo:hover {
  color: var(--rf-text);
}

.rf-theme .navbar-nav .nav-link {
  color: var(--rf-text-muted);
}

.rf-theme .navbar-nav .nav-link:hover,
.rf-theme .navbar-nav .nav-link.active {
  color: var(--rf-text);
}

.rf-theme footer {
  color: var(--rf-text-muted);
}

.rf-theme footer a {
  color: var(--rf-primary);
}

.rf-theme footer a:hover {
  color: var(--rf-primary);
}

.rf-theme a {
  color: var(--rf-primary);
}

.rf-theme .btn-brand {
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  border: none;
  color: var(--rf-text);
}

.rf-theme .btn-brand:hover {
  color: var(--rf-text);
  opacity: 0.9;
}

.rf-theme .rf-stats {
  border-top: 1px solid var(--rf-border);
  border-bottom: 1px solid var(--rf-border);
}

.rf-theme .rf-card {
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.rf-theme .rf-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  color: var(--rf-text);
  font-weight: 700;
}

.rf-theme .rf-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--rf-primary), var(--rf-accent));
}

.rf-theme .rf-stat-icon {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.rf-theme .rf-card p {
  font-size: 1.05rem;
}

.rf-theme .rf-panel {
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.5);
}

.rf-theme .rf-panel-titlebar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--rf-border);
  background-color: rgba(255, 255, 255, 0.02);
}

.rf-theme .rf-panel-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
}

.rf-theme .rf-panel-body {
  background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.08), transparent 55%);
}

.rf-theme .rf-panel-footer {
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--rf-border);
  background-color: rgba(255, 255, 255, 0.02);
}

/* Device mockup used to showcase the driver app screenshot. */
.rf-theme .rf-phone {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin-inline: auto;
  padding: 0.75rem;
  border-radius: 2.5rem;
  background: linear-gradient(160deg, #2a3145, #131826);
  border: 1px solid var(--rf-border);
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.75);
}

/* The notch/speaker bar, drawn over the top of the screenshot. */
.rf-theme .rf-phone::before {
  content: "";
  position: absolute;
  top: 1.35rem;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 0.35rem;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.18);
  z-index: 2;
}

.rf-theme .rf-phone img {
  display: block;
  width: 100%;
  border-radius: 1.85rem;
}

/* Carousel sits inside the phone bezel, so it has to be clipped to the screen radius. */
.rf-theme .rf-phone-carousel,
.rf-theme .rf-phone-carousel .carousel-inner {
  border-radius: 1.85rem;
  overflow: hidden;
}

/* Arrows are tucked inside the screen and only surface on hover/focus. */
.rf-theme .rf-phone-carousel .carousel-control-prev,
.rf-theme .rf-phone-carousel .carousel-control-next {
  width: 20%;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.rf-theme .rf-phone-carousel:hover .carousel-control-prev,
.rf-theme .rf-phone-carousel:hover .carousel-control-next,
.rf-theme .rf-phone-carousel .carousel-control-prev:focus-visible,
.rf-theme .rf-phone-carousel .carousel-control-next:focus-visible {
  opacity: 0.9;
}

/* Indicators live below the device rather than over the screenshot. */
.rf-theme .rf-phone-indicators {
  position: static;
  margin: 1.25rem 0 0;
  padding: 0;
}

.rf-theme .rf-phone-indicators button {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 0;
  margin-inline: 0.25rem;
  background-color: var(--rf-text-muted);
  opacity: 0.4;
  transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.rf-theme .rf-phone-indicators button.active {
  background-color: var(--rf-accent);
  opacity: 1;
}

/* Soft brand glow behind the device so it lifts off the dark background. */
.rf-theme .rf-phone-glow {
  position: relative;
}

.rf-theme .rf-phone-glow::before {
  content: "";
  position: absolute;
  inset: 10% 0 10% 0;
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.22), transparent 65%);
  filter: blur(40px);
  pointer-events: none;
}

/* Compact feature row beside the device mockup. */
.rf-theme .rf-mobile-feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.rf-theme .rf-mobile-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--rf-primary), var(--rf-accent));
}

.rf-theme .rf-pricing-toggle-group {
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 50px;
  gap: 0.25rem;
}

.rf-theme .rf-pricing-toggle-btn {
  border-radius: 50px;
  padding: 0.5rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--rf-text-muted);
}

.rf-theme .rf-pricing-toggle-btn.active {
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  color: var(--rf-text);
}

.rf-theme .rf-pricing-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--rf-border);
  color: var(--rf-text-muted);
}

.rf-theme .rf-pricing-badge-accent {
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  color: var(--rf-text);
}

.rf-theme .rf-pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--rf-text);
}

.rf-theme .rf-card-popular {
  border: 1px solid var(--rf-accent);
  box-shadow: 0 20px 60px -20px rgba(6, 182, 212, 0.35);
}

.rf-theme .rf-pricing-popular-badge {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  color: var(--rf-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 1rem;
  border-radius: 50px;
  white-space: nowrap;
}

.rf-theme .rf-route-node-active {
  filter: drop-shadow(0 0 6px #06B6D4) drop-shadow(0 0 12px rgba(6, 182, 212, 0.6));
  animation: rf-pulse 2s ease-in-out infinite;
}

@keyframes rf-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 4px #06B6D4) drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
  }
  50% {
    filter: drop-shadow(0 0 8px #06B6D4) drop-shadow(0 0 16px rgba(6, 182, 212, 0.8));
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ===== Light Theme for App Layout ===== */
body.rf-light-theme {
  background-color: var(--rf-bg-light);
  color: var(--rf-text-light);
}

.rf-light-theme .card {
  background-color: var(--rf-surface-light);
  border-color: var(--rf-border-light);
}

.rf-light-theme .navbar {
  background-color: var(--rf-surface-light) !important;
  border-color: var(--rf-border-light) !important;
}

.rf-light-theme .navbar-brand {
  color: var(--rf-text-light) !important;
}

.rf-light-theme .btn-primary {
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  border: none;
  color: white;
}

.rf-light-theme .btn-primary:hover {
  opacity: 0.9;
}

.rf-light-theme .btn-outline-light {
  color: var(--rf-text-light);
  border-color: var(--rf-border-light);
}

.rf-light-theme .btn-outline-light:hover {
  background-color: var(--rf-bg-light);
  color: var(--rf-text-light);
}

/* ===== Savings Calculator Modal ===== */
.rf-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rf-modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.rf-modal {
  background-color: var(--rf-bg);
  border: 1px solid var(--rf-border);
  border-radius: 1rem;
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.rf-modal::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.rf-modal-backdrop.show .rf-modal {
  transform: scale(1) translateY(0);
}

.rf-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--rf-border);
  position: relative;
}

.rf-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rf-text);
  margin: 0 0 0.5rem 0;
}

.rf-modal-subtitle {
  color: var(--rf-text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.rf-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--rf-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: background-color 0.2s, color 0.2s;
}

.rf-modal-close:hover {
  background-color: var(--rf-surface);
  color: var(--rf-text);
}

.rf-modal-body {
  padding: 1.5rem;
}

.rf-modal-form-group {
  margin-bottom: 1.25rem;
}

.rf-modal-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rf-text);
  margin-bottom: 0.5rem;
}

.rf-modal-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.rf-modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 0.5rem;
  color: var(--rf-text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rf-modal-input:focus {
  outline: none;
  border-color: var(--rf-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rf-modal-input::placeholder {
  color: var(--rf-text-muted);
  opacity: 0.5;
}

.was-validated .rf-modal-input:invalid,
.was-validated .rf-modal-select:invalid {
  border-color: #F87171;
}

.was-validated .rf-modal-input:invalid:focus,
.was-validated .rf-modal-select:invalid:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.rf-modal-input-prefix,
.rf-modal-input-suffix {
  position: absolute;
  color: var(--rf-text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.rf-modal-input-prefix {
  left: 1rem;
}

.rf-modal-input-suffix {
  right: 1rem;
}

.rf-modal-input.has-prefix {
  padding-left: 2.5rem;
}

.rf-modal-input.has-suffix {
  padding-right: 4.5rem;
}

.rf-modal-input-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--rf-text-muted);
}

.rf-modal-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 0.5rem;
  color: var(--rf-text);
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rf-modal-select:focus {
  outline: none;
  border-color: var(--rf-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rf-modal-select option {
  background-color: var(--rf-surface);
  color: var(--rf-text);
}

.rf-modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--rf-border);
  display: flex;
  flex-direction: column;
}

.rf-modal-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rf-modal-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.rf-modal-btn:active {
  transform: translateY(0);
}

.rf-modal-btn-primary {
  background: linear-gradient(90deg, #34D399, #10B981);
  color: white;
}

.rf-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .rf-modal-row {
    grid-template-columns: 1fr;
  }
}

.rf-modal-results {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background-color: #D1FAE5;
  border-radius: 0.75rem;
  display: none;
}

.rf-modal-results.show {
  display: block;
}

.rf-modal-results-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.rf-modal-results-amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1F2937;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.rf-modal-results-subtitle {
  font-size: 0.95rem;
  color: #6B7280;
  margin-bottom: 1.5rem;
}

.rf-modal-results-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .rf-modal-results-breakdown {
    grid-template-columns: 1fr;
  }
}

.rf-modal-results-item {
  text-align: left;
}

.rf-modal-results-item-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 0.25rem;
}

.rf-modal-results-item-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rf-modal-results-disclaimer {
  font-size: 0.75rem;
  color: #9CA3AF;
  line-height: 1.5;
  margin-top: 1rem;
}

.rf-modal-cta {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background-color: #D1FAE5;
  border-radius: 0.75rem;
  display: none;
}

.rf-modal-cta.show {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.rf-modal-cta-icon {
  flex-shrink: 0;
  color: #059669;
}

.rf-modal-cta-content {
  flex: 1;
}

.rf-modal-cta-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 0.5rem;
}

.rf-modal-cta-text {
  font-size: 0.85rem;
  color: #6B7280;
  line-height: 1.6;
  margin: 0;
}

.rf-modal-contact-section {
  margin-top: 2rem;
  display: none;
}

.rf-modal-contact-section.show {
  display: block;
}

.rf-modal-contact-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rf-text);
  margin-bottom: 0.5rem;
}

.rf-modal-contact-subtitle {
  font-size: 0.95rem;
  color: var(--rf-text-muted);
  margin-bottom: 1.5rem;
}

.rf-modal-contact-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .rf-modal-contact-form-row {
    grid-template-columns: 1fr;
  }
}

.rf-modal-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.rf-modal-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--rf-border);
  border-radius: 0.25rem;
  background-color: var(--rf-surface);
  cursor: pointer;
  accent-color: #10B981;
}

.rf-modal-checkbox:checked {
  background-color: #10B981;
  border-color: #10B981;
}

.rf-modal-checkbox-label {
  font-size: 0.95rem;
  color: var(--rf-text);
  cursor: pointer;
  user-select: none;
}

.rf-modal-btn-secondary {
  background: transparent;
  border: 2px solid #10B981;
  color: #10B981;
}

.rf-modal-btn-secondary:hover {
  background: rgba(16, 185, 129, 0.1);
}

.rf-modal-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* ===== Code Input Uppercase Styling ===== */
/* Apply this class to any input that should display as uppercase (registration numbers, account codes, etc.) */
.rf-code-input {
  text-transform: uppercase;
}

/* ===== Custom Notification Styles ===== */
.rf-notification-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rf-notification-overlay.show {
  opacity: 1;
  visibility: visible;
}

.rf-notification {
  background-color: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 1rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.rf-notification-overlay.show .rf-notification {
  transform: scale(1) translateY(0);
}

.rf-notification-header {
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.rf-notification-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--rf-text);
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rf-notification-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.rf-notification-icon.success {
  color: #10B981;
}

.rf-notification-icon.error {
  color: #EF4444;
}

.rf-notification-icon.warning {
  color: #F59E0B;
}

.rf-notification-icon.info {
  color: #3B82F6;
}

.rf-notification-body {
  padding: 0 1.5rem 1.5rem 1.5rem;
}

.rf-notification-message {
  color: var(--rf-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.rf-notification-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--rf-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.rf-notification-btn {
  padding: 0.625rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.rf-notification-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.rf-notification-btn:active {
  transform: translateY(0);
}

.rf-notification-btn-primary {
  background: linear-gradient(90deg, var(--rf-primary), var(--rf-accent));
  color: white;
  min-width: 100px;
}
