/* ===== IMPORTACIÓN DE FUENTES ===== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== VARIABLES CSS ===== */
:root {
    /* Colores principales */
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-secondary: #2c3e50;
    --color-secondary-dark: #34495e;
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-info: #17a2b8;
    
    /* Colores neutros */
    --color-light: #f8f9fa;
    --color-gray: #6c757d;
    --color-gray-dark: #343a40;
    --color-border: #e9ecef;
    --color-border-light: #dee2e6;
    
    /* Tipografía */
    --font-family: 'Roboto', sans-serif;
    --font-family-mono: 'Roboto Mono', monospace;
    --font-family-inter: 'Inter', sans-serif;
    
    /* Espaciado */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-xxl: 24px;
    
    /* Bordes */
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 12px;
}

/* ===== RESET Y ESTILOS BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
    overflow-x: hidden;
}

.reporte-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== HEADER ===== */
.module-header {
    flex-shrink: 0;
    padding: 12px 16px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid var(--color-border);
    margin-bottom: 0;
}

.module-title {
    font-size: 18px;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 600;
}

.module-title i {
    color: var(--color-primary);
}

/* ===== CARD GENERAL ===== */
.card {
    background: white;
    border-radius: var(--border-radius-xl);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-border);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
}

.card-header h2 {
    font-size: 16px;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin: 0;
}

/* ===== BUSQUEDA STICKY ===== */
.sticky-search {
    position: sticky;
    top: 16px;
    z-index: 100;
    flex-shrink: 0;
    margin-top: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
    min-height: 76px; /* Altura mínima para alineación */
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    height: 20px;
}

.filter-label i {
    color: var(--color-gray);
    font-size: 14px;
}

.filter-field {
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 10px 12px;
    font-size: 13px;
    background: white;
    transition: all 0.3s ease;
    width: 100%;
    font-family: var(--font-family);
    height: 40px;
    box-sizing: border-box;
    line-height: 1.2;
}

.filter-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-field::placeholder {
    color: #adb5bd;
    font-size: 12px;
}

/* ===== SELECT CON UNA SOLA FLECHA ===== */
.select-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* ===== SUGERENCIAS DE PLACAS ===== */
.placa-container {
    position: relative;
    flex: 1;
}

.sugerencias-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 4px;
}

.sugerencia-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family-mono);
    font-size: 13px;
}

.sugerencia-item:last-child {
    border-bottom: none;
}

.sugerencia-item:hover {
    background-color: #f0f7ff;
}

.sugerencia-item i {
    color: var(--color-primary);
    font-size: 11px;
}

/* ===== BOTONES ALINEADOS ===== */
.button-group {
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.button-group .filter-label {
    visibility: hidden;
    height: 20px;
    margin: 0;
    padding: 0;
}

.button-container {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    height: 40px;
    width: 100%;
}

.btn-primary, .btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    min-width: 120px;
    height: 40px;
    white-space: nowrap;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--color-gray-dark);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-light);
    border-color: var(--color-border-light);
    transform: translateY(-2px);
}

/* ===== ESTADÍSTICAS STICKY ===== */
.sticky-stats {
    position: sticky;
    top: 180px;
    z-index: 90;
    flex-shrink: 0;
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-secondary);
    line-height: 1;
    margin-bottom: 4px;
    font-family: var(--font-family-mono);
}

.stat-label {
    font-size: 11px;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ===== PANEL DE RESULTADOS ===== */
.results-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 0;
}

.table-wrapper {
    flex: 1;
    min-height: 0;
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
}

/* Contenedor con scroll vertical */
.table-scroll-container {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    overflow: auto;
    background: white;
    max-height: calc(100vh - 400px);
}

/* ===== TABLA DE RESULTADOS CON COLUMNAS ALINEADAS ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
    min-width: 1100px;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--color-secondary-dark);
}

.data-table th {
    background: var(--color-secondary-dark);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 25;
    border-bottom: 2px solid var(--color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: top;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Anchos fijos para alineación precisa */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 50px;
    text-align: center;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 120px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 120px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 80px;
    text-align: right;
    padding-right: 15px;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 80px;
    text-align: center;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    min-width: 250px;
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 140px;
    text-align: right;
    padding-right: 15px;
}

