/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #f8f8fa;
    --surface: #ffffff;
    --surface2: #f0f0f3;
    --surface3: #e5e5ea;
    --text: #1a1a2e;
    --text2: #6b7280;
    --text3: #9ca3af;
    --accent: #2563eb;
    --accent2: #1a1a2e;
    --danger: #ef4444;
    --favorite: #ec4899;
    --border: rgba(0,0,0,0.06);
    --radius: 12px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --sticky-bg: #e9eaee;
    --compare-bar-bg: rgba(255, 255, 255, 0.98);
}

:root[data-theme="dark"] {
    --bg: #0f0f14;
    --surface: #1a1a22;
    --surface2: #22222c;
    --surface3: #2c2c38;
    --text: #f0f0f5;
    --text2: #a0a0ae;
    --text3: #70707e;
    --accent: #4f7cff;
    --accent2: #f0f0f5;
    --border: rgba(255,255,255,0.08);
    --sticky-bg: #16161e;
    --compare-bar-bg: rgba(26, 26, 34, 0.98);
}

:root[data-theme="dark"] img.wiki-loaded,
:root[data-theme="dark"] .car-img-placeholder {
    filter: brightness(0.9);
}

html {
    overflow-x: hidden;
    overflow-y: scroll;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    font-weight: 300;
    letter-spacing: 0.01em;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: calc(10px + var(--safe-bottom));
}

/* ========== Sticky Top ========== */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--sticky-bg);
    padding-bottom: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-bottom: 1px solid var(--border);
    transition: padding-bottom 0.25s ease;
}

.sticky-filters {
    padding: 8px 16px 0;
}

/* Collapsible rows below search hide when the page is scrolled */
.sticky-top .filter-row,
.sticky-top .slider-filters {
    max-height: 240px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}

.sticky-top.is-scrolled .filter-row,
.sticky-top.is-scrolled .slider-filters {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.sticky-top.is-scrolled {
    padding-bottom: 6px;
}

body.tab-compare .sticky-filters,
body.tab-favorites .sticky-filters {
    display: none;
}

/* ========== Status Bar & Header ========== */
.status-bar-spacer {
    height: var(--safe-top);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 2px;
}

.brand {
    font-size: 19px;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.03em;
    white-space: nowrap;
    line-height: 1.2;
}

/* ========== Tab Bar ========== */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 6px 16px 0;
    background: var(--surface);
    border-radius: 10px;
    position: relative;
    border: 1px solid var(--border);
}

.tab-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 6px;
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 13px;
    font-weight: 400;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.25s;
    position: relative;
    z-index: 1;
    font-family: inherit;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.tab.active {
    color: var(--text);
}

.tab-indicator {
    position: absolute;
    bottom: 3px;
    height: calc(100% - 6px);
    background: var(--surface2);
    border-radius: 10px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 4px;
}

/* ========== Tab Content ========== */
.tab-content {
    display: none;
    padding: 0 14px;
    animation: fadeIn 0.2s ease;
}

.tab-content.active {
    display: block;
}

/* ========== Ads ========== */
.ad-container {
    margin: 12px 14px;
    min-height: 50px;
    overflow: hidden;
    border-radius: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Search & Filter ========== */
.search-bar {
    margin-bottom: 10px;
    margin-top: 6px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    font-weight: 300;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent);
}

.search-bar input::placeholder {
    color: var(--text2);
}

.filter-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.filter-row select {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238e8e93'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 26px;
}

/* ========== Car List ========== */
.car-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-count {
    font-size: 12px;
    color: var(--text2);
    padding: 6px 2px 8px;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.car-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.25s;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.car-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.car-card-accent {
    width: 3px;
    flex-shrink: 0;
    opacity: 0.7;
}

.car-card-image {
    width: 130px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--surface2);
    position: relative;
    overflow: hidden;
}

