/* ============================================================================
   MOBILE SECTIONS FIX v1.0 — Arreglo crítico secciones 02 (Web Apps) y 03 (Diseño)
   ============================================================================
   PROBLEMA: En móvil, las secciones #web-apps y #design no se renderizaban
   porque algunos overrides previos las ocultaban (display:none) o las
   contenían en grids fijos que colapsaban a 0px de ancho.
   ============================================================================ */

/* ============================ FORZAR VISIBILIDAD EN MÓVIL ============================ */
@media (max-width: 900px) {
    /* Sección 02 — Web Apps siempre visible y con ancho útil */
    #web-apps,
    #web-apps .section-container,
    #web-apps .webapp-direct-block,
    #web-apps #webappGallery,
    #web-apps .webapp-gallery,
    #web-apps .webapp-big-buttons {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Bloque WA flexibilizado para móvil */
    #web-apps .wa-block {
        display: block !important;
        width: 100% !important;
        margin-bottom: 14px;
    }

    /* Botón grande móvil: stack vertical, touch-friendly */
    #web-apps .wa-big-btn {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100% !important;
        min-height: 76px;
        padding: 14px 16px !important;
        border-radius: 14px;
        box-sizing: border-box;
        flex-wrap: nowrap;
    }

    #web-apps .wa-btn-icon {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 12px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #web-apps .wa-btn-content {
        flex: 1 1 auto;
        min-width: 0;
        display: flex !important;
        flex-direction: column;
        gap: 2px;
    }

    #web-apps .wa-btn-title {
        font-size: 14.5px !important;
        font-weight: 700;
        line-height: 1.2;
        display: block !important;
    }

    #web-apps .wa-btn-subtitle {
        font-size: 11.5px !important;
        opacity: 0.85;
        line-height: 1.25;
        display: block !important;
    }

    #web-apps .wa-btn-right {
        flex: 0 0 auto;
        display: flex !important;
        align-items: center;
        gap: 8px;
    }

    #web-apps .wa-btn-count {
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.12);
    }

    #web-apps .wa-btn-arrow { font-size: 13px; }

    /* Grid de apps al expandir: 1 col en móvil pequeño, 2 col en tablet */
    #web-apps .wa-apps-grid {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 10px;
        padding: 4px 0;
        width: 100% !important;
    }

    #web-apps .wa-apps-grid[hidden] { display: none !important; }

    #web-apps .wa-app-card {
        display: flex !important;
        flex-direction: row;
        gap: 10px;
        padding: 12px;
        border-radius: 12px;
        width: 100% !important;
        min-height: 80px;
        box-sizing: border-box;
        text-decoration: none;
    }

    #web-apps .wa-app-icon {
        flex: 0 0 40px;
        width: 40px; height: 40px;
        font-size: 16px;
        border-radius: 10px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #web-apps .wa-app-body {
        flex: 1 1 auto;
        min-width: 0;
        display: flex !important;
        flex-direction: column;
        gap: 2px;
    }

    #web-apps .wa-app-name {
        font-size: 13.5px;
        font-weight: 700;
        line-height: 1.25;
    }

    #web-apps .wa-app-url,
    #web-apps .wa-app-desc {
        font-size: 11px;
        line-height: 1.3;
        opacity: 0.78;
    }

    #web-apps .wa-app-foot {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-top: 4px;
        font-size: 10.5px;
    }

    /* ============================ SECCIÓN 03 — DISEÑO GRÁFICO ============================ */
    #design,
    #design .section-container,
    #design .accordion-block,
    #design #designAccordion,
    #design .accordion-toggle,
    #design .accordion-panel,
    #design .design-gallery-viewer,
    #design #designGrid,
    #design .design-tools-showcase {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Tools chips horizontalmente scrollables */
    #design .design-tools-showcase {
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        margin-bottom: 16px;
        padding: 0 4px;
    }

    #design .design-tool-chip {
        font-size: 11.5px;
        padding: 6px 11px;
        border-radius: 999px;
        flex: 0 0 auto;
    }

    /* Toggle accordion premium */
    #design .accordion-premium-toggle {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100% !important;
        min-height: 78px;
        padding: 14px 16px !important;
        border-radius: 14px;
        box-sizing: border-box;
        text-align: left;
    }

    #design .acc-left {
        display: flex !important;
        align-items: center;
        gap: 12px;
        flex: 1 1 auto;
        min-width: 0;
    }

    #design .acc-icon-premium {
        flex: 0 0 46px;
        width: 46px; height: 46px;
        font-size: 18px;
        border-radius: 11px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #design .acc-label {
        display: flex !important;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    #design .acc-label strong {
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
        display: block !important;
    }

    #design .acc-label small {
        font-size: 11.5px;
        line-height: 1.25;
        opacity: 0.85;
    }

    /* Grid de diseños: 2 columnas en móvil */
    #design #designGrid,
    #design .design-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 0;
        width: 100% !important;
    }

    #design .design-card-pro {
        position: relative;
        aspect-ratio: 1 / 1;
        border-radius: 10px;
        overflow: hidden;
        display: block !important;
        width: 100% !important;
    }

    #design .design-card-pro img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    #design .design-card-pro-overlay {
        position: absolute;
        inset: auto 0 0 0;
        padding: 8px;
        background: linear-gradient(180deg, transparent, rgba(0,0,0,0.85));
        font-size: 10px;
    }

    #design .design-card-pro-overlay h4 {
        font-size: 11px !important;
        margin: 0 0 2px;
        line-height: 1.2;
        color: #fff !important;
    }

    #design .design-card-pro-overlay p {
        font-size: 9.5px !important;
        opacity: 0.85;
        margin: 0;
        color: #fff !important;
    }

    #design .design-tools-tag-pro {
        display: none; /* Ocultar en móvil para mantener limpio */
    }
}

/* ============================ MÓVIL PEQUEÑO (≤600px) ============================ */
@media (max-width: 600px) {
    #web-apps .section-container,
    #design .section-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    #design #designGrid {
        gap: 6px;
    }

    /* Si hay más de 2 elementos por fila se ve mejor */
    #web-apps .wa-big-btn {
        padding: 12px 14px !important;
        min-height: 72px;
    }
}

/* ============================ MÓVIL EXTRA PEQUEÑO (≤380px) ============================ */
@media (max-width: 380px) {
    #design #designGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    #web-apps .wa-btn-title { font-size: 13.5px !important; }
    #web-apps .wa-btn-subtitle { font-size: 11px !important; }
}

/* ============================ ANULAR DISPLAY:NONE PREVIOS ============================ */
/* Estos overrides previos podían ocultar las secciones en móvil */
@media (max-width: 900px) {
    .webapp-direct-block,
    .accordion-block.accordion-premium,
    .accordion-premium-dark {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* El menú móvil antiguo SIEMPRE oculto (era el que duplicaba) */
    .webapp-mobile-menu,
    #webappMobileMenu {
        display: none !important;
    }
}
