/* AutoEdge Deals - UI Enhancements */

/* Dark mode */
body.dark-mode {
    --white: #1e293b;
    --light-color: #0f172a;
    --text-color: #e5e7eb;
    --dark-color: #f9fafb;
    --border-color: #374151;
    --muted-text: #94a3b8;
    background-color: #0f172a;
    color: var(--text-color);
}

body.dark-mode .header,
body.dark-mode .vehicle-card,
body.dark-mode .image-gallery,
body.dark-mode .vehicle-info-card,
body.dark-mode .vehicle-specs,
body.dark-mode .reviews-section,
body.dark-mode .filters-sidebar,
body.dark-mode .order-card,
body.dark-mode .quick-cart {
    background: #1e293b;
    color: var(--text-color);
}

body.dark-mode .header-top {
    background: #0f172a;
    color: var(--text-color);
}

body.dark-mode .header-links a {
    color: var(--text-color);
}

body.dark-mode .header-links a:hover {
    color: var(--secondary-color);
}

body.dark-mode .nav a,
body.dark-mode .vehicle-info h3 a {
    color: var(--text-color);
}

/* Keep light text on colored controls (var(--white) is repurposed as surface bg in dark mode) */
body.dark-mode .btn-primary,
body.dark-mode .btn-secondary,
body.dark-mode .btn-large,
body.dark-mode .badge,
body.dark-mode .popular-badge,
body.dark-mode .header-search button,
body.dark-mode .header-badge,
body.dark-mode .category-card:hover,
body.dark-mode .category-card:hover i,
body.dark-mode .quick-chat-header,
body.dark-mode .quick-chat-message-user .quick-chat-message-content,
body.dark-mode .quick-chat-action-btn:hover,
body.dark-mode .toast:not(.toast-warning),
body.dark-mode .compare-bar,
body.dark-mode .pagination span.current,
body.dark-mode .pagination a:hover,
body.dark-mode .view-toggle button.active,
body.dark-mode .cta {
    color: #ffffff;
}

body.dark-mode .footer {
    background: #0f172a;
    color: var(--text-color);
}

body.dark-mode .footer-section h3 {
    color: var(--dark-color);
}

body.dark-mode .footer-section ul li a {
    color: rgba(229, 231, 235, 0.85);
}

body.dark-mode .footer-bottom,
body.dark-mode .footer-bottom a {
    color: var(--muted-text);
}

