@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Theme variables - Light Mode by default */
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa;
    --text-color: #111827;
    --text-muted: #6b7280;
    --accent-color: #c5a880; /* Premium gold */
    --accent-hover: #b3956c;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0d0d11;
        --bg-alt: #131317;
        --text-color: #f3f4f6;
        --text-muted: #9ca3af;
        --border-color: #24242a;
        --card-bg: #16161c;
        --nav-bg: rgba(13, 13, 17, 0.8);
        --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    }
}

/* Explicit class-based overrides from theme toggle */
html[data-theme="light"] {
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa;
    --text-color: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] {
    --bg-color: #0d0d11;
    --bg-alt: #131317;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #24242a;
    --card-bg: #16161c;
    --nav-bg: rgba(13, 13, 17, 0.8);
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Header & Navbar */
.navbar-premium {
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.navbar-brand-premium {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
    color: var(--text-color) !important;
}

.navbar-brand-premium span {
    color: var(--accent-color);
}

.nav-link-premium {
    color: var(--text-color) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px !important;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link-premium:hover, 
.nav-link-premium.active {
    color: var(--accent-color) !important;
    background-color: rgba(197, 168, 128, 0.05);
}

/* Hero Carousel */
.hero-slider {
    height: 650px;
    position: relative;
    overflow: hidden;
}

.hero-slide-item {
    height: 650px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.hero-slide-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
}

.hero-content-wrapper {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    align-items: center;
    color: #fff;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hero-title span {
    color: var(--accent-color);
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 400;
    color: #e5e7eb;
    margin-bottom: 30px;
    max-width: 600px;
}

/* Parallax Effect Section */
.parallax-section {
    position: relative;
    height: 350px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 1;
}

/* Fallback for browsers that do not support attachment: fixed or for CSS scroll timelines */
@supports (animation-timeline: view()) {
    .parallax-section {
        view-timeline: --parallax;
    }
    .parallax-bg {
        animation: parallaxAnim linear both;
        animation-timeline: --parallax;
        animation-range: entry 0% exit 100%;
    }
    @keyframes parallaxAnim {
        from { transform: translateY(-50px); }
        to { transform: translateY(50px); }
    }
}

.parallax-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2;
}

.parallax-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

/* Card Premium */
.moto-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.moto-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

.moto-card-img-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.moto-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.moto-card:hover .moto-card-img {
    transform: scale(1.06);
}

.moto-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
}

.badge-featured {
    background-color: var(--accent-color);
    color: #000;
}

.badge-sold-out {
    background-color: #ef4444;
    color: #fff;
}

.btn-favorite-float {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.btn-favorite-float:hover, 
.btn-favorite-float.active {
    background-color: #fff;
    color: #ef4444;
}

.moto-card-body {
    padding: 20px;
}

.moto-card-brand {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 4px;
}

.moto-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-truncate: ellipsis;
}

.moto-card-specs {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.moto-card-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-color);
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #25d366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    color: white;
}

/* Compare floating bar */
.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border-top: 2px solid var(--accent-color);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.2);
    z-index: 998;
    padding: 15px 30px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.compare-bar.show {
    transform: translateY(0);
}

/* Details Page Specs Grid */
.specs-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.specs-table tr {
    border-bottom: 1px solid var(--border-color);
}

.specs-table td {
    padding: 14px 16px;
}

.specs-table td.label-spec {
    font-weight: 600;
    color: var(--text-muted);
    width: 40%;
}

.specs-table td.val-spec {
    font-weight: 500;
    color: var(--text-color);
}

/* Reveal effects on scroll */
@media (prefers-reduced-motion: no-preference) {
    @supports ((animation-timeline: view()) and (animation-range: entry)) {
        .scroll-reveal {
            animation: revealAnim auto linear backwards;
            animation-timeline: view();
            animation-range: entry 10% cover 30%;
        }
        @keyframes revealAnim {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    }
}

/* ==========================================================================
   Dark Mode Contrast & Readability Overrides
   ========================================================================== */
html[data-theme="dark"] {
    color-scheme: dark;
}

/* Force light colors on text classes when dark theme is active */
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-black-50,
html[data-theme="dark"] .form-text {
    color: #a1a1aa !important; /* High contrast readable light grey */
}

html[data-theme="dark"] .text-dark {
    color: #e5e7eb !important; /* Converts dark text helper to light grey */
}

html[data-theme="dark"] .text-black {
    color: #ffffff !important;
}

/* Ensure inputs are fully visible and readable in dark mode */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    color: #ffffff !important;
    background-color: #16161c !important;
    border-color: #2e2e38 !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(197, 168, 128, 0.25) !important;
}

html[data-theme="dark"] .form-control::placeholder {
    color: #6b7280 !important;
}

/* Table overrides for light/dark theme compatibility */
.table {
    --bs-table-bg: var(--card-bg) !important;
    --bs-table-color: var(--text-color) !important;
    --bs-table-border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

.table > :not(caption) > * > * {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

.table-bordered,
.table-bordered td,
.table-bordered th {
    border-color: var(--border-color) !important;
}

/* Compare bar text and button colors */
.compare-bar h6 {
    color: var(--text-color) !important;
}

.compare-bar .text-muted {
    color: var(--text-muted) !important;
}

.compare-bar #btnClearCompare {
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.compare-bar #btnClearCompare:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="dark"] .compare-bar #btnClearCompare:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Footer text visibility overrides for light mode */
html[data-theme="light"] footer h6,
html[data-theme="light"] footer h6.text-white {
    color: var(--text-color) !important;
}

html[data-theme="light"] footer a.text-white,
html[data-theme="light"] footer .text-white {
    color: var(--text-muted) !important;
}

html[data-theme="light"] footer .btn-outline-secondary {
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

html[data-theme="light"] footer .btn-outline-secondary:hover {
    background-color: var(--accent-color) !important;
    color: #000000 !important;
    border-color: var(--accent-color) !important;
}
