/* Moved from styles/style.css to keep mobile styles isolated */
@media (max-width: 768px) {
    /* 
       MOBILE ADAPTATION (max-width: 768px)
       Vertical 3-Stripe Layout:
       1. Barra (Identity + Actions) - Auto height
       2. Dots + Counter - Fixed height 36px
       3. Slide - Flex 1 (remaining space)
    */

    /* Main Wrapper */
    #preview-container:not(.hidden) {
        display: flex !important;
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
        padding: 0;
    }

    /* Franja 1 & 2: Unified Header Container */
    .preview-unified-header {
        display: grid;
        grid-template-areas:
            "left right"
            "dots dots";
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        flex-shrink: 0;
        height: auto;
        min-height: 0;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        /* Remove forced transform/opacity to allow hidden state during generation */
        background: var(--bg);
        position: relative;
        z-index: 20;
    }

    /* Stripe 1: Barra (Left & Right) */
    .preview-unified-left {
        grid-area: left;
        display: flex;
        align-items: center;
        padding: 0 1rem;
        height: 52px;
        overflow: hidden;
    }

    .preview-unified-right {
        grid-area: right;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 0 0.75rem;
        height: 52px;
        gap: 0.5rem;
    }

    /* Stripe 2: Dots + Counter (Fixed ~36px) */
    .preview-unified-center {
        grid-area: dots;
        position: static;
        transform: none;
        height: 40px;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        pointer-events: auto;
        background: rgba(255, 255, 255, 0.03);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-group {
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
    }

    /* Stripe 3: Diapositiva (Flex: 1, min-height: 0) */
    .preview-stage {
        flex: 1;
        min-height: 0;
        width: 100%;
        overflow: hidden;
        display: flex;
        align-items: center;
        /* Center horizontally */
        justify-content: center;
        /* Center vertically */
        padding: 0;
        margin-top: 0;
        background: #0d0d0d;
        position: relative;
    }

    .preview-wrapper {
        flex: none;
        /* Let its size be determined by width and JS height */
        width: 100%;
        max-width: none;
        aspect-ratio: 16 / 9;
        /* Base aspect ratio before JS takes over */
        border-radius: 0;
        overflow: hidden;
        border: none;
        box-shadow: none;
    }

    #preview-iframe {
        width: 297mm;
        /* Match PC: fixed width to allow JS scaling */
        height: 167mm;
        border: none;
        transform-origin: top left;
    }

    /* Strict Rule: No hardcoded calc(), No absolute/fixed navigation */
    .stage-arrow {
        display: none !important;
    }

    /* Responsive adjustments */
    .preview-topic-label {
        max-width: 140px;
        font-size: 0.8rem;
    }

    .action-btn.bordered-primary {
        padding: 0.35rem 0.6rem;
        margin-left: 0.35rem;
    }

    .action-btn span {
        font-size: 0.75rem;
    }
}
