/* ===================================================================
   LAPTOP RESPONSIVE SYSTEM — UNIFIED
   TechLab3D Cotizador

   Reemplaza los breakpoints conflictivos de:
   - quotations-compact.css (reglas globales de sidebar/content)
   - styles.css (bloques 769-1366px, 993-1200px, 1201px+)

   Cubre: 1024×768, 1280×720 (DPR 1.5), 1366×768, 1440×900, 1920×1080
   NO afecta: mobile (< 768px), tablets (768px)
   =================================================================== */


/* ========================================
   LAPTOP PEQUEÑO: 769px – 1024px
   Target: 1024×768
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {

    /* ── SIDEBAR ── */
    .sidebar {
        width: 70px;
        padding: 12px 6px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar::-webkit-scrollbar       { width: 4px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.3);
        border-radius: 2px;
    }
    .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }

    .sidebar h3 {
        font-size: 0;
        padding: 0;
        margin: 0;
        height: 0;
        overflow: hidden;
        border-bottom: none;       /* elimina el borde fantasma */
    }

    .sidebar-icon {
        width: 50px;
        height: 50px;
        margin: 0 auto 12px;
    }

    .menu a {
        padding: 10px 8px;
        margin-bottom: 4px;
        justify-content: center;
    }
    .menu a i    { font-size: 1.1rem; margin-right: 0; }
    .menu a span { display: none; }

    /* ── SUBMENU TOGGLE COLLAPSED (espeja .menu a para centrado idéntico) ── */
    .has-submenu > .submenu-toggle { padding: 10px 8px; margin-bottom: 4px; justify-content: center; }
    .has-submenu > .submenu-toggle i:first-child { font-size: 1.1rem; margin-right: 0; }

    /* ── SIDEBAR EXPANDIDO ── */
    .sidebar:hover { width: 240px; }

    .sidebar:hover h3 {
        font-size: 1rem;
        height: auto;
        padding: 0.75rem;
        margin: 0 0 0.75rem 0;
        border-bottom: 1px solid var(--border-color);   /* restaura en hover */
    }

    .sidebar:hover .menu a {
        justify-content: flex-start;
        padding: 10px 12px;
    }
    .sidebar:hover .menu a i    { margin-right: 12px; }
    .sidebar:hover .menu a span { display: inline; }

    /* ── SUBMENU TOGGLE EXPANDIDO (espeja .sidebar:hover .menu a) ── */
    .sidebar:hover .has-submenu > .submenu-toggle { justify-content: flex-start; padding: 10px 12px; }
    .sidebar:hover .has-submenu > .submenu-toggle i:first-child { margin-right: 12px; }

    .submenu li a                    { padding: 8px 6px;  font-size: 0.85rem; }
    .sidebar:hover .submenu li a     { padding: 8px 12px; }

    /* ── CONTENIDO ── */
    .content {
        margin-left: 70px;
        padding: 1rem 1rem;
        transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar:hover + .content { margin-left: 240px; }

    /* ── VISTAS: ancho completo en laptops pequeños — sin centrado artificial ── */
    /* min-width:0 evita que el flex item expanda .content (flex-direction:column) */
    .view { width: 100%; min-width: 0; max-width: 100%; }

    /* ── TIPOGRAFÍA ── */
    h1, .page-title { font-size: 1.5rem; margin-bottom: 1rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 0.95rem; }

    /* ── CARDS ── */
    .glass-card { padding: 0.75rem; margin-bottom: 0.75rem; }

    /* ── FORMS ── */
    .form-control,
    .form-select {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    .btn   { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
    .btn i { font-size: 0.9rem; }

    /* ── AUDITORÍA: filtros en columna — a 1024px no caben en una fila ── */
    #auditoria-view .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    #auditoria-view .d-flex.justify-content-between.align-items-center .d-flex.gap-2 {
        flex-wrap: wrap;
        width: 100%;
    }
    #auditoria-filter-mes,
    #auditoria-filter-vendedor,
    #auditoria-filter-estado {
        width: auto !important;
        min-width: 130px;
        flex: 1 1 130px;
    }

    /* ── MODALES ── (solo modales sin clase de tamaño; modal-lg/xl los maneja index.html inline) */
    .modal-dialog:not(.modal-lg):not(.modal-xl) { max-width: 500px; margin: 1rem auto; }
    .modal-lg  { max-width: 650px; }
    .modal-xl  { max-width: 750px; }
    .modal-header  { padding: 0.75rem 1rem; }
    .modal-title   { font-size: 0.95rem; }
    .modal-body    { padding: 0.75rem 1rem; font-size: 0.85rem; max-height: calc(100vh - 200px); overflow-y: auto; }
    .modal-footer  { padding: 0.75rem 1rem; }
}


