﻿/* === Stats === */

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7a99;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1f2e;
}

.stat-card-delta {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .stat-card-delta.positive {
        color: #16a34a;
    }

    .stat-card-delta.negative {
        color: #dc2626;
    }

    .stat-card-delta.neutral {
        color: #6b7a99;
    }

/* Gráfico */

.stats-chart-card {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    padding: 1.25rem;
}

.stats-chart-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stats-toggle {
    font-size: 0.8rem;
    padding: 0.3rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #e5e7ef;
    background: #fff;
    color: #6b7a99;
    cursor: pointer;
    transition: all 0.15s;
}

    .stats-toggle:hover {
        border-color: #00136f;
        color: #00136f;
    }

    .stats-toggle.active {
        background: #00136f;
        border-color: #00136f;
        color: #fff;
    }

/* Rankings */

.stats-rankings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.stats-ranking-card {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    padding: 1.25rem;
}

.stats-ranking-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7a99;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.stats-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

    .stats-table th {
        font-size: 0.75rem;
        font-weight: 600;
        color: #6b7a99;
        padding: 0.4rem 0;
        border-bottom: 1px solid #e5e7ef;
    }

    .stats-table td {
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f8;
        color: #1a1f2e;
    }

    .stats-table tr:last-child td {
        border-bottom: none;
    }


.stats-filtro-vendedor {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stats-main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}

.stats-chart-card {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.stats-rankings-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr 1fr;
    }

    .stats-main-grid {
        grid-template-columns: 1fr;
    }

    .stats-rankings-col {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .stats-ranking-card {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .stats-rankings-col {
        flex-direction: column;
    }

    .stats-ranking-card {
        min-width: unset;
    }
}

/* Explorador */
.explorador-filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 160px;
}

.filtro-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7a99;
}

.filtro-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.filtro-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: #1a1f2e;
}

    .filtro-check input[type="checkbox"] {
        cursor: pointer;
    }

.filtro-fechas {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.filtro-adicionales {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.explorador-fila {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    width: 100%;
}

.explorador-separador {
    width: 100%;
    height: 1px;
    background: #e5e7ef;
    margin: 0.5rem 0;
}

.filtro-series-dropdown {
    position: relative;
}

.filtro-series-toggle {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #e5e7ef;
    background: #fff;
    color: #1a1f2e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 160px;
    transition: border-color 0.15s;
}

    .filtro-series-toggle:hover {
        border-color: #00136f;
    }

.filtro-series-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 200px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filtro-series-seleccionados {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.filtro-serie-tag {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #eef1fb;
    border: 1px solid #c7d0e8;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    color: #00136f;
}

    .filtro-serie-tag button {
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        color: #6b7a99;
        display: flex;
        align-items: center;
        line-height: 1;
    }

        .filtro-serie-tag button:hover {
            color: #dc2626;
        }

.filtro-cliente-item {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    color: #1a1f2e;
    transition: background 0.1s;
}

    .filtro-cliente-item:hover {
        background: #eef1fb;
        color: #00136f;
    }

.table-row-expanded {
    background: #f8f9fc;
}

    .table-row-expanded td {
        font-size: 0.85rem;
    }

.stats-link {
    color: #00136f;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

    .stats-link:hover {
        color: #4f8ef7;
    }