/**
 * Editor Visual 2.0 - Estilos Responsivos
 * Adaptações para diferentes tamanhos de tela
 */

/* ========================================
   CANVAS VIEWPORTS
======================================== */

/* Desktop (Padrão) */
.mve2-canvas[data-viewport="desktop"] {
    width: 100%;
    max-width: none;
    min-height: 100%;
}

/* Tablet */
.mve2-canvas[data-viewport="tablet"] {
    width: 768px;
    min-height: 1024px;
    margin: 0 auto;
}

/* Mobile */
.mve2-canvas[data-viewport="mobile"] {
    width: 375px;
    min-height: 667px;
    margin: 0 auto;
}

/* ========================================
   TABLET BREAKPOINT
======================================== */
@media (max-width: 1024px) {
    /* Ajustar larguras das sidebars */
    :root {
        --mve2-sidebar-width: 260px;
        --mve2-inspector-width: 300px;
    }
    
    /* Grid de elementos */
    .mve2-elements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Modal de colunas */
    .mve2-columns-presets {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   MOBILE BREAKPOINT
======================================== */
@media (max-width: 768px) {
    /* Ocultar sidebars por padrão */
    .mve2-sidebar {
        position: fixed;
        top: var(--mve2-header-height);
        bottom: calc(var(--mve2-footer-height) + var(--mve2-pages-bar-height));
        width: 85%;
        max-width: 320px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform var(--mve2-transition);
        box-shadow: var(--mve2-shadow-xl);
    }
    
    .mve2-sidebar.mve2-sidebar-left.active {
        transform: translateX(0);
    }
    
    .mve2-sidebar.mve2-sidebar-right {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    
    .mve2-sidebar.mve2-sidebar-right.active {
        transform: translateX(0);
    }
    
    /* Backdrop para fechar sidebars */
    .mve2-sidebar-backdrop {
        display: none;
        position: fixed;
        top: var(--mve2-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .mve2-sidebar-backdrop.active {
        display: block;
    }
    
    /* Header mobile */
    .mve2-header {
        padding: 0 12px;
    }
    
    .mve2-header-left {
        gap: 8px;
    }
    
    .mve2-logo span {
        display: none;
    }
    
    .mve2-viewport-indicator {
        display: none;
    }
    
    .mve2-btn span {
        display: none;
    }
    
    .mve2-btn {
        padding: 8px 12px;
    }
    
    /* Adicionar botões de toggle para sidebars */
    .mve2-mobile-toggle {
        display: flex;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        background: var(--mve2-bg-panel);
        border: none;
        border-radius: var(--mve2-radius);
        color: var(--mve2-text-muted);
        cursor: pointer;
    }
    
    .mve2-mobile-toggle:hover {
        background: var(--mve2-bg-hover);
        color: var(--mve2-text);
    }
    
    /* Canvas em mobile */
    .mve2-canvas-wrapper {
        padding: 10px;
    }
    
    .mve2-canvas[data-viewport="desktop"],
    .mve2-canvas[data-viewport="tablet"],
    .mve2-canvas[data-viewport="mobile"] {
        width: 100%;
        max-width: none;
    }
    
    /* Footer mobile */
    .mve2-footer {
        padding: 0 12px;
    }
    
    .mve2-navigator {
        display: none;
    }
    
    /* Modal em mobile */
    .mve2-modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    .mve2-columns-presets {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mve2-icons-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    /* Pages bar mobile */
    .mve2-pages-bar {
        padding: 0 8px;
    }
    
    .mve2-page-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ========================================
   SMALL MOBILE
======================================== */
@media (max-width: 480px) {
    .mve2-header {
        height: 50px;
    }
    
    .mve2-close-btn,
    .mve2-mobile-toggle,
    .mve2-btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .mve2-viewport-controls {
        padding: 2px;
    }
    
    .mve2-viewport-btn {
        width: 30px;
        height: 28px;
    }
    
    .mve2-columns-presets {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .mve2-column-preset {
        padding: 12px 8px;
    }
    
    .mve2-icons-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Spacing visual simplificado */
    .mve2-spacing-visual {
        grid-template-columns: 40px 1fr 40px;
        grid-template-rows: 30px 50px 30px;
    }
}

/* ========================================
   LANDSCAPE MOBILE
======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .mve2-header {
        height: 44px;
    }
    
    .mve2-footer {
        height: 36px;
    }
    
    .mve2-pages-bar {
        height: 40px;
    }
    
    .mve2-sidebar {
        top: 44px;
        bottom: 76px;
    }
}

/* ========================================
   LARGE SCREENS
======================================== */
@media (min-width: 1920px) {
    :root {
        --mve2-sidebar-width: 320px;
        --mve2-inspector-width: 380px;
    }
    
    .mve2-elements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mve2-icons-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

/* ========================================
   ULTRA-WIDE SCREENS
======================================== */
@media (min-width: 2560px) {
    :root {
        --mve2-sidebar-width: 360px;
        --mve2-inspector-width: 420px;
    }
    
    .mve2-editor {
        font-size: 15px;
    }
    
    .mve2-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ========================================
   DARK MODE ADJUSTMENTS
======================================== */
@media (prefers-color-scheme: light) {
    /* O editor é dark por padrão, mas podemos ajustar
       se necessário para melhor contraste */
}

/* ========================================
   HIGH CONTRAST MODE
======================================== */
@media (prefers-contrast: high) {
    .mve2-editor {
        --mve2-border: #666;
        --mve2-text: #fff;
        --mve2-text-muted: #ccc;
    }
    
    .mve2-btn-primary,
    .mve2-btn-gradient {
        background: var(--mve2-primary);
    }
}

/* ========================================
   REDUCED MOTION
======================================== */
@media (prefers-reduced-motion: reduce) {
    .mve2-editor,
    .mve2-editor * {
        transition: none !important;
        animation: none !important;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .mve2-editor {
        display: none !important;
    }
}
