/* Base Variables & Reset */
:root {
    /* Colors */
    --primary: #2563eb;
    /* Professional Blue */
    --primary-dark: #1e40af;
    --secondary: #0f172a;
    /* Dark Slate */
    --accent: #f59e0b;
    /* Attention Amber */

    --text-main: #334155;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;

    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --section-padding: 5rem 0;
    --container-width: 1200px;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.6;
    background-color: var(--white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

main {
    flex: 1;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: var(--font-heading);
    color: var(--secondary);
    line-height: 1.2;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
    /* Slightly reduced padding for mobile */
}

@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
}

.section {
    padding: var(--section-padding);
}

.bg-light {
    background-color: var(--bg-light);
}

.text-center {
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: transform 0.2s, background-color 0.2s;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    border: 2px solid var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid currentColor;
    color: var(--secondary);
}

.btn-white {
    color: var(--white);
    border-color: var(--white);
}

.btn-white:hover {
    background-color: var(--white);
    color: var(--secondary);
}

.btn-whatsapp {
    background-color: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--secondary);
}

.logo span {
    color: var(--primary);
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.1rem;
    }
}

.nav-links-desktop {
    display: none;
    /* Mobile first hidden */
}

@media (min-width: 768px) {
    .nav-links-desktop {
        display: flex;
        gap: 2rem;
    }

    .nav-links-desktop a {
        font-weight: 500;
        font-size: 0.95rem;
        color: var(--text-main);
    }

    .nav-links-desktop a:hover,
    .nav-links-desktop a.active {
        color: var(--primary);
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Reduced gap for mobile */
}

@media (min-width: 768px) {
    .nav-actions {
        gap: 1rem;
    }
}

.nav-btn {
    display: none;
}

@media (max-width: 768px) {
    .nav-actions .btn {
        display: none;
        /* Hide ALL buttons in header on mobile to prevent overflow */
    }

    .nav-actions .hamburger {
        display: flex;
        /* Ensure hamburger is shown */
    }
}

@media (min-width: 768px) {
    .nav-btn {
        display: inline-flex;
    }
}

/* Hamburger */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1100;
    padding: 0.5rem;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--secondary);
    transition: 0.3s;
    border-radius: 2px;
}

@media (min-width: 768px) {
    .hamburger {
        display: none;
        /* Show desktop nav */
    }
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background-color: var(--white);
    z-index: 1050;
    transition: 0.3s ease-in-out;
    padding-top: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    font-size: 1.25rem;
}

.mobile-link {
    font-weight: 600;
}

/* Hero Section (Home) */
.hero {
    position: relative;
    height: 90vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    background-image: url('https://images.unsplash.com/photo-1523987355523-c7b5b0dd90a7?q=80&w=2670&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    margin-top: 0;
    padding-top: 80px;
    /* Offset for fixed navbar */
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.5));
}

.hero-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    max-width: 800px;
}

.badge {
    display: inline-block;
    background-color: var(--primary);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero h1 {
    font-size: 2.2rem;
    /* Reduced for smaller phones */
    margin-bottom: 1rem;
    color: var(--white);
}

@media (max-width: 380px) {
    .hero h1 {
        font-size: 1.8rem;
    }
}

.text-gradient {
    color: #60a5fa;
    /* Fallback color */
    background: linear-gradient(to right, #60a5fa, #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 4rem;
    }
}

.hero p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Page Headers (Inner Pages) */
.page-header {
    background-color: var(--secondary);
    color: var(--white);
    padding: 10rem 0 4rem;
    /* Increased top padding to clear fixed navbar */
    background-size: cover;
    background-position: center;
    position: relative;
}

.page-header h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    opacity: 0.8;
    font-size: 1.2rem;
}

/* Permuta Section */
.permuta-grid {
    display: grid;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 900px) {
    .permuta-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Responsiveness Utility for Details Grid */
.detail-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 992px) {
    .detail-grid {
        grid-template-columns: 1fr 400px;
        gap: 40px;
    }
}

