/* ===== OTTIMIZZAZIONI MOBILE COMPLETE ===== */

/* Viewport e Touch */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
    font-size: 16px; /* Base font size per mobile */
}

body {
    overflow-x: hidden;
    position: relative;
    font-size: 1rem;
    line-height: 1.6;
    color: #ffffff;
}

/* ===== LEGGIBILITÀ MIGLIORATA MOBILE ===== */
@media (max-width: 768px) {
    body {
        font-size: 18px; /* Font più grande per leggibilità */
        line-height: 1.7;
    }
    
    h1 {
        font-size: 2.5rem !important;
        line-height: 1.2;
        margin-bottom: 1.5rem;
    }
    
    h2 {
        font-size: 2rem !important;
        line-height: 1.3;
        margin-bottom: 1.25rem;
    }
    
    h3 {
        font-size: 1.75rem !important;
        line-height: 1.4;
        margin-bottom: 1rem;
    }
    
    h4 {
        font-size: 1.5rem !important;
        line-height: 1.4;
        margin-bottom: 0.875rem;
    }
    
    p {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.8;
        margin-bottom: 1.25rem;
    }
    
    li {
        font-size: 1.125rem !important;
        line-height: 1.8;
        margin-bottom: 0.75rem;
    }
    
    a {
        font-size: 1.125rem !important;
    }
    
    /* Migliora contrasto testo */
    .text-muted,
    .text-gray {
        color: rgba(255, 255, 255, 0.85) !important;
    }
    
    /* Spaziatura migliorata */
    .section {
        padding: 4rem 1.5rem !important;
    }
    
    .container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ===== PULSANTI NEON MOBILE ===== */
@media (max-width: 768px) {
    a.btn_animate_border,
    button.btn_animate_border {
        padding: 20px 40px;
        font-size: 1.125rem !important; /* 18px - più grande */
        letter-spacing: 1.5px;
        min-height: 56px; /* Touch target più grande */
        width: 100%;
        max-width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 600;
    }
    
    a.btn_animate_border.small,
    button.btn_animate_border.small {
        padding: 16px 30px;
        font-size: 1rem !important; /* 16px */
        min-height: 50px;
    }
    
    a.btn_animate_border.large,
    button.btn_animate_border.large {
        padding: 24px 50px;
        font-size: 1.25rem !important; /* 20px */
        min-height: 64px;
    }
    
    /* Touch feedback migliorato */
    a.btn_animate_border:active,
    button.btn_animate_border:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Riduci effetti neon su mobile per performance */
    a.btn_animate_border:hover,
    button.btn_animate_border:hover {
        transform: translateY(-2px) scale(1.02);
    }
    
    a.btn_animate_border .btn-text,
    button.btn_animate_border .btn-text {
        font-size: 1.125rem !important; /* 18px */
        font-weight: 600;
    }
    
    a.btn_animate_border .btn-icon,
    button.btn_animate_border .btn-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    a.btn_animate_border,
    button.btn_animate_border {
        padding: 18px 32px;
        font-size: 1.0625rem !important; /* 17px */
        letter-spacing: 1px;
        min-height: 52px;
    }
    
    a.btn_animate_border .btn-text,
    button.btn_animate_border .btn-text {
        font-size: 1.0625rem !important; /* 17px */
    }
}

/* ===== FOOTER MOBILE OTTIMIZZATO ===== */
@media (max-width: 768px) {
    .footer-glass {
        padding: 3rem 0 1.5rem;
        margin-top: 4rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }
    
    .footer-section {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .footer-section h3,
    .footer-section h4 {
        font-size: 1.5rem !important; /* 24px */
        margin-bottom: 1.25rem;
        font-weight: 700;
    }
    
    .footer-logo {
        font-size: 2.25rem !important; /* 36px */
        margin-bottom: 1.25rem;
        font-weight: 800;
    }
    
    .footer-section p {
        font-size: 1.0625rem !important; /* 17px */
        line-height: 1.8;
        margin-bottom: 1rem;
    }
    
    /* Social links mobile */
    .social-links {
        gap: 0.8rem;
        justify-content: center;
    }
    
    .social-link {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
    }
    
    .social-link svg {
        width: 24px;
        height: 24px;
    }
    
    /* Newsletter form mobile */
    .newsletter-input {
        flex-direction: column;
        gap: 1.25rem;
    }
    
    .newsletter-email {
        width: 100%;
        padding: 1.25rem 1.75rem;
        font-size: 1.125rem !important; /* 18px */
        min-height: 56px;
    }
    
    .newsletter-email::placeholder {
        font-size: 1.0625rem !important; /* 17px */
    }
    
    .newsletter-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Footer stats mobile */
    .footer-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }
    
    .footer-stat {
        padding: 1.5rem 1rem;
    }
    
    .footer-stat-number {
        font-size: 2.5rem !important; /* 40px */
        font-weight: 900;
        margin-bottom: 0.75rem;
    }
    
    .footer-stat-label {
        font-size: 1rem !important; /* 16px */
        font-weight: 600;
    }
    
    /* Footer bottom mobile */
    .footer-bottom {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
    }
    
    .footer-links a.btn_animate_border {
        width: 100%;
        justify-content: center;
    }
    
    /* Footer section links mobile */
    .footer-section ul li {
        padding: 1rem 1rem 1rem 2rem;
        min-height: 52px;
        display: flex;
        align-items: center;
        font-size: 1.0625rem !important; /* 17px */
    }
    
    .footer-section a {
        font-size: 1.0625rem !important; /* 17px */
        padding: 0.75rem 0;
        min-height: 52px;
        display: flex;
        align-items: center;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .footer-glass {
        padding: 2.5rem 0 1rem;
    }
    
    .footer-content {
        gap: 1.5rem;
        padding: 0 0.75rem;
    }
    
    .footer-section {
        padding: 1.25rem;
    }
    
    .footer-logo {
        font-size: 2rem !important; /* 32px */
    }
    
    .social-link {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
    }
    
    .social-link svg {
        width: 26px;
        height: 26px;
    }
    
    .footer-stat-number {
        font-size: 2.25rem !important; /* 36px */
    }
    
    .footer-stat-label {
        font-size: 0.9375rem !important; /* 15px */
    }
}

/* ===== NAVBAR MOBILE ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem 1rem;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        padding: 1.25rem 1rem;
        width: 100%;
        text-align: left;
        font-size: 1.25rem !important; /* 20px */
        min-height: 56px;
        display: flex;
        align-items: center;
        font-weight: 500;
    }
    
    .mobile-menu-toggle {
        display: flex;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1001;
    }
}