/* ========================================
   LAPTOP ESTÁNDAR: 1025px – 1366px
   Target: 1280×720 (DPR 1.5), 1366×768
   ======================================== */
@media (min-width: 1025px) and (max-width: 1366px) {

    /* ── SIDEBAR ── */
    .sidebar {
        width: 75px;
        padding: 12px 8px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar::-webkit-scrollbar       { width: 4px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.3);
        border-radius: 2px;
    }
    .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }

    .sidebar h3 {
        font-size: 0;
        padding: 0;
        margin: 0;
        height: 0;
        overflow: hidden;
        border-bottom: none;       /* elimina borde fantasma en colapsado */
    }

    .sidebar-icon {
        width: 50px;
        height: 50px;
        margin: 0 auto 12px;
    }

    .menu a {
        padding: 11px 10px;
        margin-bottom: 4px;
        justify-content: center;
    }
    .menu a i    { font-size: 1.15rem; margin-right: 0; }
    .menu a span { display: none; }

    /* ── SUBMENU TOGGLE COLLAPSED (espeja .menu a para centrado idéntico) ── */
    .has-submenu > .submenu-toggle { padding: 11px 10px; margin-bottom: 4px; justify-content: center; }
    .has-submenu > .submenu-toggle i:first-child { font-size: 1.15rem; margin-right: 0; }

    /* ── SIDEBAR EXPANDIDO ── */
    .sidebar:hover { width: 220px; }

    .sidebar:hover h3 {
        font-size: 1.05rem;
        height: auto;
        padding: 0.75rem;
        margin: 0 0 0.75rem 0;
        border-bottom: 1px solid var(--border-color);   /* restaura en hover */
    }

    .sidebar:hover .menu a {
        justify-content: flex-start;
        padding: 11px 14px;
    }
    .sidebar:hover .menu a i    { margin-right: 12px; }
    .sidebar:hover .menu a span { display: inline; }

    /* ── SUBMENU TOGGLE EXPANDIDO (espeja .sidebar:hover .menu a) ── */
    .sidebar:hover .has-submenu > .submenu-toggle { justify-content: flex-start; padding: 11px 14px; }
    .sidebar:hover .has-submenu > .submenu-toggle i:first-child { margin-right: 12px; }

    .submenu li a                    { padding: 9px 8px;  font-size: 0.85rem; }
    .sidebar:hover .submenu li a     { padding: 9px 12px; }

    /* ── CONTENIDO ── */
    .content {
        margin-left: 75px;
        padding: 1rem 1.25rem;
        transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar:hover + .content { margin-left: 220px; }

    /* ── VISTAS: ancho completo en laptops — sin centrado artificial ── */
    .view { width: 100%; min-width: 0; max-width: 100%; }

    /* ── TIPOGRAFÍA ── */
    h1, .page-title { font-size: 1.6rem; margin-bottom: 1rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.15rem; }
    h4 { font-size: 1rem; }

    /* ── CARDS ── */
    .glass-card { padding: 0.85rem; margin-bottom: 0.85rem; }

    /* ── FORMS ── */
    .form-control,
    .form-select {
        padding: 0.45rem 0.7rem;
        font-size: 0.88rem;
        min-height: 38px;
    }
    .btn   { padding: 0.45rem 0.85rem; font-size: 0.88rem; }
    .btn i { font-size: 0.95rem; }

    /* ── AUDITORÍA: filtros en fila pero que wrappean — en 1366px sí caben
       si los selects son más pequeños que los 200/220px inline originales ── */
    #auditoria-view .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    #auditoria-view .d-flex.justify-content-between.align-items-center .d-flex.gap-2 {
        flex-wrap: wrap;
    }
    #auditoria-filter-mes,
    #auditoria-filter-vendedor,
    #auditoria-filter-estado {
        width: 150px !important;
    }

    /* ── MODALES ── (modal-lg/xl gestionados por inline styles en index.html con !important) */
    .modal-dialog:not(.modal-lg):not(.modal-xl) { max-width: 600px; margin: 1rem auto; }
    .modal-lg  { max-width: 700px; }
    .modal-xl  { max-width: 850px; }
    .modal-header  { padding: 0.85rem 1.1rem; }
    .modal-title   { font-size: 1rem; }
    .modal-body    { padding: 0.85rem 1.1rem; font-size: 0.88rem; max-height: calc(100vh - 200px); overflow-y: auto; }
    .modal-footer  { padding: 0.85rem 1.1rem; }
}


