/*
  Theme overrides for "stickiness" + trust:
  - Deep navy for trust
  - Teal for calm engagement
  - Orange for primary conversion
*/

:root {
  --brand-primary: #3090c0;
  --brand-primary-dark: #4080a0;
  --brand-secondary: #50a0d0;
  --brand-ink: #303020;
  --brand-ink-strong: #403030;
  --brand-muted: #706050;
  --brand-bg: #f0f0f0;
  --brand-bg-soft: #e0f0f0;
  --ui-font-sans: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
  --ui-font-display: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;
  --ui-radius-sm: 8px;
  --ui-radius-md: 12px;
  --ui-radius-lg: 16px;
  --ui-radius-pill: 999px;
  --ui-shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.08);
  --ui-shadow-md: 0 16px 36px rgba(15, 23, 42, 0.12);
  --ui-z-header: 1200;
  --ui-z-overlay: 1203;
  --ui-z-drawer: 1205;
}

/* Primary accents */
.red,
.red-title,
.text-red {
  color: var(--brand-primary) !important;
}

/* Buttons */
a.btn-sell,
button.btn-sell,
.tf-button,
.btn-search,
.btn-submit,
.themesflat-button,
.btn-main .button_main_inner {
  background: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
}

a.btn-sell:hover,
button.btn-sell:hover,
.tf-button:hover,
.btn-search:hover,
.btn-submit:hover,
.themesflat-button:hover,
.btn-main .button_main_inner:hover {
  background: var(--brand-primary-dark) !important;
  border-color: var(--brand-primary-dark) !important;
}

/* Links */
a:hover {
  color: var(--brand-primary) !important;
}

/* Subtle nav emphasis */
.header .navigation > li.current > a,
.header .navigation > li:hover > a {
  color: var(--brand-primary) !important;
}

/* Focus rings */
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 0.2rem rgba(48, 144, 192, 0.25) !important;
  border-color: rgba(48, 144, 192, 0.7) !important;
}

/* Unified button styling */
.button_main_inner,
.btn-outline-lite,
.btn-ghost-lite,
.btn-solid-lite {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--ui-radius-md);
  font-weight: 600;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button_main_inner {
  background: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.button_main_inner:hover {
  background: var(--brand-primary-dark) !important;
  border-color: var(--brand-primary-dark) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.button_main_inner:focus-visible {
  outline: 2px solid rgba(48, 144, 192, 0.8);
  outline-offset: 2px;
}

.btn-outline-lite {
  background: #ffffff;
  border: 1px solid rgba(48, 144, 192, 0.35);
  color: var(--brand-ink);
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out;
}

.btn-outline-lite:focus-visible {
  outline: 2px solid rgba(48, 144, 192, 0.6);
  outline-offset: 2px;
}

.btn-ghost-lite {
  border: 1px solid rgba(48, 144, 192, 0.3);
  background: #f5fbff;
  color: var(--brand-primary);
}

.btn-ghost-lite:hover {
  background: rgba(48, 144, 192, 0.1);
}

/* Badges / highlights */
.badge-primary,
.tag,
.tf-badge {
  background: var(--brand-secondary) !important;
}

/* Footer CTA background tweak */
.bg-footer2 {
  background-color: var(--brand-ink) !important;
}

.top-bar {
  background-color: var(--brand-primary) !important;
}

/* Header clarity + mobile nav layout fixes */
#header3 {
  position: sticky !important;
  top: 0;
  z-index: var(--ui-z-header);
}

#header3.main-header,
#header3.main-header .header-style2,
#header3.main-header .header-lower {
  overflow: visible;
}

#header3.main-header .mobile-nav-toggler,
#header3.main-header .mobile-nav-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  border: 1px solid #e6eef6 !important;
  background: #ffffff !important;
  padding: 0 !important;
  display: none !important;
  align-items: center;
  justify-content: center;
  color: #0b1220 !important;
  box-shadow: none !important;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#header3.main-header .mobile-nav-toggler:hover {
  background: #f5f7fb !important;
  border-color: rgba(48, 144, 192, 0.35) !important;
}

#header3.main-header .mobile-nav-toggler svg,
#header3.main-header .mobile-nav-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
}

#header3.main-header .mobile-nav-toggler span,
#header3.main-header .mobile-nav-toggler span::before,
#header3.main-header .mobile-nav-toggler span::after {
  display: none !important;
  content: none !important;
}

#header3.main-header .header-style2 {
  margin-top: 8px;
  padding: 10px 25px;
}

@media (max-width: 991px) {
  #header3 {
    position: sticky;
    top: 0;
  }

  #header3.main-header .header-style2 {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  #header3.main-header .logo-box {
    order: 1;
  }

  #header3.main-header .mobile-button {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin-left: auto;
    order: 2;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    border: 1px solid #e6eef6 !important;
    background: var(--brand-bg) !important;
  }

  #header3.main-header .mobile-nav-toggler,
  #header3.main-header .mobile-nav-btn {
    display: inline-flex !important;
  }

  #header3.main-header .nav-outer {
    width: 100%;
    order: 3;
  }

  #header3.main-header .main-menu .navbar-collapse {
    width: 100%;
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    top: 86px;
    z-index: 1203;
    max-height: 70vh;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #f1f1f1;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.2);
  }

  #header3.main-header .main-menu[data-open="true"] .navbar-collapse {
    display: none !important;
  }

  #header3.main-header .header-account {
    width: 100%;
    order: 4;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  #header3.main-header .header-account .flat-bt-top,
  #header3.main-header .header-account .btn-icon-list {
    width: 100%;
    justify-content: center;
  }
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: var(--ui-z-overlay);
  border: 0;
}

body.nav-open {
  overflow: hidden;
}

.btn-filter {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Mobile drawer menu */
.mobile-drawer {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  margin: 0 auto;
  width: min(360px, 92vw);
  max-height: calc(100vh - 32px);
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
  z-index: var(--ui-z-drawer);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 16px;
  gap: 16px;
  overflow: hidden;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--brand-ink);
}

.mobile-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e6eef6;
  background: var(--brand-primary-dark);
}

.mobile-drawer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  display: grid;
  gap: 10px;
}

.mobile-drawer-nav {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
  padding-right: 4px;
}

.mobile-drawer-nav a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #eef2f6;
  color: var(--brand-ink);
  font-weight: 600;
}

.mobile-drawer-section {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-muted);
  margin: 6px 0;
}

.mobile-drawer-actions {
  display: grid;
  gap: 10px;
}

.mobile-auth-links {
  display: flex;
  gap: 12px;
  font-weight: 600;
}

@media (max-width: 991px) {
  .mobile-drawer {
    top: 86px;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

body.nav-open {
  overflow: hidden;
}

/* Compare tray polish */
.compare-tray {
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-md);
  padding: 14px 18px;
  gap: 16px;
}

.compare-items-scroll {
  max-width: 520px;
}

.compare-status {
  font-size: 12px;
  color: var(--brand-muted);
}

.compare-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-actions .compare-primary {
  background: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #ffffff !important;
}

.compare-actions .compare-secondary {
  background: #ffffff;
  border: 1px solid rgba(48, 144, 192, 0.35);
  color: var(--brand-ink);
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .form-col-2,
  .form-col-3,
  .form-col-4,
  .form-col-6,
  .form-col-12 {
    grid-column: span 1 !important;
  }

  .search-filter-listing-car .list-filter .form-group-wrap {
    flex-direction: column;
  }
}
