/* Premium Automotive Theme - Dark Mode */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    /* Deep Navy/Black */
    --card-bg: rgba(30, 41, 59, 0.7);
    /* Glassmorphism base */
    --primary-color: #3b82f6;
    /* Electric Blue */
    --primary-hover: #2563eb;
    --accent-color: #ef4444;
    /* Racing Red for alerts/errors */
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --input-bg: rgba(15, 23, 42, 0.6);
    --success-color: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    /* Modern, tech-inspired font */
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.main-container {
    width: 100%;
    max-width: 600px;
    perspective: 1000px;
}

.form-wrapper {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}


.logo {
    max-width: 380px;
    width: 100%;
    height: auto;
    margin: 0 auto 15px auto;
    display: block;
    /* Formula Definitiva: Sfondo 100% invisibile + Colore Match Gradiente (#60a5fa -> #a78bfa) */
    filter: grayscale(1) invert(1) contrast(1000%) sepia(1) hue-rotate(190deg) saturate(500%) brightness(1.1);
    mix-blend-mode: screen;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    text-transform: uppercase;
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

.input-group {
    margin-bottom: 24px;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.input-group input[type="text"],
.input-group input[type="tel"],
.input-group input[type="email"],
.input-group input[type="number"],
.input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--input-bg);
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    background-color: rgba(15, 23, 42, 0.8);
}

.input-group select option {
    /* Dark background for options */
    color: var(--text-main);
}

/* --- MENU HAMBURGER (Navigazione tra pagine) --- */
.hamburger-menu {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
}

.hamburger-btn {
    width: 44px;
    height: 44px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease, border-color 0.3s ease;
    /* Sovrascrive lo stile globale del button */
    width: 44px !important;
    margin-top: 0 !important;
    font-size: inherit !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.hamburger-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hamburger-btn:active {
    transform: none;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #f8fafc;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Animazione X quando aperto */
.hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Dropdown menu */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    min-width: 200px;
    padding: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.nav-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #f8fafc;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* --- CATALOGO AUTO (Added Step 842) --- */
.catalog-header {
    text-align: center;
    padding: 20px;
    background: transparent;
    /* Rimosso sfondo gradiente pesante per integrarlo meglio */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.car-grid {
    display: grid;
    gap: 30px;
    margin-top: 20px;
    /* Mobile: 1 colonna (default) */
    grid-template-columns: 1fr;
}

/* Tablet: 2 colonne */
@media (min-width: 768px) {
    .car-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 colonne */
@media (min-width: 1100px) {
    .car-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.car-card {
    background: #1e293b;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: #60a5fa;
}

.car-image-container {
    width: 100%;
    height: 220px;
    /* Altezza fissa per uniformità */
    overflow: hidden;
    position: relative;
}

.car-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.car-card:hover .car-image {
    transform: scale(1.05);
}

.car-details {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.car-brand {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.car-model {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 5px 0 10px 0;
    color: #ffffff;
}

.car-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #60a5fa;
    /* Blu elettrico */
    margin-bottom: 15px;
}

.car-specs {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: auto;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-details {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    text-align: center;
    border-radius: 8px;
    font-weight: 700;
    transition: opacity 0.3s;
}

.btn-details:hover {
    opacity: 0.9;
}

/* --- DETTAGLIO AUTO: GALLERY & LIGHTBOX --- */
.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-image-wrapper {
    position: relative;
    cursor: zoom-in;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.main-image-display {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.thumbnails-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    border: 2px solid transparent;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
    border-color: #60a5fa;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
}

.close-lightbox:hover {
    color: #ef4444;
}

/* Frecce navigazione lightbox */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s;
    z-index: 10;
    /* Sovrascrive stile globale button */
    width: 52px !important;
    margin-top: 0 !important;
    padding: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 400 !important;
    box-shadow: none !important;
}

.lightbox-arrow:hover {
    background: rgba(59, 130, 246, 0.7);
    border-color: rgba(59, 130, 246, 0.8);
    transform: translateY(-50%) scale(1.1);
    box-shadow: none !important;
}

.lightbox-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-arrow-left {
    left: 20px;
}

.lightbox-arrow-right {
    right: 20px;
}

/* Contatore foto nel lightbox (es. "2 / 5") */
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.btn-zoom {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    pointer-events: none;
    /* Let clicks pass through to main wrapper */
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-group input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.row {
    display: flex;
    gap: 20px;
}

.row .input-group {
    flex: 1;
}

/* Checkbox Styles - Modern Card Style */
.checkbox-group {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.checkbox-group>label {
    margin-bottom: 16px;
    display: block;
    color: var(--primary-color);
}

.checkbox-option {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.checkbox-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.checkbox-option:last-child {
    margin-bottom: 0;
}

.checkbox-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    background-color: var(--input-bg);
    transition: all 0.2s ease;
}

.checkbox-option input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-option input[type="checkbox"]:checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.checkbox-option label {
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    text-transform: none;
    font-size: 1rem;
}

/* Privacy Checkbox Specific */
.privacy-checkbox {
    background: transparent;
    border: none;
    padding: 0;
}

.privacy-checkbox label,
.privacy-checkbox a {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.privacy-checkbox a {
    color: var(--primary-color) !important;
}

/* Features Grid */
.features-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 10px;
}

.feature-item {
    text-align: center;
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.feature-item span {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Sezione Come Funziona */
.how-it-works-section {
    margin-bottom: 10px;
}

.how-it-works-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 14px;
}

.how-it-works {
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px 24px;
}

.how-it-works-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.how-it-works-list li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 4px;
}

/* Testimonial Section & Carousel */
.testimonial-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.testimonial-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0.1);
}

/* Scrollbar Styling */
.testimonial-container::-webkit-scrollbar {
    height: 6px;
}

.testimonial-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.testimonial-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.testimonial-card {
    flex: 0 0 85%;
    /* Shows a bit of the next card */
    scroll-snap-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.testimonial-stars {
    color: #fbbf24;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        padding: 15px;
        align-items: flex-start;
    }

    .form-wrapper {
        padding: 24px;
        margin-top: 20px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .row {
        flex-direction: column;
        gap: 0;
    }


    button {
        font-size: 1rem;
        padding: 16px;
    }

    .features-grid {
        gap: 8px;
    }

    .feature-item {
        padding: 10px 5px;
    }

    .feature-item span {
        font-size: 0.75rem;
    }
}

/* Carousel Fixes & Improvements */
.testimonial-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0.1);
}

.testimonial-card {
    flex: 0 0 85%;
    min-width: 280px;
    /* Ensure minimum width */
    scroll-snap-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.testimonial-text {
    /* Ensure visual clamping works across browsers */
    display: -webkit-box;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 10px;
}

.testimonial-author {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
}

/* Desktop: Show more cards */
@media (min-width: 768px) {
    .testimonial-card {
        flex: 0 0 45%;
    }
}

/* Button Styles - High Performance Look */
button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-left: 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Status Messages */
.status-message {
    margin-top: 20px;
    text-align: center;
    font-size: 1rem;
    padding: 16px;
    border-radius: 12px;
    display: none;
    animation: slideUp 0.3s ease-out;
    font-weight: 500;
}

.status-message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}