/* ========================================
   LAPTOP GRANDE: 1367px – 1600px
   Target: 1440×900
   ======================================== */
@media (min-width: 1367px) and (max-width: 1600px) {

    /* ── SIDEBAR ── */
    .sidebar {
        width: 80px;
        padding: 15px 10px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar::-webkit-scrollbar       { width: 5px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.35);
        border-radius: 3px;
    }
    .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.6); }

    .sidebar h3 {
        font-size: 0;
        padding: 0;
        margin: 0;
        height: 0;
        overflow: hidden;
        border-bottom: none;
    }

    .sidebar-icon { width: 50px; height: 50px; margin: 0 auto 16px; }

    .menu a {
        padding: 12px 11px;
        margin-bottom: 6px;
        justify-content: center;
    }
    .menu a i    { font-size: 1.2rem; margin-right: 0; }
    .menu a span { display: none; }

    /* ── SUBMENU TOGGLE COLLAPSED (espeja .menu a para centrado idéntico) ── */
    .has-submenu > .submenu-toggle { padding: 12px 11px; margin-bottom: 6px; justify-content: center; }
    .has-submenu > .submenu-toggle i:first-child { font-size: 1.2rem; margin-right: 0; }

    /* ── SIDEBAR EXPANDIDO ── */
    .sidebar:hover { width: 280px; }

    .sidebar:hover h3 {
        font-size: 1.1rem;
        height: auto;
        padding: 0.75rem;
        margin: 0 0 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar:hover .menu a {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    .sidebar:hover .menu a i    { margin-right: 12px; }
    .sidebar:hover .menu a span { display: inline; }

    /* ── SUBMENU TOGGLE EXPANDIDO (espeja .sidebar:hover .menu a) ── */
    .sidebar:hover .has-submenu > .submenu-toggle { justify-content: flex-start; padding: 12px 16px; }
    .sidebar:hover .has-submenu > .submenu-toggle i:first-child { margin-right: 12px; }

    .submenu li a                    { padding: 10px 10px; font-size: 0.87rem; }
    .sidebar:hover .submenu li a     { padding: 10px 14px; }

    /* ── CONTENIDO ── */
    .content {
        margin-left: 80px;
        padding: 1.25rem 1.5rem;
        transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar:hover + .content { margin-left: 280px; }

    /* ── VISTAS: CONTENEDOR CENTRADO (1440×900) ──
       max-width 1200px → ~56px margen c/lado en 1440px collapsed ← estético.
       Vistas con tablas anchas (#auditoria-view) tienen max-width:none propio.
       #quotation-view tiene max-width:1200px propio (coincide aquí, respeta el límite en desktop).
       min-width:0 evita que flex items en .content columna expandan el contenedor. */
    .view { max-width: 1200px; width: 100%; min-width: 0; margin-left: auto; margin-right: auto; }

    /* ── TIPOGRAFÍA ── */
    h1, .page-title { font-size: 1.7rem; margin-bottom: 1.1rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1.05rem; }

    /* ── CARDS ── */
    .glass-card { padding: 1rem; margin-bottom: 1rem; }

    /* ── FORMS ── */
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    .btn   { padding: 0.5rem 0.95rem; font-size: 0.9rem; }
    .btn i { font-size: 1rem; }

    /* ── AUDITORÍA: filtros — en 1367-1600px los selects con inline 200/220px
       pueden ser más anchos que el espacio disponible si el viewport es ~1400px ── */
    #auditoria-view .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    #auditoria-view .d-flex.justify-content-between.align-items-center .d-flex.gap-2 {
        flex-wrap: wrap;
    }
    #auditoria-filter-mes,
    #auditoria-filter-vendedor,
    #auditoria-filter-estado {
        width: 160px !important;
    }

    /* ── MODALES ── */
    .modal-dialog:not(.modal-lg):not(.modal-xl) { max-width: 650px; margin: 1.5rem auto; }
    .modal-lg  { max-width: 780px; }
    /* modal-xl: deja que Bootstrap maneje su 1140px a 1440px */
    .modal-header  { padding: 1rem 1.25rem; }
    .modal-title   { font-size: 1.1rem; }
    .modal-body    { padding: 1rem 1.25rem; font-size: 0.9rem; max-height: calc(100vh - 220px); overflow-y: auto; }
    .modal-footer  { padding: 1rem 1.25rem; }
}