.spec-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 600px) {
    .spec-grid {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
}

.highlight {
    color: var(--primary);
}

@media (max-width: 768px) {
    .permuta-content h2 {
        font-size: 1.75rem;
    }

    .permuta-content .lead {
        font-size: 1.1rem;
    }
}

.lead {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.check-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.check-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.exchange-card {
    background-color: var(--bg-light);
    padding: 1.5rem;
    /* Reduced for mobile */
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    /* Reduced gap */
}

@media (min-width: 768px) {
    .exchange-card {
        padding: 3rem;
        gap: 2rem;
    }
}

.icon-box {
    font-size: 3rem;
    /* Small default for mobile */
    background-color: var(--white);
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .icon-box {
        font-size: 4rem;
        width: 100px;
        height: 100px;
    }
}

.arrow {
    font-size: 2rem;
    color: var(--text-light);
}

.main-image-container {
    height: 350px;
    /* Mobile height */
    background: #000;
    cursor: zoom-in;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .main-image-container {
        height: 550px;
    }
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.main-image-container:hover .image-overlay {
    opacity: 1;
}

@media (min-width: 992px) {
    .sticky-side {
        position: sticky;
        top: 100px;
        align-self: start;
    }
}

/* Catalog Page Layout */
.catalog-container {
    display: grid;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .catalog-container {
        grid-template-columns: 250px 1fr;
    }
}

.catalog-filters {
    background-color: var(--white);
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    align-self: start;
}

.filter-group {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-group h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Checkboxes */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 30px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #eee;
    border-radius: 4px;
}

.checkbox-container:hover input~.checkmark {
    background-color: #ccc;
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Price Slider */
.price-slider {
    width: 100%;
}

.price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Vehicle Grid & Cards */
.grid-3 {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (min-width: 768px) {
    .grid-3 {
        gap: 2rem;
    }
}

.vehicle-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    background-color: var(--white);
    display: flex;
    flex-direction: column;
}

.vehicle-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.vehicle-image {
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
    background-color: #f1f5f9;
}

.vehicle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.vehicle-card:hover .vehicle-image img {
    transform: scale(1.05);
}

.tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: var(--secondary);
    color: var(--white);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tag-accent {
    background-color: var(--accent);
    color: var(--secondary);
}

.vehicle-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.vehicle-details .btn {
    margin-top: auto;
}

.vehicle-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.vehicle-details h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.vehicle-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
}

.pagination a.active,
.pagination a:hover {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Detail Page */
.detail-header {
    background-color: var(--white);
    padding: 6rem 0 2rem;
    /* Adjusted for fixed nav */
    border-bottom: 1px solid var(--border);
}

.section-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.detail-header h1 {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.detail-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.detail-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.detail-container {
    display: grid;
    gap: 3rem;
}

@media (min-width: 1024px) {
    .detail-container {
        grid-template-columns: 2fr 1fr;
    }
}

.gallery-container .main-image {
    background-size: cover;
    background-position: center;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.thumb {
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    background-size: cover;
}

.thumb:hover {
    opacity: 1;
}

.detail-description {
    margin-top: 3rem;
    font-size: 1.05rem;
}

.detail-description h3 {
    margin-bottom: 1.5rem;
}

.detail-description ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
}

/* Detail Sidebar */
.specs-card,
.contact-card-sidebar {
    background-color: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.specs-card h3,
.contact-card-sidebar h3 {
    margin-bottom: 1.5rem;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #cbd5e1;
}

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

.spec-label {
    color: var(--text-light);
}

.spec-value {
    font-weight: 600;
    color: var(--secondary);
}

/* Contact Page Form */
.contact-layout {
    display: grid;
    gap: 4rem;
}

@media (min-width: 900px) {
    .contact-layout {
        grid-template-columns: 1fr 1.5fr;
    }
}

.form-card,
.hours-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hours-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

/* Chi Siamo Page */
.two-col-grid {
    display: grid;
    gap: 4rem;
}

@media (min-width: 900px) {
    .two-col-grid {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

.divider {
    height: 4px;
    width: 60px;
    background-color: var(--primary);
    margin: 1rem 0 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.service-card {
    text-align: center;
    padding: 2rem;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* Footer (Shared) */
.footer {
    background-color: #0f172a;
    color: #94a3b8;
    padding: 4rem 0 0;
    font-size: 0.95rem;
}

.footer-grid {
    display: grid;
    gap: 3rem;
    padding-bottom: 4rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.footer-logo {
    color: var(--white);
    display: inline-block;
    margin-bottom: 1rem;
}

.footer h5 {
    color: var(--white);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.footer-links li,
.footer-contact li {
    margin-bottom: 0.75rem;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
}

/* Category Cards (Home) */
.category-card {
    background-color: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.category-card:hover {
    transform: translateY(-5px);
}

.card-image {
    height: 200px;
    width: 100%;
    object-fit: cover;
}

.card-body {
    padding: 1.5rem;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: -100%;
    /* Hidden by default */
    left: 0;
    width: 100%;
    background-color: var(--white);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 2rem 1.5rem;
    z-index: 2000;
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: center;
}

.cookie-banner.show {
    bottom: 0;
}

.cookie-content {
    max-width: 1200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 2;
    min-width: 300px;
}

.cookie-text h4 {
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.cookie-text p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.cookie-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .cookie-banner {
        padding: 1.5rem 1rem;
    }

    .cookie-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .cookie-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Custom Lightbox from BCA Italia */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 31, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox__content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox__close {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 2001;
}

.lightbox__prev,
.lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 20px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

.lightbox__prev:hover,
.lightbox__next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox__prev {
    left: 40px;
}

.lightbox__next {
    right: 40px;
}

.lightbox__counter {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
}