body.dark-mode .footer-bottom a:hover {
    color: var(--secondary-color);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #0f172a;
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .site-breadcrumb-sep,
body.dark-mode .site-breadcrumb-current,
body.dark-mode .trust-strip-item span,
body.dark-mode .empty-state p {
    color: var(--muted-text);
}

body.dark-mode .filter-chip {
    background: rgba(30, 58, 138, 0.35);
    border-color: #3b82f6;
    color: #93c5fd;
}

body.dark-mode .filter-chip:hover {
    background: rgba(30, 58, 138, 0.5);
}

body.dark-mode .filter-chip-clear {
    background: rgba(127, 29, 29, 0.35);
    color: #fca5a5;
    border-color: #ef4444;
}

body.dark-mode .skeleton-image,
body.dark-mode .skeleton-line {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

body.dark-mode .vehicle-slider-section {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

body.dark-mode .category-card:not(:hover) {
    color: var(--text-color);
}

body.dark-mode .make-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .make-card h3 {
    color: var(--text-color);
}

body.dark-mode .make-card p,
body.dark-mode .section-subtitle {
    color: #94a3b8;
}

body.dark-mode .make-card-icon {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .makes-section {
    background: var(--dark-color);
}

body.dark-mode .membership-card:not(.premium) h3,
body.dark-mode .membership-card:not(.premium) ul li {
    color: var(--text-color);
}

body.dark-mode .quick-chat-body,
body.dark-mode .quick-chat-input-area {
    background: #1e293b;
}

body.dark-mode .quick-chat-action-btn {
    background: #0f172a;
    color: var(--text-color);
}

body.dark-mode .quick-chat-message-support .quick-chat-message-content {
    background: #0f172a;
    color: var(--text-color);
}

/* Search page */
body.dark-mode .results-header,
body.dark-mode .no-results {
    background: #1e293b;
    color: var(--text-color);
}

body.dark-mode .results-count,
body.dark-mode .filter-group h3,
body.dark-mode .filter-group label {
    color: var(--text-color);
}

body.dark-mode .filter-group {
    border-bottom-color: var(--border-color);
}

body.dark-mode .view-toggle button {
    background: #0f172a;
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .pagination a,
body.dark-mode .pagination span:not(.current) {
    background: #1e293b;
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Vehicle detail page (inline styles use fixed dark grays) */
body.dark-mode .vehicle-title,
body.dark-mode .info-value,
body.dark-mode .spec-details p,
body.dark-mode .seller-info h4 {
    color: var(--text-color);
}

body.dark-mode .info-label,
body.dark-mode .spec-details h5 {
    color: var(--muted-text);
}

body.dark-mode .info-row,
body.dark-mode .review-card {
    border-bottom-color: var(--border-color);
}

body.dark-mode .seller-info,
body.dark-mode .spec-item,
body.dark-mode .main-image {
    background: #0f172a;
}

/* Homepage shipping table (inline styles) */
body.dark-mode .shipping-schedule {
    background: #0f172a !important;
}

body.dark-mode .shipping-schedule .container > div[style] {
    background: #1e293b !important;
}

body.dark-mode .shipping-schedule tbody td,
body.dark-mode .shipping-schedule tbody strong {
    color: var(--text-color) !important;
}

body.dark-mode .shipping-schedule tbody tr {
    background: #1e293b !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .shipping-schedule tbody tr[style*="background: #f9fafb"] {
    background: #0f172a !important;
}

body.dark-mode .shipping-estimate-result {
    color: var(--text-color);
}

/* Hero & homepage */
body.dark-mode .hero {
    color: #ffffff;
}

body.dark-mode .hero .tag {
    color: #ffffff;
}

body.dark-mode .hero .tag:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

body.dark-mode .hero-search input {
    background: #0f172a;
    color: var(--text-color);
}

body.dark-mode .menu-toggle {
    color: var(--text-color);
}

/* Common inline light-theme colors on content pages */
body.dark-mode [style*="color: #374151"],
body.dark-mode [style*="color: #1f2937"],
body.dark-mode [style*="color: #1e293b"] {
    color: var(--text-color) !important;
}

body.dark-mode [style*="color: #6b7280"],
body.dark-mode [style*="color: #64748b"] {
    color: var(--muted-text) !important;
}

body.dark-mode [style*="background: white"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background: #ffffff"],
body.dark-mode [style*="background: #f9fafb"],
body.dark-mode [style*="background: #f8fafc"],
body.dark-mode [style*="background: #f3f4f6"] {
    background-color: #1e293b !important;
}

/* Shared patterns on account, order, and content pages */
body.dark-mode .page-header h1,
body.dark-mode .order-title,
body.dark-mode .parts-header p,
body.dark-mode .parts-section .category-card h3,
body.dark-mode .shipping-card p {
    color: var(--text-color) !important;
}

body.dark-mode .order-number,
body.dark-mode .detail-item,
body.dark-mode .category-card p,
body.dark-mode .parts-section .category-card p {
    color: var(--muted-text) !important;
}

body.dark-mode .search-filters,
body.dark-mode .shipping-card,
body.dark-mode .shipping-doc,
body.dark-mode .auth-card {
    background: #1e293b !important;
}

body.dark-mode .parts-section .category-card {
    background: #1e293b !important;
}

body.dark-mode .parts-section .category-card:hover {
    background: #334155 !important;
}

body.dark-mode .breadcrumb {
    border-bottom-color: var(--border-color);
}

body.dark-mode .breadcrumb span {
    color: var(--muted-text);
}

/* Header search */
.header-search {
    flex: 0 1 220px;
    max-width: 220px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0;
}

.header-search input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 0.9rem;
    background: var(--white);
    color: var(--text-color);
}

.header-search button {
    padding: 9px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 1100px) {
    .header-search {
        flex: 1 1 100%;
        max-width: 100%;
        order: 10;
    }

    .nav {
        flex: 1 1 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 14px 18px;
        white-space: normal;
    }
}

@media (min-width: 1101px) and (max-width: 1280px) {
    .nav {
        gap: 14px;
        font-size: 0.92rem;
    }

    .header-search {
        flex: 0 1 180px;
        max-width: 180px;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--dark-color);
    transition: background 0.2s;
}

.header-icon-btn:hover {
    background: var(--light-color);
}

.header-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle {
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--dark-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
}

/* Breadcrumbs */
.site-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.site-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.site-breadcrumb a:hover {
    text-decoration: underline;
}

.site-breadcrumb-sep {
    color: #94a3b8;
}

.site-breadcrumb-current {
    color: #64748b;
}

/* Trust strip */
.trust-strip {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 0;
}

body.dark-mode .trust-strip {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.trust-strip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.trust-strip-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trust-strip-item i {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.trust-strip-item strong {
    display: block;
    font-size: 0.95rem;
    color: var(--dark-color);
}

.trust-strip-item span,
.trust-strip-item a {
    font-size: 0.82rem;
    color: #64748b;
}

.trust-strip-item a {
    color: var(--primary-color);
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 40px));
}

.toast {
    padding: 14px 18px;
    border-radius: 10px;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.toast-success { background: var(--success-color); }
.toast-error { background: var(--danger-color); }
.toast-info { background: #3b82f6; }
.toast-warning { background: var(--secondary-color); color: #1f2937; }

.toast a { color: inherit; text-decoration: underline; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Compare bar */
.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: #fff;
    padding: 14px 20px;
    z-index: 9998;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.compare-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.compare-bar-actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
}

/* Filter chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #eff6ff;
    color: var(--primary-color);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #bfdbfe;
}

.filter-chip:hover {
    background: #dbeafe;
}

.filter-chip-clear {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* Skeleton loaders */
.skeleton-grid[hidden] {
    display: none !important;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.skeleton-card {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.skeleton-image,
.skeleton-line {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.2s infinite;
}

.skeleton-image {
    height: 200px;
}

.skeleton-body {
    padding: 20px;
}

.skeleton-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-line.short { width: 60%; }

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.empty-state h2 {
    color: var(--dark-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: #64748b;
    margin-bottom: 24px;
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Gallery lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox img {
    max-width: min(92vw, 1200px);
    max-height: 85vh;
    object-fit: contain;
}

.gallery-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}

.gallery-lightbox-prev { left: 20px; }
.gallery-lightbox-next { right: 20px; }

.gallery-lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 999px;
}

.main-image-clickable {
    cursor: zoom-in;
}

/* Sticky mobile actions */
.mobile-sticky-actions,
.whatsapp-fab {
    display: none;
}

@media (max-width: 768px) {
    .header-search {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin: 8px 0 0;
    }

    .header-main .container {
        flex-wrap: wrap;
    }

    .nav {
        flex: 1 1 100%;
    }

    .trust-strip-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mobile-sticky-actions {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9990;
        background: var(--white);
        border-top: 1px solid var(--border-color);
        padding: 10px 12px;
        gap: 8px;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    }

    body.dark-mode .mobile-sticky-actions {
        background: #1e293b;
    }

    .mobile-sticky-actions a,
    .mobile-sticky-actions button {
        flex: 1;
        text-align: center;
        padding: 12px 8px !important;
        font-size: 0.85rem !important;
    }

    .whatsapp-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 80px;
        right: 16px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #25d366;
        color: #fff;
        font-size: 1.6rem;
        z-index: 9989;
        box-shadow: 0 4px 14px rgba(37, 211, 102, 0.45);
    }

    body.has-mobile-actions {
        padding-bottom: 80px;
    }

    body.has-compare-bar {
        padding-bottom: 130px;
    }

    .compare-bar {
        bottom: 70px;
    }
}

/* Shipping estimate */
.shipping-estimate {
    margin-top: 20px;
    padding: 16px;
    background: #eff6ff;
    border-radius: 10px;
    border: 1px solid #bfdbfe;
}

body.dark-mode .shipping-estimate {
    background: #1e3a8a33;
}

.shipping-estimate h4 {
    margin: 0 0 12px;
    color: var(--primary-color);
}

.shipping-estimate-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.shipping-estimate select {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-color);
}

.shipping-estimate-result {
    font-weight: 600;
    color: var(--dark-color);
}

/* Recently viewed */
.recently-viewed {
    padding: 50px 0;
    background: var(--light-color);
}

.recently-viewed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.recent-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.recent-card:hover {
    transform: translateY(-4px);
}

.recent-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.recent-card-body {
    padding: 14px;
}

.recent-card-body h4 {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--dark-color);
}

.recent-card-body span {
    color: var(--primary-color);
    font-weight: 700;
}

.similar-vehicles {
    margin-bottom: 40px;
}

.similar-vehicles .section-title {
    margin-bottom: 24px;
}
