/* ===================================================================
   ESTILOS COMPACTOS PARA TABLA DE COTIZACIONES
   Optimizado específicamente para laptops pequeñas (< 1366px)
   =================================================================== */

/* Aplicar solo en pantallas menores a 1366px */
@media (max-width: 1366px) {

    /* SIDEBAR - Más compacto */
    .sidebar {
        width: 70px !important;
        padding: 0.5rem 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* Scrollbar del sidebar más delgado */
    .sidebar::-webkit-scrollbar {
        width: 4px !important;
    }

    .sidebar::-webkit-scrollbar-track {
        background: transparent !important;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3) !important;
        border-radius: 2px !important;
    }

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5) !important;
    }

    /* Logo/icono del sidebar */
    .sidebar .sidebar-icon {
        padding: 0.25rem !important;
        margin-bottom: 0.5rem !important;
    }

    .sidebar .sidebar-icon i {
        font-size: 1.5rem !important;
    }

    .sidebar h3 {
        font-size: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    .sidebar .menu a {
        padding: 0.4rem 0.5rem !important;
        justify-content: center !important;
        margin-bottom: 4px !important;
    }

    .sidebar .menu a span {
        display: none !important;
    }

    .sidebar .menu a i {
        margin-right: 0 !important;
        font-size: 1.1rem !important;
    }

    /* Al hacer hover, expandir */
    .sidebar:hover {
        width: 240px !important;
    }

    .sidebar:hover h3 {
        font-size: 1.1rem !important;
        height: auto !important;
        padding: 0.5rem !important;
    }

    .sidebar:hover .menu a {
        padding: 0.6rem 1rem !important;
        justify-content: flex-start !important;
    }

    .sidebar:hover .menu a span {
        display: inline !important;
    }

    .sidebar:hover .menu a i {
        margin-right: 12px !important;
    }

    /* CONTENEDOR PRINCIPAL - Usar TODO el ancho disponible */
    .content {
        padding-left: 80px !important;
        padding-right: 0.5rem !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .sidebar:hover + .content {
        padding-left: 250px !important;
    }

    /* GLASS CARD - Reducir padding */
    #quotations-view .glass-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* TABLA - Asegurar que use todo el ancho */
    #quotations-view .table-responsive {
        overflow-x: auto !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #quotations-list table,
    #recent-quotations-list table {
        width: 100% !important;
        table-layout: fixed !important;
        font-size: 0.75rem !important;
    }

    /* HEADERS Y CELDAS - Padding más cómodo */
    #quotations-list table th,
    #quotations-list table td,
    #recent-quotations-list table th,
    #recent-quotations-list table td {
        padding: 0.9rem 0.75rem !important;
        vertical-align: middle !important;
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* COLUMNAS ESPECÍFICAS - Anchos optimizados */

    /* Columna 1: KommoID - 85px */
    #quotations-list table th:nth-child(1),
    #quotations-list table td:nth-child(1),
    #recent-quotations-list table th:nth-child(1),
    #recent-quotations-list table td:nth-child(1) {
        width: 85px !important;
        max-width: 85px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 0.92rem !important;
    }

    /* Columna 2: Fecha - 95px */
    #quotations-list table th:nth-child(2),
    #quotations-list table td:nth-child(2),
    #recent-quotations-list table th:nth-child(2),
    #recent-quotations-list table td:nth-child(2) {
        width: 95px !important;
        max-width: 95px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 0.92rem !important;
    }

    /* Columna 3: Nombre del Proyecto - Flexible 15% */
    #quotations-list table th:nth-child(3),
    #quotations-list table td:nth-child(3),
    #recent-quotations-list table th:nth-child(3),
    #recent-quotations-list table td:nth-child(3) {
        width: 15% !important;
        min-width: 90px !important;
        max-width: 140px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Columna 4: Cliente - Flexible 15% */
    #quotations-list table th:nth-child(4),
    #quotations-list table td:nth-child(4),
    #recent-quotations-list table th:nth-child(4),
    #recent-quotations-list table td:nth-child(4) {
        width: 15% !important;
        min-width: 80px !important;
        max-width: 120px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Columna 5: Vendedor - Flexible 15% */
    #quotations-list table th:nth-child(5),
    #quotations-list table td:nth-child(5),
    #recent-quotations-list table th:nth-child(5),
    #recent-quotations-list table td:nth-child(5) {
        width: 15% !important;
        min-width: 80px !important;
        max-width: 110px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Columna 6: Total - 100px */
    #quotations-list table th:nth-child(6),
    #quotations-list table td:nth-child(6),
    #recent-quotations-list table th:nth-child(6),
    #recent-quotations-list table td:nth-child(6) {
        width: 100px !important;
        max-width: 100px !important;
        text-align: right !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        font-size: 0.92rem !important;
    }

    /* Columna 7: ClickUp Task - 100px */
    #quotations-list table th:nth-child(7),
    #quotations-list table td:nth-child(7),
    #recent-quotations-list table th:nth-child(7),
    #recent-quotations-list table td:nth-child(7) {
        width: 100px !important;
        max-width: 100px !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }

    /* Columna 8: Acciones - 150px */
    #quotations-list table th:nth-child(8),
    #quotations-list table td:nth-child(8),
    #recent-quotations-list table th:nth-child(8),
    #recent-quotations-list table td:nth-child(8) {
        width: 150px !important;
        max-width: 150px !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    /* BOTONES - Más grandes y visibles */
    #quotations-list .btn-group,
    #recent-quotations-list .btn-group {
        gap: 3px !important;
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    #quotations-list .btn,
    #recent-quotations-list .btn {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
        border-width: 1px !important;
        min-width: 34px !important;
        line-height: 1.3 !important;
    }

    #quotations-list .btn i,
    #recent-quotations-list .btn i {
        font-size: 0.9rem !important;
        margin: 0 !important;
    }

    /* BADGES - Más grandes */
    #quotations-list .badge,
    #recent-quotations-list .badge {
        font-size: 0.8rem !important;
        padding: 0.35em 0.6em !important;
        white-space: nowrap !important;
    }

    /* FILTROS - Más compactos */
    #quotations-view .form-control,
    #quotations-view .form-select {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    #quotations-view .btn {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    /* HEADERS DE TABLA - Espaciado generoso */
    #quotations-list thead th,
    #recent-quotations-list thead th {
        padding-top: 0.95rem !important;
        padding-bottom: 0.95rem !important;
        font-weight: 600 !important;
        font-size: 0.93rem !important;
        background: rgba(99, 102, 241, 0.1) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
    }

    /* FILAS - Agregar un poco de espacio entre filas */
    #quotations-list tbody tr,
    #recent-quotations-list tbody tr {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    #quotations-list tbody tr:hover,
    #recent-quotations-list tbody tr:hover {
        background: rgba(99, 102, 241, 0.05) !important;
    }

    /* THEME SELECTOR - Más compacto */
    .theme-dropdown {
        padding: 0.35rem 0.75rem !important;
        gap: 0.5rem !important;
    }

    #theme-selector {
        max-width: 110px !important;
        font-size: 0.75rem !important;
        padding: 0.3rem 0.5rem !important;
    }

    .user-info {
        font-size: 0.75rem !important;
    }

    .user-info i {
        font-size: 0.9rem !important;
    }

    /* PRODUCTION MODE SWITCH - Más compacto */
    #production-mode-switch-container {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    #production-mode-switch-container .form-check-input {
        width: 2em !important;
        height: 1em !important;
    }

    #production-mode-label {
        font-size: 0.75rem !important;
    }
}

