:root {
    --bg-primary: #fcfaf7; /* Soft Beige */
    --bg-secondary: #ffffff; /* White */
    --text-primary: #2c2c2c; /* Deep Gray/Charcoal */
    --text-light: #ffffff;
    --text-secondary: #7a7a7a; /* Medium Gray */
    --accent: #b09574; /* Refined Gold/Beige */
    --accent-hover: #967d5d;
    --border: rgba(176, 149, 116, 0.15);
    
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(176, 149, 116, 0.1);
    --glass-glow: 0 0 15px rgba(176, 149, 116, 0.05);
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --glass-border-hover: rgba(176, 149, 116, 0.5);
}

@keyframes glassGlow {
    0% { box-shadow: 0 8px 32px 0 rgba(176, 149, 116, 0.05); }
    50% { box-shadow: 0 8px 32px 0 rgba(176, 149, 116, 0.15); }
    100% { box-shadow: 0 8px 32px 0 rgba(176, 149, 116, 0.05); }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-primary);
    background-image: 
        linear-gradient(rgba(252, 250, 247, 0.92), rgba(252, 250, 247, 0.98)), 
        url('https://images.unsplash.com/photo-1503376780353-7e6692767b70?q=80&w=2000');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; }
a { color: var(--text-primary); text-decoration: none; transition: var(--transition); display: inline-block;}
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 5%; }

/* Mobile Menu & Headings */
.main-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--glass-shadow);
}
main { padding-top: 100px; /* Offset for fixed header across all pages */ }
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}
.logo img { height: 50px; object-fit: contain; }
.logo-text { 
    font-size: clamp(1.1rem, 2.8vw, 1.4rem); 
    line-height: 1; 
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 10px rgba(197, 160, 89, 0.3);
    white-space: nowrap;
}
.main-nav { display: flex; gap: 1.5rem; }
.main-nav a { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; padding: 15px 0;}
.main-nav a:hover, .main-nav a.active { color: var(--accent); }

.menu-toggle { display: none; background: none; border: none; font-size: 1.8rem; color: var(--accent); }
.hamburger::before { content: "☰"; }

.btn {
    display: inline-block;
    padding: 14px 30px;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: rgba(197, 160, 89, 0.05);
    backdrop-filter: blur(5px);
    cursor: pointer;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    text-align: center;
    border-radius: 50px;
}
.btn:hover { background: var(--accent); color: #0a0e0c; box-shadow: 0 5px 20px rgba(197, 160, 89, 0.4); transform: translateY(-3px); }
.btn-primary { background: var(--accent); color: #0a0e0c; border: none;}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 5px 20px rgba(227, 188, 109, 0.5); transform: translateY(-3px); }

/* Hero */
.hero {
    height: 85vh;
    min-height: 600px;
    background-image: linear-gradient(rgba(252, 250, 247, 0.4), rgba(252, 250, 247, 0.8)), url('https://images.unsplash.com/photo-1549646875-1262d4e6df5b?q=80&w=2000');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    text-align: center;
    padding: 2rem 5%;
}
.hero h1 { font-size: clamp(2.5rem, 8vw, 4.5rem); margin-bottom: 1.5rem; color: var(--text-primary); letter-spacing: -1px; }
.hero p { font-size: 1.25rem; margin-bottom: 2.5rem; color: var(--text-secondary); max-width: 650px; margin-inline: auto; font-weight: 300; }
.hero-ctas { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }

/* Sections */
.section { padding: 4rem 0; }
.section-title {
    text-align: center; font-size: 2.2rem; margin-bottom: 3rem;
    color: var(--accent); position: relative; padding-bottom: 1rem;
}
.section-title::after {
    content: ''; position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%); width: 60px; height: 2px; background: var(--accent);
}

/* History / Reviews */
.history-container { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.history-metrics { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.metric-box { 
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem; 
    border: 1px solid var(--glass-border); 
    text-align: center;
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    animation: glassGlow 8s infinite ease-in-out;
}
.metric-box h3 { font-size: 3rem; color: var(--accent); font-family: var(--font-heading); }
.metric-box p { color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }

.reviews-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.review-card { 
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem; 
    border: 1px solid var(--glass-border); 
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}
.review-card .stars { color: var(--accent); font-size: 1.5rem; margin-bottom: 1rem; }
.review-card p { font-style: italic; color: var(--text-primary); margin-bottom: 1.5rem; font-size: 1.05rem; }
.review-card h4 { color: var(--text-secondary); font-size: 0.9rem; text-transform: uppercase; }

/* Car Cards */
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2.5rem; }
.car-card { 
    background: var(--glass-bg);
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); 
    border-radius: 20px;
    overflow: hidden; 
    cursor: pointer; 
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    animation: glassGlow 12s infinite ease-in-out;
}
.car-card-img-wrapper { height: 240px; overflow: hidden; position: relative; }
.car-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s ease; }
.car-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(176, 149, 116, 0.15); border-color: var(--accent); }
.car-card:hover img { transform: scale(1.05); }
.car-card-content { padding: 2rem; }
.car-card h3 { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--text-primary); font-family: var(--font-heading); }
.car-card .price { color: var(--accent); font-size: 1.3rem; font-weight: 700; margin-bottom: 1.25rem; letter-spacing: 0.5px; }
.car-card .metrics { display: flex; gap: 1rem; font-size: 0.9rem; color: var(--text-secondary); border-top: 1px solid var(--border); padding-top: 1.25rem; font-weight: 500; }