/* ===== HERO SECTION MOBILE ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1rem;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 2.5rem !important; /* 40px */
        line-height: 1.2;
        margin-bottom: 1.5rem;
        font-weight: 800;
    }
    
    .hero-subtitle {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.6;
        margin-bottom: 2.5rem;
    }
    
    .hero-cta-group {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .hero-cta-group .btn_animate_border {
        width: 100%;
    }
    
    /* Hero mobile - contenuto sempre visibile */
    .hero-glass { padding: 2rem 1rem 3rem !important; min-height: auto !important; }
    .hero-content { padding: 0 1rem !important; gap: 1.5rem !important; }
    .hero-text { text-align: center !important; }
    .hero-title { font-size: 2rem !important; margin-bottom: 1rem !important; }
    .title-accent { -webkit-text-fill-color: #00cc6a !important; color: #00cc6a !important; }
    .hero-subtitle { font-size: 1.1rem !important; margin-bottom: 1.5rem !important; color: rgba(255,255,255,0.95) !important; }
    .hero-visual, .car-3d-container { display: none !important; }
    .hero-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 0.5rem !important; margin-bottom: 1.5rem !important; }
    .stat-item { padding: 0.75rem 0.4rem !important; }
    .stat-number { font-size: 1.5rem !important; color: #00cc6a !important; font-weight: 800 !important; line-height: 1.2 !important; }
    .stat-label { font-size: 0.65rem !important; color: rgba(255,255,255,0.95) !important; font-weight: 600 !important; text-transform: uppercase !important; letter-spacing: 0.3px !important; line-height: 1.3 !important; }
    .trust-indicators { flex-wrap: wrap !important; justify-content: center !important; gap: 1rem !important; }
    .trust-item { font-size: 0.95rem !important; color: rgba(255,255,255,0.95) !important; }
}

@media (max-width: 480px) {
    body {
        font-size: 17px;
    }
    
    .hero-title {
        font-size: 2.25rem !important; /* 36px */
    }
    
    .hero-subtitle {
        font-size: 1.125rem !important; /* 18px */
    }
    
    h1 {
        font-size: 2.25rem !important;
    }
    
    h2 {
        font-size: 1.875rem !important;
    }
    
    h3 {
        font-size: 1.625rem !important;
    }
    
    p {
        font-size: 1.0625rem !important; /* 17px */
    }
}

/* ===== CARDS E GRID MOBILE ===== */
@media (max-width: 768px) {
    .cars-grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .car-card {
        width: 100%;
        max-width: 100%;
    }
}

/* ===== FORM MOBILE ===== */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        width: 100%;
        padding: 1.25rem 1.5rem;
        font-size: 1.125rem !important; /* 18px */
        min-height: 56px;
        border-radius: 14px;
        line-height: 1.6;
    }
    
    input::placeholder,
    textarea::placeholder {
        font-size: 1.0625rem !important; /* 17px */
    }
    
    label {
        font-size: 1.0625rem !important; /* 17px */
        font-weight: 600;
        margin-bottom: 0.75rem;
        display: block;
    }
    
    textarea {
        min-height: 140px;
        resize: vertical;
        padding: 1.25rem 1.5rem;
        font-size: 1.125rem !important;
        line-height: 1.7;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions .btn_animate_border {
        width: 100%;
    }
}

