/* ==========================================
   RESPONSIVE DESIGN - TABLETS I MÒBILS
========================================== */

/* Tablets i mòbils (max-width: 768px) */
@media (max-width: 768px) {
    /* Bloquejar scroll quan menú obert */
    body.menu-open {
        overflow: hidden;
    }

    /* Overlay independent FORA del menú */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(30, 30, 35, 0.97);
        backdrop-filter: blur(15px);
        z-index: 998;
        animation: fadeInOverlay 0.3s ease;
    }

    @keyframes fadeInOverlay {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    /* Navegació mòbil */
    .nav-container {
        padding: 1rem;
    }

    /* Menú amb fons BLANC amb gradient subtil */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        flex-direction: column;
        background: linear-gradient(135deg, 
            rgba(255, 255, 255, 0.98) 0%, 
            rgba(245, 241, 232, 0.96) 100%);
        padding: 2rem 1.5rem;
        box-shadow: var(--shadow-heavy);
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 999;
        backdrop-filter: blur(20px);
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    /* Logo al menú mòbil - MÉS GRAN */
    .nav-menu::after {
        content: '';
        position: absolute;
        top: 1.5rem;
        left: 50%;
        transform: translateX(-50%);
        width: 280px;
        height: 100px;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="450" height="100" viewBox="0 0 450 100"><defs><linearGradient id="mountainGrad1" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%232d5a3d;stop-opacity:1"/><stop offset="100%" style="stop-color:%231e3d2a;stop-opacity:1"/></linearGradient><linearGradient id="mountainGrad2" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%2387a96b;stop-opacity:1"/><stop offset="100%" style="stop-color:%236b8756;stop-opacity:1"/></linearGradient></defs><g transform="translate(15, 5)"><path d="M0 80 L45 5 L90 80 Z" fill="url(%23mountainGrad1)"/><path d="M18 80 L55 5 L92 80 Z" fill="url(%23mountainGrad2)"/><g transform="translate(25, 35)"><line x1="-16" y1="5" x2="-4" y2="15" stroke="%23e67e22" stroke-width="3.5"/><line x1="-4" y1="15" x2="0" y2="18" stroke="%23e67e22" stroke-width="3.5"/><line x1="0" y1="18" x2="18" y2="3" stroke="%23e67e22" stroke-width="3.5"/><line x1="18" y1="3" x2="32" y2="23" stroke="%23e67e22" stroke-width="3.5"/><line x1="32" y1="23" x2="52" y2="10" stroke="%23e67e22" stroke-width="3.5"/><circle cx="-16" cy="5" r="3.5" fill="%233498db"/><circle cx="0" cy="18" r="4" fill="%233498db"/><circle cx="18" cy="3" r="6" fill="%233498db"/><circle cx="32" cy="23" r="8" fill="%233498db"/><circle cx="52" cy="10" r="4.5" fill="%233498db"/></g></g><g transform="translate(125, 5)"><text x="0" y="30" font-family="Comfortaa" font-size="32" font-weight="500" fill="%232d5a3d">VILADRAU</text><text x="0" y="50" font-family="Comfortaa" font-size="16" fill="%234a7c59" font-weight="400">ONLINE</text><text x="0" y="68" font-family="Comfortaa" font-size="10" fill="%2387a96b" font-weight="600">Serveis Informàtics - Partner Digital - IA</text><line x1="0" y1="80" x2="220" y2="80" stroke="%23e67e22" stroke-width="3"/><circle cx="220" cy="80" r="4" fill="%23e67e22"/></g></svg>') no-repeat center;
        background-size: contain;
        opacity: 0;
        animation: logoFadeIn 0.6s ease 0.3s forwards;
        pointer-events: none;
    }

    @keyframes logoFadeIn {
        from {
            opacity: 0;
            transform: translateX(-50%) scale(0.8);
        }
        to {
            opacity: 0.95;
            transform: translateX(-50%) scale(1);
        }
    }

    /* Espai per al logo MÉS GRAN */
    .nav-menu.active {
        padding-top: 8rem;
    }

    /* Botó temperatura mòbil */
    .temp-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        z-index: 1001;
    }

    /* Botó hamburguesa */
    .mobile-toggle {
        display: flex;
        z-index: 1001;
    }

    /* Items del menú amb animació */
    .nav-item {
        width: 100%;
        margin-bottom: 0.3rem;
        opacity: 0;
        transform: translateX(-30px);
        transition: all 0.3s ease;
    }

    .nav-menu.active .nav-item {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-menu.active .nav-item:nth-child(1) { animation: slideInLeft 0.4s ease 0.1s forwards; }
    .nav-menu.active .nav-item:nth-child(2) { animation: slideInLeft 0.4s ease 0.2s forwards; }
    .nav-menu.active .nav-item:nth-child(3) { animation: slideInLeft 0.4s ease 0.3s forwards; }
    .nav-menu.active .nav-item:nth-child(4) { animation: slideInLeft 0.4s ease 0.4s forwards; }

    @keyframes slideInLeft {
        from {
            opacity: 0;
            transform: translateX(-30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .nav-item:hover .dropdown {
        opacity: 0;
        visibility: hidden;
        transform: none;
        pointer-events: none;
    }

    .nav-link {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 1rem 1.5rem;
        text-align: left;
        font-size: 1.1rem;
        border-radius: 15px;
        background: linear-gradient(135deg, 
            rgba(135, 169, 107, 0.15) 0%, 
            rgba(135, 169, 107, 0.08) 100%);
        margin-bottom: 0.5rem;
        box-shadow: 0 3px 12px rgba(45, 90, 61, 0.12);
        backdrop-filter: blur(10px);
        border: 1.5px solid rgba(135, 169, 107, 0.3);
        color: var(--color-principal);
        font-weight: 600;
    }

    .nav-link:hover {
        background: linear-gradient(135deg, var(--color-accent), var(--color-secundari));
        color: white;
        transform: translateX(10px);
        box-shadow: 0 5px 20px rgba(45, 90, 61, 0.25);
        border-color: transparent;
    }

    .nav-link.highlight {
        background: linear-gradient(135deg, var(--color-tech), var(--color-accent));
        color: white;
        box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    }

    .nav-link.cta {
        background: linear-gradient(135deg, var(--color-cta), #d35400);
        color: white;
        box-shadow: 0 5px 15px rgba(230, 126, 34, 0.3);
    }

    /* Dropdown en mòbil - Fons verd MOLT SUBTIL */
    .dropdown {
        position: static !important;
        width: 100% !important;
        display: none !important;
        background: rgba(135, 169, 107, 0.08) !important;
        border-radius: 12px;
        margin: 0.5rem 0 1rem 0;
        padding: 0;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        top: auto !important;
        left: auto !important;
        min-width: auto !important;
        box-shadow: inset 0 2px 10px rgba(45, 90, 61, 0.08) !important;
        border: 1px solid rgba(135, 169, 107, 0.2) !important;
        backdrop-filter: blur(10px);
    }

    .dropdown.active {
        display: block !important;
        padding: 0.5rem 0;
        animation: slideDownExpand 0.3s ease;
        background: rgba(135, 169, 107, 0.08) !important;
    }

    @keyframes slideDownExpand {
        from {
            opacity: 0;
            max-height: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            max-height: 1000px;
            transform: translateY(0);
        }
    }

    /* Items del dropdown */
    .dropdown-item {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem 1.2rem;
        font-size: 0.9rem;
        text-align: left;
        border-bottom: 1px solid rgba(135, 169, 107, 0.15);
        cursor: pointer;
        pointer-events: auto;
        transition: all 0.3s ease;
        background: transparent !important;
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    .dropdown-item:hover {
        padding-left: 1.8rem;
        background: rgba(135, 169, 107, 0.15) !important;
    }

    .dropdown-item > *:first-child {
        flex-shrink: 0;
        font-size: 1.5rem;
        line-height: 1;
        width: 2rem;
        filter: drop-shadow(0 2px 4px rgba(45, 90, 61, 0.2));
    }

    .dropdown-item div {
        flex: 1;
        min-width: 0;
    }

    .dropdown-item strong {
        display: block;
        margin-bottom: 0.1rem;
        font-size: 1rem;
        line-height: 1.1;
        color: var(--color-principal);
    }

    .dropdown-item small {
        display: block;
        opacity: 0.8;
        font-size: 0.8rem;
        line-height: 1.2;
        color: var(--color-secundari);
        margin-top: -1rem;
    }

    .dropdown.active {
        pointer-events: auto;
    }

    .dropdown-item a,
    .dropdown-item {
        position: relative;
        z-index: 1;
    }

    /* Logo */
    .logo-svg {
        height: 60px;
    }

    /* Hero section */
    .hero {
        padding-top: 120px;
        padding-bottom: 20px;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
        margin-bottom: 1rem;
    }

    /* Muntanyes decoratives */
    .hero::before {
        width: 350px;
        height: 126px;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 350 126"><path d="M35 126 L87.5 43.2 L140 126 Z" fill="%232d5a3d"/><path d="M105 126 L175 21.6 L245 126 Z" fill="%234a7c59"/><path d="M210 126 L262.5 54 L315 126 Z" fill="%2387a96b"/></svg>') no-repeat center center;
        background-size: contain;
    }

    .mountain-dots {
        width: 350px;
        height: 130px;
        bottom: 0;
    }

    .mountain-dots .dot:nth-child(1) {
        left: 17%;
        top: 25px;
    }

    .mountain-dots .dot:nth-child(2) {
        left: 44%;
        top: 10px;
    }

    .mountain-dots .dot:nth-child(3) {
        left: 60%;
        top: 20px;
    }

    .mountain-dots .dot:nth-child(4) {
        left: 75%;
        top: 28px;
    }

    /* Botons */
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .btn-cta-white {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    /* Features */
    .features-preview {
        padding: 2rem 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    /* CTA buttons */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: left;
    }

    /* Cookies */
    .cookie-content {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }

    .cookie-actions {
        width: 100%;
        justify-content: center;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        min-width: 120px;
    }

    .cookie-modal-content {
        padding: 2rem;
        margin: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }
}

/* ==========================================
   MÒBILS PETITS (max-width: 480px)
========================================== */
@media (max-width: 480px) {
    .nav-container {
        padding: 1rem;
    }

    .nav-menu {
        padding: 5rem 1rem 2rem 1rem;
    }

    .hero {
        padding-top: 100px;
        padding-bottom: 10px;
    }

    .features-preview {
        padding: 2rem 1rem;
    }

    .hero::before {
        width: 450px;
        height: 180px;
        bottom: -80px;
    }

    .mountain-dots {
        width: 450px;
        height: 180px;
        bottom: -80px;
    }

    .dot-blue, .dot-orange {
        width: 12px;
        height: 12px;
    }

    .dot-blue-large {
        width: 14px;
        height: 14px;
    }
}

/* ==========================================
   PANTALLES GRANS (min-width: 1200px)
========================================== */
@media (min-width: 1200px) {
    .hero {
        padding-bottom: 0;
    }
    
    .hero::before {
        bottom: 0;
        width: 600px;
        height: 220px;
    }

    .mountain-dots {
        bottom: 0;
        width: 600px;
        height: 220px;
    }
}

