/* --- ESTILOS GENERALES Y DE FONDO --- */
.body-crm-dashboard {
    padding: 20px;
    background-color: #3a3a3a;
    border-radius: 12px;
    font-family: Arial, sans-serif;
    color: #f1f1f1;
}

.dashboard-title {
    text-align: center;
    color: #ffffff;
    margin-bottom: 30px;
}

.section-title {
    color: #e0e0e0;
    font-size: 22px;
    margin: 40px 0 20px 0;
    text-align: center;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}

/* --- ESTILOS PARA FILTROS --- */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px auto;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
}

.preset-filters, .custom-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-btn {
    padding: 10px 15px;
    border: 1px solid #777;
    background-color: transparent;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.filter-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.filter-btn.active {
    background-color: #007bff;
    border-color: #007bff;
    font-weight: bold;
}

.custom-filters label {
    color: #fff;
}

.custom-filters input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #555;
    color: #fff;
}

.custom-filters button {
    padding: 10px 15px;
    border: none;
    background-color: #28a745;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-filters button:hover {
    background-color: #218838;
}

/* --- LAYOUTS DE CUADRÍCULA (GRID) --- */
.grid-container-kpi {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.grid-container-ratios {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.grid-container-performance, .grid-container-segmentacion {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- ESTILOS DE TARJETAS (CARDS) --- */
.card {
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    background-color: #f8f9fa;
    margin-bottom: 30px;
    color: #232323;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-left: 5px solid #ccc;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

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

.card .text-ratio {
    font-size: 16px;
    color: #666;
    margin: 0 0 10px 0;
    font-weight: bold;
}

.card .total-value {
    font-size: 36px;
    font-weight: bold;
    color: #232323;
    margin: 0;
}

/* --- ESTILOS CONTEXTUALES PARA LAS TARJETAS --- */
.card.card-principal { background-color: #e7f5ff; border-left-color: #007bff; }
.card.card-principal .total-value { color: #0056b3; }

.card.card-exito { background-color: #eaf7ec; border-left-color: #28a745; }
.card.card-exito .total-value { color: #155724; }

.card.card-fuga { background-color: #fff4e5; border-left-color: #ff9800; }
.card.card-fuga .total-value { color: #c07200; }

.card.card-rechazo { background-color: #fbeae5; border-left-color: #dc3545; }
.card.card-rechazo .total-value { color: #721c24; }

/* --- ELEMENTOS DINÁMICOS --- */
.card-subtitle {
    color: #555;
    font-weight: bold;
    margin: 5px 0 0 0;
    font-size: 14px;
}

.card hr {
    width: 80%;
    margin: 10px auto;
    border: 0;
    border-top: 1px solid #ddd;
}

.card h4 {
    width: 100%;
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    color: #333;
    font-size: 16px;
    margin-bottom: 15px;
}

.card .dynamic-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: left;
}

.card .dynamic-list li {
    padding: 8px 5px;
    border-bottom: 1px solid #121212;
    color: #555;
    font-size: 14px;
}

.card .dynamic-list li:last-child {
    border-bottom: none;
}

.card .dynamic-list li strong {
    color: #232323;
}

.no-data-msg {
    color: #1c1c1c;
    text-align: center;
    grid-column: 1 / -1;
    font-style: italic;
    padding: 20px;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1200px) {
    .grid-container-kpi,
    .grid-container-performance,
    .grid-container-segmentacion {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
    }
    .grid-container-kpi,
    .grid-container-ratios,
    .grid-container-performance,
    .grid-container-segmentacion {
        grid-template-columns: 1fr;
    }
}

/* --- SPINNER --- */
#dashboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dashboard-spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