.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 100px;
    text-align: right;
    padding-right: 15px;
}

.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: 120px;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8f9ff;
}

.data-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.data-table tbody tr:nth-child(even):hover {
    background-color: #f8f9ff;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Estilos específicos de columnas */
.data-table td:nth-child(1) {
    font-weight: 500;
    color: var(--color-gray);
}

.data-table td:nth-child(2) {
    font-family: var(--font-family-mono);
    font-weight: 500;
    color: var(--color-primary);
}

.data-table td:nth-child(3) {
    font-family: var(--font-family-mono);
    color: var(--color-gray-dark);
    white-space: nowrap;
}

.data-table td:nth-child(4),
.data-table td:nth-child(8) {
    font-family: var(--font-family-mono);
    font-weight: 500;
    padding-right: 15px;
}

/* ===== TIPOGRAFÍA MEJORADA PARA PVP ===== */
.data-table td:nth-child(7) {
    font-family: var(--font-family-inter), 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    padding-right: 15px;
    color: var(--color-success);
    font-variant-numeric: lining-nums;
    letter-spacing: 0.3px;
}

/* Mejorar legibilidad de números específicos */
.data-table td:nth-child(7) {
    font-feature-settings: "tnum";
}

/* Asegurar que el símbolo PEN sea claro */
.pvp-cell {
    font-weight: 600;
}

/* ===== CONTROLES DE TABLA ===== */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.rows-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 12px;
    color: var(--color-gray-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-select {
    padding: 5px 10px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: white;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 70px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    padding-right: 25px;
}

.control-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-info {
    font-size: 12px;
    color: var(--color-gray-dark);
    min-width: 150px;
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: white;
    color: var(--color-gray-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 12px;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--color-light);
    border-color: var(--color-border-light);
    color: var(--color-primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== ESTADO VACÍO ===== */
.empty-state {
    padding: 40px 20px !important;
    text-align: center;
    color: var(--color-gray);
}

.empty-state i {
    font-size: 36px;
    margin-bottom: 12px;
    color: var(--color-border);
}

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: fadeIn 0.3s ease;
}

.spinner {
    border: 4px solid rgba(52, 152, 219, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--color-primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 13px;
    color: var(--color-gray);
}

/* ===== SCROLLBAR PERSONALIZADO ===== */
.table-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
    border: 2px solid #f1f1f1;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

.sugerencias-container::-webkit-scrollbar {
    width: 6px;
}

.sugerencias-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.sugerencias-container::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
    border: 2px solid #f8f9fa;
}

/* ===== ANIMACIONES ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .button-container {
        grid-column: span 2;
        justify-content: flex-start;
    }
    
    .button-group {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .reporte-container {
        padding: 12px;
        gap: 12px;
    }
    
    .module-header {
        padding: 10px 12px;
    }
    
    .module-title {
        font-size: 16px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    .card-header h2 {
        font-size: 14px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 12px;
    }
    
    .button-container {
        grid-column: span 1;
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .table-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .table-wrapper {
        padding: 0 16px 16px 16px;
    }
    
    .data-table {
        min-width: 1000px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .sticky-search {
        position: relative;
        top: 0;
    }
    
    .sticky-stats {
        position: relative;
        top: 0;
    }
}

@media (max-width: 480px) {
    .module-title {
        font-size: 14px;
    }
    
    .filter-field {
        padding: 8px 10px;
        font-size: 12px;
        height: 36px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 8px 12px;
        font-size: 12px;
        height: 36px;
        min-width: 100px;
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
}

/* PRUEBA NUEVA BOTONES*/
/* PRUEBA NUEVA BOTONES*/
/* PRUEBA NUEVA BOTONES*/


/* Ajustar el grid para 4 columnas */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columnas iguales */
    gap: 20px;
    align-items: start;
}

/* Columna de botones */
.filter-group.button-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0;
    margin-top: 0;
}



/* Contenedor de botones apilados */
.button-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}





/* PRUEBA NUEVA BOTONES*/
/* PRUEBA NUEVA BOTONES*/
/* PRUEBA NUEVA BOTONES*/