/* Stile Moderno - Falzetta Automobili */

/* 1. VARIABILI E RESET GLOBALE */
:root {
    --primary-color: #d50000;
    --primary-hover: #b71c1c;
    --dark-color: #121212;
    --dark-grey: #212121;
    --medium-grey: #424242;
    --light-grey: #eeeeee;
    --text-light: #fafafa;
    --text-dark: #212121;
    --font-primary: 'Inter', sans-serif;
    --font-headings: 'Roboto Condensed', sans-serif;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius: 8px;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --whatsapp-green: #25d366;
    --whatsapp-hover: #1faa56;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-primary);
    background-color: var(--dark-color);
    color: var(--text-light);
    overflow-x: hidden;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
h1, h2, h3 { font-family: var(--font-headings); text-transform: uppercase; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* 2. LOADER */
.loading-screen {
    position: fixed; z-index: 10000; top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--dark-color);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; }
.loading-logo {
    font-family: var(--font-headings); font-size: 4rem; color: var(--primary-color);
    animation: pulse 1.5s infinite;
}
.loading-screen p { font-family: var(--font-headings); letter-spacing: 4px; margin-top: 1rem; }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* 3. HEADER & NAV */
.header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    padding: 1.5rem 0; transition: var(--transition);
}
.header.scrolled { background: rgba(18, 18, 18, 0.8); backdrop-filter: blur(10px); padding: 1rem 0; }
.nav { display: flex; justify-content: space-between; align-items: center; }
.nav-brand .logo-text { font-family: var(--font-headings); font-size: 1.8rem; letter-spacing: 2px; }
.nav-menu { display: flex; gap: 2.5rem; }
.nav-link { font-weight: 500; font-size: 0.9rem; text-transform: uppercase; position: relative; }
.nav-link::after {
    content: ''; position: absolute; bottom: -5px; left: 0;
    width: 0; height: 2px; background: var(--primary-color); transition: var(--transition);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-toggle { display: none; }

/* 4. HERO SECTION */
.hero {
    position: relative; height: 100vh;
    display: flex; align-items: center; justify-content: center;
    text-align: center; overflow: hidden;
}
.hero-video-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.hero-video-bg video { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(18, 18, 18, 0.9), rgba(18, 18, 18, 0.4));
    z-index: 2;
}
.hero-content { position: relative; z-index: 3; }
.hero-title { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; color: var(--text-light); }
.hero-description { font-size: 1.2rem; max-width: 500px; margin: 1.5rem auto 2.5rem; }

/* 5. BOTTONI */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 1rem 2.5rem;
    border-radius: var(--border-radius); border: 2px solid transparent;
    font-family: var(--font-headings); text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--primary-color); color: var(--text-light); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-3px); }

/* 6. SEZIONI GENERICHE */
.inventory, .about, .contact, .rental { padding: 6rem 0; }
.inventory { background: var(--light-grey); color: var(--text-dark); }
.about, .rental { background: var(--dark-grey); }
.section-header { text-align: center; margin-bottom: 4rem; }
.section-title { font-size: 2.5rem; margin-bottom: 1rem; }
.section-description { max-width: 600px; margin: 0 auto; color: #b0b0b0; }
.inventory .section-description { color: var(--medium-grey); }

/* 7. INVENTORY DYNAMICO */
.inventory-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.filter-group select, .filter-group input {
    padding: 0.7rem;
    border: 1px solid var(--medium-grey);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    min-width: 150px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.car-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid #e0e0e0;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.car-image {
    position: relative;
    height: 250px;
    background-color: #f5f5f5;
    overflow: hidden;
}

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

.car-price {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.1rem;
    z-index: 2;
}

.car-details {
    padding: 1.5rem;
}

.car-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.car-subtitle {
    color: var(--medium-grey);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.car-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--medium-grey);
}

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

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.7rem 1.5rem;
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
}

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

.loading-cars {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--border-radius);
    margin-top: 2rem;
}

.loading-cars .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 8. RENTAL SECTION */
.rental-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.rental-card {
    background: var(--dark-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--medium-grey);
    display: flex;
    flex-direction: column;
    max-width: 450px;
    flex-basis: 450px;
    flex-grow: 0;
    flex-shrink: 1;
}