/* PANTALLAS MUY PEQUEÑAS (< 1200px) - Optimizaciones extra */
@media (max-width: 1200px) {

    /* Sidebar aún más compacto */
    .sidebar {
        width: 60px !important;
    }

    .sidebar .menu a {
        padding: 0.35rem 0.4rem !important;
        margin-bottom: 3px !important;
    }

    .sidebar .menu a i {
        font-size: 1rem !important;
    }

    /* Reducir aún más el contenedor */
    .content {
        padding-left: 70px !important;
        padding-right: 0.25rem !important;
    }

    /* Ajustar columnas de nombre para pantallas pequeñas */
    #quotations-list table th:nth-child(3),
    #quotations-list table td:nth-child(3),
    #quotations-list table th:nth-child(4),
    #quotations-list table td:nth-child(4),
    #quotations-list table th:nth-child(5),
    #quotations-list table td:nth-child(5),
    #recent-quotations-list table th:nth-child(3),
    #recent-quotations-list table td:nth-child(3),
    #recent-quotations-list table th:nth-child(4),
    #recent-quotations-list table td:nth-child(4),
    #recent-quotations-list table th:nth-child(5),
    #recent-quotations-list table td:nth-child(5) {
        max-width: 110px !important;
        font-size: 0.8rem !important;
    }

    /* Padding de celdas para pantallas pequeñas */
    #quotations-list table th,
    #quotations-list table td,
    #recent-quotations-list table th,
    #recent-quotations-list table td {
        padding: 0.55rem 0.4rem !important;
    }

    /* Botones más pequeños pero legibles */
    #quotations-list .btn,
    #recent-quotations-list .btn {
        padding: 0.25rem 0.3rem !important;
        font-size: 0.7rem !important;
        min-width: 28px !important;
    }

    /* Acciones compactas */
    #quotations-list table th:nth-child(8),
    #quotations-list table td:nth-child(8),
    #recent-quotations-list table th:nth-child(8),
    #recent-quotations-list table td:nth-child(8) {
        width: 130px !important;
        max-width: 130px !important;
    }
}