/* ========================================
   DESKTOP: 1601px+
   Target: 1920×1080 y superiores
   ======================================== */
@media (min-width: 1601px) {

    /* ── SIDEBAR ── */
    .sidebar {
        width: 80px;
        padding: 15px 12px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar::-webkit-scrollbar       { width: 5px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.35);
        border-radius: 3px;
    }
    .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.6); }

    .sidebar h3 {
        font-size: 0;
        padding: 0;
        margin: 0;
        height: 0;
        overflow: hidden;
        border-bottom: none;
    }

    .sidebar-icon { width: 50px; height: 50px; margin: 0 auto 16px; }

    .menu a {
        padding: 13px 12px;
        margin-bottom: 6px;
        justify-content: center;
    }
    .menu a i    { font-size: 1.25rem; margin-right: 0; }
    .menu a span { display: none; }

    /* ── SUBMENU TOGGLE COLLAPSED (espeja .menu a para centrado idéntico) ── */
    .has-submenu > .submenu-toggle { padding: 13px 12px; margin-bottom: 6px; justify-content: center; }
    .has-submenu > .submenu-toggle i:first-child { font-size: 1.25rem; margin-right: 0; }

    /* ── SIDEBAR EXPANDIDO ── */
    .sidebar:hover { width: 280px; }

    .sidebar:hover h3 {
        font-size: 1.15rem;
        height: auto;
        padding: 0.75rem;
        margin: 0 0 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar:hover .menu a {
        justify-content: flex-start;
        padding: 13px 16px;
    }
    .sidebar:hover .menu a i    { margin-right: 12px; }
    .sidebar:hover .menu a span { display: inline; }

    /* ── SUBMENU TOGGLE EXPANDIDO (espeja .sidebar:hover .menu a) ── */
    .sidebar:hover .has-submenu > .submenu-toggle { justify-content: flex-start; padding: 13px 16px; }
    .sidebar:hover .has-submenu > .submenu-toggle i:first-child { margin-right: 12px; }

    .submenu li a                    { padding: 11px 12px; font-size: 0.9rem; }
    .sidebar:hover .submenu li a     { padding: 11px 16px; }

    /* ── CONTENIDO ── */
    .content {
        margin-left: 80px;
        padding: 1.5rem 2rem;
        transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar:hover + .content { margin-left: 280px; }

    /* ── VISTAS: CONTENEDOR CENTRADO (1920×1080) ──
       1400px view → ~184px margen c/lado collapsed ← bien centrado.
       #quotation-view tiene su propio max-width:1200px (formulario no debe estirarse a 1400px).
       #auditoria-view tiene max-width:none (tabla de 14 cols necesita todo el ancho).
       min-width:0 evita expansión del flex item en .content columna. */
    .view { max-width: 1400px; width: 100%; min-width: 0; margin-left: auto; margin-right: auto; }

    /* ── TIPOGRAFÍA ── */
    h1, .page-title { font-size: 1.8rem; margin-bottom: 1.25rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }

    /* ── CARDS ── */
    .glass-card { padding: 1.25rem; margin-bottom: 1.25rem; }

    /* ── FORMS ── */
    .form-control,
    .form-select {
        padding: 0.55rem 0.85rem;
        font-size: 0.95rem;
        min-height: 42px;
    }
    .btn   { padding: 0.55rem 1.1rem; font-size: 0.95rem; }
    .btn i { font-size: 1.05rem; }

    /* ── MODALES ── */
    .modal-dialog:not(.modal-lg):not(.modal-xl) { max-width: 750px; margin: 2rem auto; }
    .modal-lg  { max-width: 900px; }
    /* modal-xl: Bootstrap maneja 1140px en FullHD — correcto sin límite */
    .modal-header  { padding: 1.25rem 1.5rem; }
    .modal-title   { font-size: 1.25rem; }
    .modal-body    { padding: 1.25rem 1.5rem; font-size: 0.95rem; max-height: calc(100vh - 250px); overflow-y: auto; }
    .modal-footer  { padding: 1.25rem 1.5rem; }
}
