/* RESET BÁSICO */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    background-color: #f0f7ff;
    color: #333;
    min-height: 100vh;
}

/* MENÚ LATERAL - TEMA GAS */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1a365d, #2d3748);
    color: white;
    height: 100vh;
    position: fixed;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 15px rgba(0,0,0,0.1);
}

.logo {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #4a5568;
    margin-bottom: 30px;
}

.logo img {
    width: 70px;
    height: 70px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.logo h2 {
    color: #63b3ed;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.logo p {
    color: #cbd5e0;
    font-size: 13px;
    font-weight: 300;
}

.menu {
    flex-grow: 1;
    margin-top: 20px;
}

.menu a {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.3s;
    font-size: 15px;
    font-weight: 500;
}

.menu a i {
    margin-right: 15px;
    width: 24px;
    text-align: center;
    font-size: 18px;
}

.menu a:hover {
    background-color: #4a5568;
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.menu a.active {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.user-info {
    padding-top: 25px;
    border-top: 1px solid #4a5568;
    margin-top: auto;
}

.user {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    transition: background 0.3s;
}

.user:hover {
    background: rgba(255,255,255,0.1);
}

.user i {
    font-size: 42px;
    color: #63b3ed;
}

.user div {
    flex-grow: 1;
}

.user strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.user small {
    font-size: 12px;
    color: #a0aec0;
    font-weight: 300;
}

/* CONTENIDO PRINCIPAL */
.main-content {
    margin-left: 280px;
    padding: 30px;
    width: calc(100% - 280px);
    background-color: #f7fafc;
}

/* BARRA SUPERIOR */
.top-bar {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    border-left: 6px solid #4299e1;
}

.company-info h1 {
    color: #2d3748;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-info h1 i {
    color: #4299e1;
}

.company-tag {
    display: inline-block;
    background: #ebf8ff;
    color: #2b6cb0;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    border: 1px solid #bee3f8;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 25px;
}

#current-date {
    color: #4a5568;
    font-weight: 500;
    font-size: 15px;
    background: #f7fafc;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn-refresh {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(66, 153, 225, 0.4);
}

/* SECCIÓN DE KPIs */
.kpi-cards {
    margin-bottom: 35px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.section-title h2 {
    color: #2d3748;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title h2 i {
    color: #4299e1;
}

.time-filter {
    display: flex;
    gap: 10px;
}

.time-btn {
    padding: 8px 20px;
    border: 1px solid #cbd5e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.3s;
}

.time-btn:hover {
    border-color: #4299e1;
    color: #4299e1;
}

.time-btn.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* TARJETAS DE KPIs */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: inherit;
    border-left: 4px solid;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.kpi-header h3 {
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    min-width: 70px;
    text-align: center;
}

.status.good {
    background: #c6f6d5;
    color: #22543d;
}

.status.warning {
    background: #feebc8;
    color: #744210;
}

.status.critical {
    background: #fed7d7;
    color: #742a2a;
}

.kpi-value {
    font-size: 38px;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 12px;
    line-height: 1;
}

.kpi-change {
    font-size: 14px;
    color: #718096;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.positive {
    color: #38a169;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.negative {
    color: #e53e3e;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-target {
    font-size: 13px;
    color: #a0aec0;
    padding-top: 15px;
    border-top: 1px solid #edf2f7;
    line-height: 1.5;
}

/* SECCIÓN DE GRÁFICOS */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container, .alerts-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.chart-container h3, .alerts-container h3 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart {
    height: 280px;
    position: relative;
}

.alerts-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 10px;
}

.alert-item {
    padding: 18px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 5px solid;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.alert-item:hover {
    transform: translateX(5px);
}

.alert-critical {
    background: linear-gradient(135deg, #fff5f5, #fed7d7);
    border-left-color: #e53e3e;
}

.alert-warning {
    background: linear-gradient(135deg, #fffaf0, #feebc8);
    border-left-color: #dd6b20;
}

.alert-info {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    border-left-color: #3182ce;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    align-items: flex-start;
}

.alert-title {
    font-weight: 700;
    font-size: 15px;
    color: #2d3748;
}

.alert-time {
    font-size: 12px;
    color: #718096;
    background: rgba(255,255,255,0.7);
    padding: 3px 8px;
    border-radius: 10px;
}

.alert-desc {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
}

/* TABLA DE DISTRIBUCIÓN */
.table-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.table-header h3 {
    color: #2d3748;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-export {
    background: #38a169;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-export:hover {
    background: #2f855a;
    transform: translateY(-2px);
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

thead {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

th {
    padding: 18px 20px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid #edf2f7;
    color: #4a5568;
    font-size: 14px;
}

tr:hover {
    background-color: #f7fafc;
}

.delivery-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    min-width: 100px;
}

.status-entregado {
    background: #c6f6d5;
    color: #22543d;
}

.status-en-ruta {
    background: #bee3f8;
    color: #2b6cb0;
}

.status-pendiente {
    background: #feebc8;
    color: #744210;
}

.status-problema {
    background: #fed7d7;
    color: #742a2a;
}

/* PIE DE PÁGINA */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 0;
    color: #718096;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
    margin-top: 30px;
}

.footer-left, .footer-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-left strong {
    color: #2d3748;
    font-size: 15px;
}

footer i {
    color: #4299e1;
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 80%;
    max-width: 700px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #a0aec0;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 25px;
    transition: color 0.3s;
}

.close:hover {
    color: #e53e3e;
}

#modalTitle {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    padding-right: 30px;
}

#modalContent {
    color: #4a5568;
    line-height: 1.6;
    font-size: 15px;
}

#modalContent p {
    margin-bottom: 15px;
}

#modalContent ul, #modalContent ol {
    margin: 15px 0 15px 20px;
}

#modalContent li {
    margin-bottom: 8px;
}

/* RESPONSIVO */
@media (max-width: 1200px) {
    .sidebar {
        width: 80px;
        padding: 20px 15px;
    }
    
    .sidebar .logo h2,
    .sidebar .logo p,
    .menu a span,
    .user div {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
    }
    
    .menu a {
        justify-content: center;
        padding: 15px 0;
    }
    
    .menu a i {
        margin-right: 0;
        font-size: 20px;
    }
    
    .user i {
        font-size: 32px;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .date-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-title {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    footer {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}