.car-img-placeholder {
    width: 100%;
    height: 100%;
    min-height: 70px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.car-img-placeholder-text,
.car-img-placeholder span {
    font-size: 18px;
    font-weight: 300;
    color: var(--text2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
    font-feature-settings: "ss01";
}

.car-img-placeholder.small {
    height: 100%;
    width: 100%;
    border-radius: 0;
}

.car-img-placeholder.small span {
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 500px) {
    .car-card {
        flex-direction: column;
    }
    .car-card-image {
        width: 100%;
        height: 70px;
        padding: 8px;
    }
    .car-card-image img {
        max-height: 56px;
        width: auto;
    }
    .car-img-placeholder-text,
    .car-img-placeholder span {
        font-size: 20px;
    }
}

.car-card-body {
    padding: 12px 16px 10px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.car-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.car-card-info {
    min-width: 0;
}

.car-card-title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text);
}

.car-card-subtitle {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
    font-weight: 300;
}

.car-card-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Spec items row */
.car-card-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 8px 14px;
    align-items: start;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    min-width: 0;
}

.spec-item > .spec-value,
.spec-item > .spec-unit {
    display: inline;
}

.spec-item .spec-value {
    font-size: 18px;
    font-weight: 300;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    margin-right: 3px;
}

.spec-item .spec-unit {
    font-size: 11px;
    color: var(--text2);
    font-weight: 400;
}

.spec-sub {
    display: block;
    font-size: 10px;
    color: var(--text3);
    font-weight: 400;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.spec-divider {
    display: none;
}

/* Bottom row */
.car-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.car-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.car-tag {
    font-size: 10px;
    color: var(--text2);
    background: var(--surface2);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 400;
}

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

.car-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text2);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-icon:active {
    transform: scale(0.9);
}

.btn-icon.active-fav {
    background: rgba(236,72,153,0.1);
    color: var(--favorite);
}

.btn-icon.active-compare {
    background: rgba(37,99,235,0.1);
    color: var(--accent);
}

