/* --- ESTILO WEB PREMIUM COMPLETO --- */
/* Variables de diseño */
:root {
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-secondary: #4b5563;
    --color-excel: #10b981;
    --color-excel-hover: #059669;
    --color-pdf: #ef4444;
    --color-pdf-hover: #dc2626;
    --font-family: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
}

/* Reset y estructura base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout Principal Grid */
.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

/* SIDEBAR ESTILIZADO */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--color-primary);
}

.sidebar-logo h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.sidebar-logo h2 span {
    color: var(--color-primary);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Drag-and-drop Upload Zone */
.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.02);
    transition: all var(--transition-speed) ease;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 2.2rem;
    color: var(--color-primary);
    margin-bottom: 0.8rem;
}

.upload-text {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.active-file-indicator {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.file-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.file-name {
    color: #10b981;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Formularios y Selectores */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.form-control option {
    background-color: var(--bg-sidebar);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botones */
.btn {
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.2rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #374151;
}

.btn-excel {
    background-color: var(--color-excel);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-excel:hover:not(:disabled) {
    background-color: var(--color-excel-hover);
    transform: translateY(-2px);
}

.btn-pdf {
    background-color: var(--color-pdf);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-pdf:hover:not(:disabled) {
    background-color: var(--color-pdf-hover);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.download-section {
    border-bottom: none;
    padding-bottom: 0;
}

/* MAIN CONTENT */
.main-content {
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100vh;
    overflow-y: auto;
}

/* HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.header-meta {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
}

.meta-item {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* GLASSMORPHISM CARDS */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

/* KPIS GRID */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: all var(--transition-speed) ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.igv-bg { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }
.cost-bg { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.cant-bg { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.trans-bg { background-color: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

.kpi-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.kpi-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* VISUALIZATIONS GRID */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.panel-body {
    padding: 1.5rem;
    flex: 1;
}

.badge {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--color-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Chart Panel Styling */
.chart-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.chart-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
    animation: fadeIn 0.5s ease-in-out;
}

.placeholder-msg {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.placeholder-msg p {
    font-size: 0.85rem;
    max-width: 300px;
}

/* Highlight Card Style */
.highlight-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-highlight-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

.highlight-fire-icon {
    font-size: 2rem;
    color: #f59e0b;
    margin-bottom: 0.3rem;
}

.highlight-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #f59e0b;
}

.highlight-prod-name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.highlight-price-tag {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.price-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.price-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: #10b981;
}

/* DATA TABLE PANEL */
.panel-table {
    margin-top: 0.5rem;
}

.table-search-wrapper {
    position: relative;
    width: 250px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.45rem 0.8rem 0.45rem 2rem;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.8rem;
    transition: all var(--transition-speed) ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: rgba(255, 255, 255, 0.08);
}

.table-body {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    max-height: 380px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: #111827;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tbody tr {
    transition: background-color var(--transition-speed) ease;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Clases de alineación e importes */
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsividad para pantallas pequeñas */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        height: auto;
        position: relative;
    }
    .main-content {
        height: auto;
        overflow-y: visible;
    }
    .dashboard-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-kpis {
        grid-template-columns: 1fr;
    }
}

/* --- ESTILOS DE VISTA CONSOLIDADA Y PESTAÑAS (TALLER MINA) --- */

/* Contenedor de alineación a la derecha en la cabecera */
.header-right-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Contenedor de pestañas */
.view-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    padding: 3px;
    gap: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Secciones de vista */
.view-section {
    display: none;
    flex-direction: column;
    gap: 2rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
    display: flex;
}

/* Panel del Selector de Minas */
.panel-mina-selector {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.selector-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Cuadrícula de checkboxes de minas */
.minas-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
}

.mina-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.mina-checkbox-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.mina-checkbox-item.checked {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.mina-checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.mina-checkbox-item input[type="checkbox"]:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.mina-checkbox-item input[type="checkbox"]:checked::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    color: white;
}

.mina-checkbox-item span {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mina-checkbox-item.checked span {
    color: #fff;
    font-weight: 600;
}

/* Estilos de tabla en tfoot y fila de total */
.data-table tfoot .total-row {
    background-color: rgba(59, 130, 246, 0.08);
    border-top: 2px solid rgba(59, 130, 246, 0.3);
}

.data-table tfoot .total-row td {
    font-weight: 700;
    color: var(--color-primary);
    border-bottom: none;
}

/* --- ANIMACIONES Y SKELETONS (OPTIMIZACIÓN VISUAL PREMIUM) --- */

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.skeleton {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.03) 8%, rgba(255, 255, 255, 0.08) 18%, rgba(255, 255, 255, 0.03) 33%);
    background-size: 800px 104px;
    animation: shimmer 1.6s infinite linear;
    border-radius: 6px;
    display: inline-block;
}

.skeleton-text {
    height: 10px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 16px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton-kpi {
    height: 32px;
    width: 75%;
    margin-top: 6px;
}

.skeleton-chart {
    height: 250px;
    width: 100%;
    border-radius: 8px;
}

.skeleton-row {
    height: 16px;
    margin: 10px 0;
    width: 100%;
}

/* --- TOAST NOTIFICATIONS (SISTEMA DE NOTIFICACIONES FLOTANTES) --- */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem 1.25rem;
    min-width: 320px;
    max-width: 450px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.15rem;
}

.toast-success .toast-icon { color: var(--color-excel); }
.toast-success { border-left: 4px solid var(--color-excel); }

.toast-error .toast-icon { color: var(--color-pdf); }
.toast-error { border-left: 4px solid var(--color-pdf); }

.toast-info .toast-icon { color: var(--color-primary); }
.toast-info { border-left: 4px solid var(--color-primary); }

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
}

.toast-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.2s;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--text-main);
}

/* --- PAGINACIÓN DE TABLAS (OPTIMIZACIÓN DE DOM) --- */

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0 0.2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 0.4rem;
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* --- ESTRUCTURA MEJORADA DE HOVER DE TARJETAS KPI --- */
.kpi-card {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}