/* ===== MODAL MOBILE ===== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 1.5rem 1rem;
    }
    
    .modal-body {
        padding: 1.5rem 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .modal-footer .btn_animate_border {
        width: 100%;
    }
}

/* ===== TABELLE MOBILE ===== */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        min-width: 100px;
    }
}

/* ===== BACK TO TOP MOBILE ===== */
@media (max-width: 768px) {
    .back-to-top {
        width: 50px;
        height: 50px;
        bottom: 1.5rem;
        right: 1.5rem;
        min-width: 50px;
        min-height: 50px;
    }
    
    .back-to-top svg {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 1rem;
        right: 1rem;
        min-width: 45px;
        min-height: 45px;
    }
}

/* ===== TOUCH INTERACTIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Disabilita hover su dispositivi touch */
    *:hover {
        transform: none !important;
    }
    
    /* Touch feedback migliorato */
    button:active,
    a:active,
    .btn_animate_border:active {
        opacity: 0.8;
        transform: scale(0.97);
    }
    
    /* Rimuovi animazioni complesse su touch */
    .social-link:hover svg {
        transform: scale(1.1);
        animation: none;
    }
}

/* ===== PERFORMANCE MOBILE ===== */
@media (max-width: 768px) {
    /* Riduci animazioni complesse */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Disabilita alcune animazioni pesanti */
    .footer-glass::before {
        animation: none;
    }
    
    /* Riduci effetti blur pesanti */
    .footer-glass {
        backdrop-filter: blur(15px);
    }
    
    .footer-section {
        backdrop-filter: blur(8px);
    }
}

/* ===== UTILITY MOBILE ===== */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .section {
        padding: 3rem 1rem;
    }
    
    .section-title {
        font-size: 2rem !important; /* 32px */
        margin-bottom: 2rem;
        font-weight: 800;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    /* Fix per hero title specifico */
    .hero-glass .hero-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-glass .hero-title .title-line {
        display: block;
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem;
    }
    
    .hero-glass .hero-title .title-accent {
        display: block;
        font-size: 1.75rem !important;
    }
    
    /* Fix overflow text */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Container width fix */
    .container {
        max-width: 100% !important;
        overflow-x: hidden;
    }
    
    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    * {
        max-width: 100%;
    }
    
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    /* Spacing mobile */
    .mb-mobile {
        margin-bottom: 1.5rem;
    }
    
    .mt-mobile {
        margin-top: 1.5rem;
    }
    
    .p-mobile {
        padding: 1rem;
    }
    
    /* Text mobile */
    .text-mobile-center {
        text-align: center;
    }
    
    .text-mobile-left {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .section {
        padding: 3rem 1rem;
    }
    
    .section-title {
        font-size: 2rem !important; /* 32px */
        margin-bottom: 2rem;
    }
}

/* ===== ACCESSIBILITÀ MOBILE ===== */
@media (max-width: 768px) {
    /* Focus visibile su mobile */
    *:focus {
        outline: 3px solid rgba(176, 38, 255, 0.6);
        outline-offset: 2px;
    }
    
    /* Skip link mobile */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 0;
        background: rgba(176, 38, 255, 0.9);
        color: white;
        padding: 0.75rem 1.5rem;
        z-index: 10000;
        text-decoration: none;
        border-radius: 0 0 8px 0;
    }
    
    .skip-link:focus {
        top: 0;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 2rem 1rem;
    }
    
    .modal-content {
        max-height: 85vh;
    }
    
    .footer-glass {
        padding: 2rem 0 1rem;
    }
}

/* ===== DARK MODE MOBILE ===== */
@media (max-width: 768px) {
    @media (prefers-color-scheme: dark) {
        body {
            background: #0f172a;
        }
    }
}

/* ===== REDUCE MOTION MOBILE ===== */
@media (max-width: 768px) {
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