/* Compare button (chip-style, more visible than the old icon-only) */
.btn-compare {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-compare:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.btn-compare:active {
    transform: scale(0.96);
}

.btn-compare-icon {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
}

.btn-compare-icon svg {
    width: 14px;
    height: 14px;
}

.btn-compare.active-compare {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-compare.active-compare:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

@media (max-width: 480px) {
    .btn-compare-label { display: none; }
    .btn-compare { padding: 0 9px; }
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 30px 20px;
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--text2);
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.empty-hint {
    color: var(--text2);
    font-size: 14px;
}

/* ========== Compare View ========== */
.compare-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 16px 10px 14px;
    position: relative;
    border-bottom: 3px solid var(--border);
}

.compare-car-name {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.compare-car-model {
    font-size: 12px;
    color: var(--text2);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.compare-car-year {
    font-size: 11px;
    color: var(--text2);
    opacity: 0.6;
    margin-top: 1px;
}

.chip-remove {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(128,128,128,0.15);
    color: var(--text2);
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: absolute;
    top: 6px;
    right: 6px;
}

.compare-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
}

.compare-row {
    display: flex;
    background: var(--surface);
    min-width: fit-content;
    border-bottom: 1px solid var(--border);
}

.compare-row:last-child {
    border-bottom: none;
}

.compare-row.header-row {
    background: var(--surface2);
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: none;
}

.compare-row.section-row {
    background: var(--surface2);
    border-bottom: none;
}

.compare-cell {
    flex: 1;
    min-width: 120px;
    padding: 9px 10px;
    font-size: 13px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.compare-cell:last-child {
    border-right: none;
}

.compare-cell.alt-row {
    background: rgba(128, 128, 128, 0.04);
}

.compare-cell.label-cell {
    flex: 0 0 110px;
    min-width: 110px;
    text-align: left;
    font-weight: 600;
    color: var(--text2);
    font-size: 12px;
    letter-spacing: 0.3px;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
}

.compare-cell.label-cell.alt-row {
    background: var(--surface);
}

.compare-row.header-row .compare-cell.label-cell,
.compare-row.section-row .compare-cell.label-cell {
    background: var(--surface2);
}

.compare-cell.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    padding: 10px 10px 6px;
}

.compare-cell .best {
    color: var(--accent2);
    font-weight: 700;
}

.compare-sort-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-sort-label {
    font-size: 11px;
    color: var(--text2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.compare-sort-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
}

.compare-sort-btn:active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.compare-move-row {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.compare-move-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--surface);
    color: var(--text2);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.compare-move-btn:active {
    background: var(--accent);
    color: white;
}

.compare-move-btn.placeholder {
    visibility: hidden;
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-bottom-bar {
    position: sticky;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.modal-back-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    transition: opacity 0.15s;
    letter-spacing: 0.3px;
}

.modal-back-btn:hover {
    opacity: 0.85;
}

.modal-body {
    padding: 20px;
}

.modal-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 2px;
}

.modal-year {
    color: var(--text2);
    font-size: 14px;
    margin-bottom: 4px;
}

.modal-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent2);
    margin-bottom: 20px;
}

.modal-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.modal-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.modal-spec {
    background: var(--surface2);
    border-radius: 12px;
    padding: 14px;
}

.modal-spec-label {
    font-size: 11px;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.modal-spec-value {
    font-size: 18px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-bottom: calc(10px + var(--safe-bottom));
}

.modal-disclaimer {
    margin-top: 16px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 10px;
    color: var(--text2);
    line-height: 1.5;
}

.modal-ad-banner {
    margin-top: 20px;
    min-height: 100px;
    background: var(--surface2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.modal-ad-banner::before {
    content: "Annonse";
    position: absolute;
    top: 6px;
    left: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: transform 0.1s;
}

.modal-btn:active {
    transform: scale(0.97);
}

.modal-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.modal-btn.btn-compare {
    background: var(--accent);
    color: white;
}

.modal-btn.btn-compare.added {
    background: var(--surface2);
    color: var(--accent);
}

.modal-btn.btn-fav {
    background: rgba(255,55,95,0.12);
    color: var(--favorite);
}

.modal-btn.btn-fav.favorited {
    background: var(--favorite);
    color: white;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* ========== Star Rating ========== */
.star-rating {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0;
}

.star {
    cursor: pointer;
    transition: transform 0.15s, color 0.15s;
    line-height: 1;
    user-select: none;
}

.star:hover {
    transform: scale(1.2);
}

.star-filled {
    color: #f59e0b;
    text-shadow: 0 0 1px rgba(245, 158, 11, 0.4);
}

.star-empty {
    color: #d1d5db;
}

:root[data-theme="dark"] .star-empty {
    color: #4b5563;
}

.star-avg {
    font-size: 0.7em;
    color: var(--text2);
    margin-left: 4px;
    font-weight: 400;
}

.star-count {
    font-size: 0.6em;
    color: var(--text2);
    margin-left: 2px;
    font-weight: 300;
}

.star-user-badge {
    font-size: 12px;
    color: var(--accent);
    padding: 2px 0;
    font-weight: 600;
}

.modal-rating {
    margin: 4px 0 8px;
}

.modal-rating .star-rating {
    padding: 4px 0;
}

.modal-rating .star-avg {
    font-size: 16px;
}

.modal-rating .star-count {
    font-size: 13px;
}

/* ========== News Links ========== */
.modal-news-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 8px;
}

.news-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}

.news-link:hover {
    background: var(--surface3);
}

/* ========== Footer Disclaimer ========== */
.seo-content {
    margin: 32px 16px;
    padding: 20px;
    color: var(--text2);
    font-size: 14px;
    line-height: 1.7;
    font-weight: 300;
}
.seo-content h2 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 400;
}
.seo-content p {
    margin-bottom: 8px;
}

.app-disclaimer {
    margin: 32px 16px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
    font-weight: 300;
}

.app-disclaimer h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin: 16px 0 6px;
}

.app-disclaimer h3:first-child {
    margin-top: 0;
}

.app-disclaimer p {
    margin-bottom: 8px;
}

.app-disclaimer p:last-child {
    margin-bottom: 0;
}

.feedback-open-btn {
    display: block;
    margin: 12px auto 0;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.feedback-open-btn:hover {
    opacity: 0.85;
}

/* ========== Feedback Modal ========== */
.feedback-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.feedback-modal.open {
    display: flex;
}

.feedback-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
}

.feedback-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.feedback-desc {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 16px;
    line-height: 1.4;
}

.feedback-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 12px;
    appearance: auto;
}

