/* ══════════════════════════════════════════════════
   mobile.css — Estilos para pantallas < 1024px
   Se carga con media="screen and (max-width: 1023px)"
   ══════════════════════════════════════════════════ */

/* ── Bloquear scroll global ── */
html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ── Layout principal: columna vertical, altura fija ── */
main {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ══ ZONA SUPERIOR: Editor SVG (55% de la pantalla) ══ */
#main-editor-area {
    width: 100%;
    height: 55vh;
    height: 55dvh;
    min-height: 0;
    flex: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    order: 1;
}

/* ── Cabecera compacta ── */
header {
    padding: 0.4rem 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}
header h1 {
    font-size: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem !important;
}
header #logo-marca {
    height: 1.8rem;
}

/* ── Editores: sin márgenes laterales ── */
#area-editores {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0.25rem 0;
    flex: none;
    min-height: 0;
    overflow: visible;
}
#area-editores > div {
    width: 100%;
    max-width: none;
    padding: 0 0.5rem;
}
#area-editores h2 {
    margin-bottom: 0.25rem;
    font-size: 11px;
}
#canvas-simulador {
    max-width: 80% !important;
    aspect-ratio: 1;
    max-height: 100%;
    margin: auto;
}
#canvas-cenefa {
    max-width: 100% !important;
    height: auto !important;
    max-height: 100%;
    margin: auto;
}

/* ── Pared oculta en móvil (no cabe) ── */
#area-pared {
    display: none;
}

/* ══ ZONA INFERIOR: Panel (catálogo + colores) (45% de la pantalla) ══ */
aside {
    width: 100% !important;
    height: 45vh !important;
    height: 45dvh !important;
    flex: none !important;
    border-right: none !important;
    border-left: none !important;
    border-top: 1px solid #d1d5db;
    border-bottom: none !important;
    order: 2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Pestañas móviles ── */
#mobile-tabs {
    display: flex !important;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    gap: 0;
}
.mobile-tab {
    flex: 1;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    background: #f9fafb;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-tab:active {
    background: #f3f4f6;
}
.mobile-tab-activo {
    color: var(--color-texto, #065f46);
    background: #fff;
    border-bottom-color: var(--color-principal, #059669);
}

/* ── Tipo de producto: barra compacta ── */
aside > div:first-child {
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
}
aside > div:first-child label {
    display: none; /* Ocultar "1. Tipo de producto" → los botones son autoexplicativos */
}
aside > div:first-child .flex {
    gap: 0.15rem;
}
aside > div:first-child button {
    font-size: 0.85rem;
    padding: 0.5rem 0.4rem;
}

/* ── Panel catálogo + colores: apilados, exclusivos por tab ── */
aside .flex-row {
    flex-direction: row !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Panel modelos: ancho completo cuando visible ── */
#panel-modelos {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-right: none !important;
    border-left: none !important;
    border-bottom: none !important;
}
#panel-modelos > div {
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
#panel-modelos label {
    display: none; /* Redundante con la pestaña activa */
}

/* ── Catálogo: grid 3 columnas compacto ── */
#catalogo-items {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

/* ── Panel colores: ancho completo cuando visible (oculto por defecto) ── */
#panel-colores {
    display: none;
    width: 100% !important;
    flex: 1;
    min-width: 0;
    border-left: none !important;
    box-shadow: none !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#panel-colores label {
    display: none; /* Redundante con la pestaña activa */
}

/* ── Modal variantes en móvil: adaptación táctil ── */
#selector-variantes {
    width: 94vw;
    max-width: none;
    padding: 1rem;
    margin: 0.35rem 0;
}
.sv-titulo {
    font-size: 13px;
}
.sv-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.sv-opcion {
    padding: 10px;
}
.sv-opcion-img {
    width: 110px;
    height: 110px;
}
.sv-opcion-nombre {
    font-size: 12px;
}

#panel-colores #paleta {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
}

/* ── Botón presupuesto fijo abajo ── */
.mobile-presupuesto-footer {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 -2px 12px 0 #0001;
    padding: 0.25rem 0.5rem 0.25rem 0.5rem;
    width: 100vw;
    max-width: 100vw;
}

/* Padding extra para que el botón fijo no tape la última línea de colores */
#panel-colores {
    padding-bottom: 4.5rem !important;
}

/* ── Variantes ── */
#selector-variantes {
    margin-top: 0.35rem;
    padding: 0.35rem;
}

/* ── Panel Vista (móvil) ── */
#panel-vista {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem 0;
    background: #f3f4f6;
}

#pared-movil-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 0;
}

#grid-placas-movil {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    line-height: 0;
}

#fila-cenefa-pared-movil {
    display: flex;
    flex-direction: row;
    gap: 0;
    line-height: 0;
}

#grid-placas-movil svg,
#fila-cenefa-pared-movil svg {
    display: block;
}