.rental-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 25px rgba(213, 0, 0, 0.1);
}
.rental-content {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.rental-content h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.rental-content p {
    color: #b0b0b0;
    line-height: 1.7;
    margin-bottom: 2rem;
}
.rental-content .btn {
    margin-top: auto;
    align-self: flex-start;
}

.rental-image-slider {
    position: relative;
    height: 300px;
    overflow: hidden;
}
.slider-wrapper {
    width: 100%;
    height: 100%;
}
.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}
.slide.active {
    opacity: 1;
}
.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
    transition: background-color 0.3s ease;
}
.slider-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
.slider-btn.prev {
    left: 10px;
}
.slider-btn.next {
    right: 10px;
}

/* 9. ABOUT SECTION */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.about-image {
    height: 450px; 
    border-radius: var(--border-radius); 
    background-color: var(--dark-color);
    background-image: url('images/logo.jpeg');
    background-size: cover; 
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: var(--dark-grey);
}
.about-content p { margin-bottom: 1.5rem; line-height: 1.7; color: #b0b0b0; }
.features-grid { margin-top: 2rem; display: grid; gap: 1rem; }
.feature h4 { color: var(--primary-color); margin-bottom: 0.5rem; }

/* 10. CONTACT SECTION */
.contact-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; align-items: center; }
.contact-info p { margin-bottom: 1rem; font-size: 1.1rem; }
.contact-map { margin-top: 2rem; }

/* 11. WHATSAPP BUTTON */
.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.whatsapp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: var(--whatsapp-green);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: whatsapp-pulse 2s infinite;
}

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

.whatsapp-button svg {
    transition: transform 0.3s ease;
}

.whatsapp-button:hover svg {
    transform: scale(1.1);
}

@keyframes whatsapp-pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 10px rgba(37, 211, 102, 0.1);
    }
    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 20px rgba(37, 211, 102, 0);
    }
}

/* 12. FOOTER */
.footer { background: var(--dark-color); padding: 4rem 0 2rem; border-top: 1px solid var(--medium-grey); }
.footer-content { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 2rem; gap: 2rem; }
.footer-brand .logo-text { font-size: 1.5rem; }
.footer-brand p { color: #aaa; }
.footer-links { display: flex; gap: 2rem; }
.footer-social { display: flex; gap: 1.5rem; }
.footer-social a { color: var(--light-grey); transition: var(--transition); }
.footer-social a:hover { color: var(--primary-color); transform: translateY(-3px); }
.footer-bottom { text-align: center; color: #777; font-size: 0.9rem; padding-top: 2rem; border-top: 1px solid var(--medium-grey); }

/* 13. ANIMAZIONI */
.animate-fade-in-up {
    opacity: 0; transform: translateY(30px);
    animation: fadeInUp 0.8s 0.2s forwards cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

/* 14. PLACEHOLDER IMMAGINI E LAZY LOAD */
.image-placeholder {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: #f0f0f0;
    z-index: 1;
}

.car-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease;
}

.car-image img.loaded {
    opacity: 1;
}

/* 15. PAGINAZIONE */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.pagination-btn {
    border: 2px solid var(--medium-grey);
    background-color: transparent;
    color: var(--text-dark);
    font-family: var(--font-headings);
    font-weight: 600;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover {
    background-color: var(--dark-grey);
    border-color: var(--dark-grey);
    color: var(--text-light);
}

.pagination-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-light);
    cursor: default;
}

/* 16. RESPONSIVE */
@media (max-width: 992px) {
    .rental-grid { grid-template-columns: 1fr; }
    .inventory-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .inventory-controls { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }
    
    .rental-card:nth-child(1),
    .rental-card:nth-child(2) {
        flex-basis: 100%;
    }
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .nav-toggle { display: block; }
    .about-grid, .contact-grid { grid-template-columns: 1fr; }
    .about-image { height: 300px; }
    .footer-content { flex-direction: column; text-align: center; gap: 2rem; }
    .car-specs { grid-template-columns: 1fr; }
    .car-actions { flex-direction: column; }
    
    /* WhatsApp button responsive */
    .whatsapp-float {
        bottom: 1rem;
        right: 1rem;
    }
    
    .whatsapp-button {
        width: 50px;
        height: 50px;
    }
    
    .whatsapp-button svg {
        width: 26px;
        height: 26px;
    }
}