.feedback-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.feedback-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.feedback-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.feedback-cancel {
    background: var(--surface2);
    color: var(--text2);
}

.feedback-send {
    background: var(--accent);
    color: #fff;
}

/* ========== Source Links ========== */
.source-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 10px;
    opacity: 0.7;
}

.source-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.modal-source-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.modal-source-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ========== No Results ========== */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text2);
    font-size: 15px;
}

/* ========== Car Detail Page ========== */
#car-detail-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px 40px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.detail-nav {
    padding: 16px 0;
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-image {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.detail-image .car-img-placeholder {
    height: 100px;
    border-radius: 8px;
}

.detail-image .car-img-placeholder-text {
    font-size: 26px;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.detail-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text2);
    font-size: 15px;
    font-weight: 300;
}

.detail-header {
    margin-bottom: 24px;
}

.detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.detail-title {
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.detail-subtitle {
    font-size: 15px;
    color: var(--text2);
    margin-top: 6px;
    font-weight: 300;
}

.detail-price {
    font-size: 24px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.detail-source {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}

.detail-source:hover {
    text-decoration: underline;
}

/* Hero stats */
.detail-specs-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.hero-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 12px;
    text-align: center;
}

.hero-value {
    display: block;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: -0.03em;
    color: var(--text);
}

.hero-label {
    display: block;
    font-size: 11px;
    color: var(--text2);
    margin-top: 4px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Detail sections */
.detail-section {
    margin-bottom: 28px;
}

.detail-section h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: var(--text2);
    font-weight: 300;
}

.detail-val {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Consolidated detail table */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-table td {
    padding: 11px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.detail-table tr:last-child td {
    border-bottom: none;
}

.detail-table .detail-table-label {
    color: var(--text2);
    font-weight: 300;
    width: 55%;
}

.detail-table .detail-table-val {
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.detail-table .detail-table-section th {
    text-align: left;
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--surface2, rgba(0,0,0,0.02));
    border-bottom: 1px solid var(--border);
}

.detail-table .detail-table-section:not(:first-child) th {
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.detail-table .detail-note-row td {
    padding: 10px 16px 12px;
    font-size: 12px;
    color: var(--text2);
    font-weight: 300;
    font-style: italic;
    line-height: 1.45;
    border-bottom: none;
}

/* News */
.detail-news {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Rating */
.detail-rating {
    padding: 8px 0;
}

/* Actions */
.detail-actions {
    display: flex;
    gap: 10px;
    margin: 24px 0;
}

.detail-btn {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-btn:hover {
    background: var(--surface2);
}

.detail-btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.detail-btn-primary:hover {
    opacity: 0.9;
}

/* Ad */
.detail-ad {
    margin: 20px 0;
    min-height: 50px;
    border-radius: 8px;
    overflow: hidden;
}

/* Disclaimer */
.detail-disclaimer {
    margin-top: 24px;
    padding: 16px;
    font-size: 11px;
    color: var(--text2);
    line-height: 1.5;
    font-weight: 300;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
}

@media (max-width: 600px) {
    .detail-specs-hero {
        grid-template-columns: repeat(2, 1fr);
    }
    .detail-title {
        font-size: 22px;
    }
    .detail-price {
        font-size: 20px;
    }
    .hero-value {
        font-size: 24px;
    }
    .detail-title-row {
        flex-direction: column;
        gap: 8px;
    }
    .detail-actions {
        flex-direction: column;
    }
}

/* ========== Cookie Consent ========== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.cookie-text {
    flex: 1;
    max-width: 600px;
}

.cookie-text p {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.5;
    font-weight: 300;
}

.cookie-link {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}

.cookie-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cookie-btn:hover {
    opacity: 0.85;
}

.cookie-accept {
    background: var(--accent);
    color: white;
}

.cookie-decline {
    background: var(--surface2);
    color: var(--text2);
}

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    .cookie-buttons {
        width: 100%;
    }
    .cookie-btn {
        flex: 1;
    }
}

/* ===== Floating Compare Bar ===== */
.compare-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--compare-bar-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    z-index: 900;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    animation: compareBarSlide 0.25s ease-out;
}

@keyframes compareBarSlide {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.compare-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.compare-bar-items {
    flex: 1;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    min-height: 76px;
    align-items: center;
    padding: 4px 0;
}

.compare-bar-items::-webkit-scrollbar {
    display: none;
}

.compare-bar-item {
    position: relative;
    flex-shrink: 0;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.compare-bar-thumb {
    position: relative;
    width: 96px;
    height: 52px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}


.compare-bar-name {
    width: 100%;
    text-align: center;
    line-height: 1.1;
    overflow: hidden;
}

.compare-bar-make {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-bar-model {
    display: block;
    font-size: 10px;
    color: var(--text2);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-bar-item-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.compare-bar-empty {
    color: var(--text2);
    font-size: 14px;
    font-weight: 400;
    padding: 0 8px;
}

.compare-bar-btn {
    background: var(--accent2);
    color: var(--bg);
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: opacity 0.15s;
}

.compare-bar-btn:hover {
    opacity: 0.85;
}

.compare-bar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.compare-bar-btn span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 4px;
    font-size: 12px;
    font-weight: 600;
}

.compare-bar-clear {
    background: transparent;
    color: var(--text2);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.compare-bar-clear:hover {
    color: var(--text);
    border-color: var(--text2);
}

/* Hide on compare tab (already showing compare view) */
body.tab-compare .compare-bar {
    display: none !important;
}

/* Make sure content isn't hidden behind bar */
body:not(.tab-compare) #app {
    padding-bottom: 90px;
}

@media (max-width: 600px) {
    .compare-bar-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    .compare-bar-item {
        width: 80px;
    }
    .compare-bar-thumb {
        width: 80px;
        height: 46px;
    }
    .compare-bar-items {
        min-height: 68px;
    }
    .compare-bar-make,
    .compare-bar-model {
        font-size: 9px;
    }
}

/* ===== Dark Mode Toggle ===== */
.theme-toggle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text3);
}

.theme-toggle svg {
    width: 15px;
    height: 15px;
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* ===== Recently Viewed (slim strip) ===== */
.recently-viewed-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 0;
    margin-top: 4px;
}

.recently-viewed-label {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.recently-viewed-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
}

.recently-viewed-list::-webkit-scrollbar {
    display: none;
}

.recently-viewed-item {
    flex-shrink: 0;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.recently-viewed-item:hover {
    background: var(--surface2);
    border-color: var(--text3);
}

.recently-viewed-item::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-color, var(--text3));
    flex-shrink: 0;
}

body.tab-compare .recently-viewed-strip,
body.tab-favorites .recently-viewed-strip {
    display: none;
}

/* ===== Badges & Notes ===== */
.badge-yes {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 12px;
    font-weight: 500;
}

.badge-no {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.15);
    color: var(--text2);
    font-size: 12px;
    font-weight: 500;
}

.detail-note {
    font-size: 12px;
    color: var(--text3);
    margin-top: 12px;
    line-height: 1.5;
    font-style: italic;
}

/* ===== Quiz Page ===== */
#quiz-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 80px;
    min-height: 100vh;
}

.detail-nav {
    padding: 16px 0 0;
}

.back-link {
    color: var(--text2);
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    color: var(--text1);
}

.quiz-container {
    padding-top: 16px;
}

.quiz-header {
    text-align: center;
    margin: 24px 0 20px;
}

.quiz-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text1);
}

.quiz-intro {
    color: var(--text2);
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

.quiz-progress {
    width: 100%;
    height: 4px;
    background: var(--bg3);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 28px;
}

.quiz-progress-bar {
    height: 100%;
    background: var(--accent, #2563eb);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 999px;
}

.quiz-step {
    background: var(--bg2);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
}

.quiz-step-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.quiz-question {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text1);
    line-height: 1.3;
}

.quiz-help {
    color: var(--text2);
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    background: var(--bg1);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text1);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.quiz-option:hover {
    border-color: var(--accent, #2563eb);
    background: var(--bg3);
    transform: translateY(-1px);
}

.quiz-option:active {
    transform: translateY(0);
}

.quiz-back {
    margin-top: 20px;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.quiz-back:hover {
    color: var(--text1);
}

.quiz-results {
    background: var(--bg2);
    border-radius: 16px;
    padding: 24px 20px;
    border: 1px solid var(--border);
}

.quiz-results h2 {
    font-size: 22px;
    margin: 0 0 6px;
    color: var(--text1);
}

.quiz-results-intro {
    color: var(--text2);
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.5;
}

.quiz-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-result-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.quiz-result-card:hover {
    border-color: var(--accent, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.quiz-result-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.quiz-result-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quiz-result-thumb span {
    font-weight: 700;
    font-size: 18px;
    color: var(--text1);
    letter-spacing: 1px;
}

.quiz-result-info {
    flex: 1;
    min-width: 0;
}

.quiz-result-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text1);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-result-sub {
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 4px;
}

.quiz-result-specs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text2);
}

.quiz-result-specs span {
    white-space: nowrap;
}

.quiz-result-arrow {
    color: var(--text3);
    font-size: 20px;
    flex-shrink: 0;
}

.quiz-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.quiz-restart-btn,
.quiz-browse-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.15s ease;
    border: 1.5px solid var(--border);
    background: var(--bg1);
    color: var(--text1);
}

.quiz-browse-btn {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}

.quiz-restart-btn:hover {
    border-color: var(--accent, #2563eb);
}

.quiz-browse-btn:hover {
    opacity: 0.9;
}

.quiz-note {
    font-size: 12px;
    color: var(--text3);
    line-height: 1.5;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-style: italic;
}

/* ===== Slider filters ===== */
.slider-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 22px;
    padding: 12px 14px 10px;
}

.slider-filter {
    min-width: 0;
    padding: 10px 14px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    --slider-color: #9ca3af;
    --slider-color-strong: #6b7280;
    --slider-color-soft: rgba(156, 163, 175, 0.18);
    --slider-color-glow: rgba(156, 163, 175, 0.0);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.slider-filter.is-active {
    --slider-color: #dc2626;
    --slider-color-strong: #b91c1c;
    --slider-color-soft: rgba(220, 38, 38, 0.18);
    --slider-color-glow: rgba(220, 38, 38, 0.30);
    border-color: rgba(220, 38, 38, 0.45);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

:root[data-theme="dark"] .slider-filter {
    --slider-color: #6b7280;
    --slider-color-strong: #9ca3af;
    --slider-color-soft: rgba(156, 163, 175, 0.18);
}

:root[data-theme="dark"] .slider-filter.is-active {
    --slider-color: #ef4444;
    --slider-color-strong: #f87171;
    --slider-color-soft: rgba(239, 68, 68, 0.20);
    --slider-color-glow: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.slider-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    min-height: 18px;
}

.slider-label {
    color: var(--text3);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.slider-value {
    color: var(--text2);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.slider-filter.is-active .slider-value {
    color: var(--slider-color);
    font-weight: 600;
}

.slider-filter.is-active .slider-label {
    color: var(--slider-color-strong);
}

.dual-slider,
.single-slider {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    touch-action: none;
}

.slider-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg3);
    border-radius: 999px;
    overflow: hidden;
}

.dual-slider .slider-fill,
.single-slider .slider-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--slider-color), var(--slider-color-strong));
    border-radius: 999px;
    box-shadow: 0 0 0 0 var(--slider-color-glow);
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.single-slider .slider-fill {
    left: 0;
    width: 0%;
}

.slider-filter.is-active .dual-slider .slider-fill,
.slider-filter.is-active .single-slider .slider-fill {
    box-shadow: 0 0 10px var(--slider-color-glow);
}

.dual-slider.is-dragging .slider-fill,
.single-slider.is-dragging .slider-fill {
    box-shadow: 0 0 14px var(--slider-color-glow);
}

/* Range input — transparent shell, only thumb is visible */
.dual-slider input[type="range"],
.single-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    left: -4px;
    right: -4px;
    width: calc(100% + 8px);
    height: 28px;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
    z-index: 2;
}

/* Thumb: slightly larger, soft shadow, smooth transitions */
.dual-slider input[type="range"]::-webkit-slider-thumb,
.single-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: grab;
    box-shadow:
        0 0 0 1.5px var(--slider-color) inset,
        0 1px 2px rgba(15, 23, 42, 0.08),
        0 4px 12px rgba(15, 23, 42, 0.12),
        0 0 0 0 var(--slider-color-soft);
    transition: box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dual-slider input[type="range"]::-webkit-slider-thumb:hover,
.single-slider input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow:
        0 0 0 1.5px var(--slider-color) inset,
        0 1px 2px rgba(15, 23, 42, 0.08),
        0 6px 16px rgba(15, 23, 42, 0.15),
        0 0 0 8px var(--slider-color-soft);
}