/* Car Details */
.car-details-wrapper { display: flex; min-height: calc(100vh - 80px); }
.car-details-visual { width: 50%; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.car-details-visual .main-image { width: 100%; height: 100%; object-fit: cover; }
.car-details-info { width: 50%; padding: 6rem 4rem 4rem; background-color: var(--bg-primary); min-height: 100vh;}
.car-header h2 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.car-header .price { font-size: 2rem; color: var(--accent); margin-bottom: 2rem; }
.car-actions { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.action-btn { flex: 1; min-width: 200px; }

.photo-gallery-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px;
    padding-bottom: 20px;
}
.gallery-thumb { 
    flex: 0 0 75%;
    width: 75%;
    height: 250px; 
    border-radius: 16px;
    object-fit: cover; 
    border: 2px solid transparent; 
    cursor: pointer; 
    transition: 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
    opacity: 0.85;
}
.gallery-thumb:hover { 
    border-color: var(--accent); 
    opacity: 1;
    transform: scale(1.02);
}

@media (min-width: 768px) {
    .photo-gallery-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        overflow-x: visible;
    }
    .gallery-thumb {
        flex: auto;
        height: 120px;
        border-radius: 10px;
    }
}

.specs-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.specs-table th, .specs-table td { padding: 1.2rem 0; border-bottom: 1px solid var(--glass-border); text-align: left; }
.specs-table th { color: var(--text-secondary); font-weight: 600; width: 40%; }

.mobile-sticky-cta { display: none; }

/* Admin Panel */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;}
.admin-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { background: var(--bg-secondary); color: var(--accent); }
.admin-modal-content { background: var(--bg-primary); max-width: 800px; margin: 0 auto; padding: 2rem; border: 1px solid var(--accent); position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-primary); font-size: 2rem; cursor: pointer; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); }
.form-input { width: 100%; padding: 15px; background: rgba(10, 14, 12, 0.8); border: 1px solid var(--glass-border); color: var(--text-primary); font-family: var(--font-body); font-size: 1rem; border-radius: 2px; transition: all 0.3s; }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 10px rgba(197, 160, 89, 0.2); }
.financing-form-container { max-width: 800px; margin: 0 auto; background: var(--bg-secondary); padding: 3rem; border: 1px solid var(--border); }