.dual-slider input[type="range"]::-webkit-slider-thumb:active,
.single-slider input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow:
        0 0 0 1.5px var(--slider-color) inset,
        0 2px 4px rgba(15, 23, 42, 0.10),
        0 8px 20px rgba(15, 23, 42, 0.20),
        0 0 0 12px var(--slider-color-soft);
}

.dual-slider input[type="range"]::-moz-range-thumb,
.single-slider input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--slider-color);
    cursor: grab;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.12);
    transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.dual-slider input[type="range"]::-moz-range-thumb:hover,
.single-slider input[type="range"]::-moz-range-thumb:hover {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 16px rgba(15, 23, 42, 0.15), 0 0 0 8px var(--slider-color-soft);
}

.dual-slider input[type="range"]::-moz-range-thumb:active,
.single-slider input[type="range"]::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
}

.dual-slider input[type="range"]::-webkit-slider-runnable-track,
.single-slider input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
    height: 28px;
    border: none;
}

.dual-slider input[type="range"]::-moz-range-track,
.single-slider input[type="range"]::-moz-range-track {
    background: transparent;
    height: 28px;
    border: none;
}

.dual-slider input[type="range"]:focus,
.single-slider input[type="range"]:focus {
    outline: none;
}

/* Dark mode: thumb gets accent-filled interior so it reads on dark bg */
:root[data-theme="dark"] .dual-slider input[type="range"]::-webkit-slider-thumb,
:root[data-theme="dark"] .single-slider input[type="range"]::-webkit-slider-thumb {
    background: #1a1a24;
    box-shadow:
        0 0 0 1.5px var(--slider-color) inset,
        0 0 0 4px var(--slider-color-soft) inset,
        0 2px 6px rgba(0, 0, 0, 0.5),
        0 0 0 0 var(--slider-color-glow);
}