/* Footer */
.main-footer { background: #fdfdfd; color: var(--text-primary); padding: 5rem 0 3rem; border-top: 1px solid var(--border); }
.footer-container { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4rem; margin-bottom: 4rem; }
.footer-container h3, .footer-container h4 { color: var(--text-primary); margin-bottom: 1.5rem; font-family: var(--font-heading); }
.footer-links a { display: block; margin-bottom: 1rem; color: var(--text-secondary); font-size: 0.95rem; }
.footer-links a:hover { color: var(--accent); padding-left: 5px; }

/* Mobile Optimizations (Strict Mobile-First Emphasis) */
@media (max-width: 900px) {
    .header-actions { display: none; }
    .main-nav { 
        display: none; flex-direction: column; position: absolute; top: 80px; left: 0; width: 100%; 
        background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--glass-border); padding: 1rem; 
        box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    }
    .menu-toggle { display: block; }

    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
    .hero-ctas { flex-direction: column; width: 100%; }
    .hero-ctas .btn { width: 100%; }
    
    .history-container { grid-template-columns: 1fr; gap: 2rem;}
    .history-metrics { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
    @media (max-width: 500px) { .history-metrics { grid-template-columns: 1fr; } }
    .section-title::after { left: 0; transform: none; }
    .history-content .section-title { text-align: left; }
    .section-title { text-align: left; }

    /* Car Details Mobile Flow */
    .car-details-wrapper { flex-direction: column; }
    .car-details-visual { width: 100%; height: auto; aspect-ratio: 4/3; position: relative; top: 0; border-radius: 0 0 20px 20px; overflow: hidden; }
    .car-details-visual .main-image { width: 100%; height: 100%; object-fit: cover !important; }
    .car-details-info { width: 100%; padding: 2rem 5%; padding-bottom: 120px; /* Space for sticky CTA */ }
    .car-header h2 { font-size: 2rem; }
    
    .car-actions { display: none; } /* Hide main actions, show sticky */

    /* Sticky Action Bar on Mobile */
    .floating-cta { display: flex !important; bottom: 80px; } /* Elevated slightly to not overlap sticky bar */
    
    .mobile-sticky-cta {
          display: flex;
          position: fixed;
          bottom: 0;
          left: 0;
          width: 100%;
          background: rgba(10, 14, 12, 0.95);
          backdrop-filter: blur(16px);
          border-top: 1px solid rgba(197, 160, 89, 0.2);
          padding: 15px 20px;
          justify-content: center;
          align-items: center;
          z-index: 1000;
          box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    }
    .mobile-sticky-cta .price { font-family: var(--font-heading); font-size: 1.3rem; color: var(--accent); font-weight: 700; margin: 0; }
    .mobile-sticky-cta .btn { padding: 10px 20px; font-size: 0.75rem; }
    
    .footer-container { grid-template-columns: 1fr; gap: 2rem; }
    
    .admin-form-grid { grid-template-columns: 1fr; }
    .financing-form-container { padding: 1.5rem; }
}

/* Hide mobile sticky on desktop */
@media (min-width: 901px) {
    .mobile-sticky-cta { display: none !important; }
}

}

/* Lightbox Gallery */
.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 14, 12, 0.95); backdrop-filter: blur(10px); z-index: 2000; justify-content: center; align-items: center; flex-direction: column; touch-action: none; }
.lightbox-close { position: absolute; top: 30px; right: 30px; font-size: 3rem; background: none; border: none; color: white; cursor: pointer; z-index: 2001; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.5rem; background: rgba(0,0,0,0.5); width: 50px; height: 50px; display: flex; justify-content: center; align-items: center; border-radius: 50%; border: none; color: white; cursor: pointer; z-index: 2001; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-content { max-width: 90%; max-height: 80vh; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-drag: none; pointer-events: auto; }

/* Loan Calculator */
.loan-calc-container {
    background: var(--glass-bg); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border); 
    padding: 2rem; 
    margin-top: 3rem; 
    border-radius: 8px;
    box-shadow: var(--glass-shadow);
}
.loan-calc-container h3 { margin-bottom: 1.5rem; color: var(--accent); font-family: var(--font-heading); font-size: 1.8rem; }
.loan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem;}
.loan-result { text-align: center; padding: 1.5rem; background: rgba(197, 160, 89, 0.05); border: 1px solid var(--border); border-radius: 4px;}
.loan-result .monthly-payment { font-size: 2.5rem; color: var(--accent); font-family: var(--font-heading); margin-top: 0.5rem; }
.loan-summary { display: flex; justify-content: space-around; margin-top: 1rem; font-size: 0.95rem; color: var(--text-primary); }

/* Rating Bars */
.rating-section { margin-top: 2.5rem; background: rgba(255,255,255,0.02); padding: 1.5rem; border: 1px solid rgba(255,255,255,0.05); border-radius: 4px;}
.rating-item { margin-bottom: 1rem; }
.rating-header { display: flex; justify-content: space-between; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; color: var(--text-secondary);}
.rating-bar-bg { width: 100%; height: 6px; background: #222; border-radius: 3px; overflow: hidden; }
.rating-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0; transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1); }

/* Animations */
.fade-up { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* Map Container */
.map-container { width: 100%; height: 400px; border: 1px solid var(--border); margin-top: 3rem; }
.map-container iframe { width: 100%; height: 100%; border: none; }

/* -------------------
   FLOATING CTA
------------------- */
.floating-cta {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25D366; /* Vibrant Green */
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 15px rgba(37, 211, 102, 0.4);
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.2);
}

.floating-cta:hover {
    transform: translateY(-5px) scale(1.05);
    background-color: #128C7E; /* Darker green on hover */
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 20px rgba(18, 140, 126, 0.6);
}

@media (max-width: 900px) {
    .floating-cta {
        display: none !important; /* We use .mobile-sticky-cta on mobile */
    }
    .fade-up { opacity: 1 !important; transform: none !important; transition: none !important; }
}
@media (min-width: 901px) {
    .mobile-sticky-cta { display: none !important; }
}