:root[data-theme="dark"] .dual-slider input[type="range"]::-moz-range-thumb,
:root[data-theme="dark"] .single-slider input[type="range"]::-moz-range-thumb {
    background: var(--slider-color);
    border-color: #1a1a24;
}

/* Value bubble above thumb */
.slider-bubble {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%) translateY(4px);
    padding: 4px 9px;
    background: var(--text1);
    color: var(--bg1);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 4;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
    letter-spacing: 0.01em;
}

.slider-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text1);
}

.dual-slider.is-dragging .slider-bubble.is-active,
.single-slider.is-dragging .slider-bubble.is-active,
.dual-slider:hover .slider-bubble,
.single-slider:hover .slider-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Stack the two range inputs so both thumbs are reachable */
.dual-slider input#price-min { z-index: 2; }
.dual-slider input#price-max { z-index: 1; }

@media (max-width: 520px) {
    .slider-filters {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 10px 12px 8px;
    }
}

/* ===== Car description block ===== */
.detail-description {
    padding: 0;
    border: none;
    background: transparent;
    margin-bottom: 24px;
}

.detail-description p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text2);
    margin: 0;
    padding: 4px 0 4px 14px;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
}

/* ===== Inline ads between cars ===== */
.ad-inline {
    margin: 12px 0;
    padding: 8px 12px;
    min-height: 90px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.ad-inline::before {
    content: "Annonse";
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
    margin-bottom: 6px;
    font-weight: 600;
}

.ad-inline ins {
    min-height: 90px;
}

/* ===== Comments ===== */
.comments-count {
    color: var(--text3);
    font-weight: 400;
    font-size: 14px;
    margin-left: 6px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.comments-loading,
.comments-empty,
.comments-error {
    color: var(--text3);
    font-size: 14px;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

.comments-error { color: #ef4444; }

.comment {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}

.comment-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text1);
}

.comment-name em {
    font-style: normal;
    color: var(--text3);
    font-weight: 500;
}

.comment-date {
    font-size: 12px;
    color: var(--text3);
    white-space: nowrap;
}

.comment-edited {
    font-style: italic;
    opacity: 0.7;
}

.comment-body {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text1);
    word-wrap: break-word;
}

.comment-admin {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.comment-edit,
.comment-delete {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg1);
    color: var(--text2);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.comment-edit:hover {
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
}

.comment-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* Comment form */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.comment-name,
.comment-text {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg1);
    color: var(--text1);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.comment-name:focus,
.comment-text:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
}

.comment-text {
    min-height: 70px;
}

.comment-form-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.comment-count-hint {
    font-size: 12px;
    color: var(--text3);
    font-variant-numeric: tabular-nums;
}

.comment-submit {
    padding: 8px 18px;
    background: var(--accent, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s ease;
}

.comment-submit:hover:not(:disabled) { opacity: 0.9; }
.comment-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Admin bar + modal */
.admin-bar {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 12px;
}

.admin-badge {
    background: var(--accent, #2563eb);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-email {
    color: var(--text2);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.admin-logout:hover { color: #ef4444; border-color: #ef4444; }

.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-modal-content {
    background: var(--bg1);
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.admin-modal-content h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--text1);
}

.admin-modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2);
    color: var(--text1);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.admin-modal-content input:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
}

.admin-modal-err {
    color: #ef4444;
    font-size: 13px;
    min-height: 18px;
    margin-bottom: 10px;
}

.admin-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.admin-modal-cancel,
.admin-modal-submit {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text1);
    transition: all 0.15s ease;
}

.admin-modal-submit {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}

.admin-modal-submit:hover { opacity: 0.9; }
.admin-modal-cancel:hover { border-color: var(--text3); }
