/* ==========================================================================
   DASHBOARD SHARED STYLES
   Estilos compartidos para todos los dashboards del sistema CORNARE
   ========================================================================== */

/* ------------------------------------------------------------------------- 
   VARIABLES Y COLORES BASE
   ------------------------------------------------------------------------- */
:root {
    --dashboard-primary: #00833e;
    --dashboard-primary-light: rgba(0, 144, 69, 0.1);
    --dashboard-secondary: #6c757d;
    --dashboard-success: #198754;
    --dashboard-warning: #ffc107;
    --dashboard-danger: #dc3545;
    --dashboard-info: #0dcaf0;
    --dashboard-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --dashboard-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --dashboard-radius: 12px;
    --dashboard-transition: all 0.3s ease;
}

/* ------------------------------------------------------------------------- 
   HEADER DEL DASHBOARD
   ------------------------------------------------------------------------- */
.dashboard-header {
    background: #00833e;
    border-radius: var(--dashboard-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: white;
    box-shadow: var(--dashboard-shadow);
}

.dashboard-header h2 {
    margin: 0;
    font-weight: 700;
    font-size: 1.75rem;
}

.dashboard-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.dashboard-header .header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-header .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    backdrop-filter: blur(4px);
    transition: var(--dashboard-transition);
}

.dashboard-header .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateY(-1px);
}

.dashboard-header .btn i {
    margin-right: 0.5rem;
}

/* ------------------------------------------------------------------------- 
   TARJETAS DE ESTADÍSTICAS
   ------------------------------------------------------------------------- */
.stat-card {
    background: rgba(255, 255, 255, 0.80);
    border-radius: var(--dashboard-radius);
    padding: 1.25rem;
    box-shadow: var(--dashboard-shadow);
    transition: var(--dashboard-transition);
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: var(--dashboard-transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dashboard-shadow-hover);
    background: rgba(255, 255, 255, 0.90);
}

.stat-card:hover::before {
    width: 6px;
}

/* Variantes de color para stat-card */
.stat-card.stat-primary::before { background: var(--dashboard-primary); }
.stat-card.stat-success::before { background: var(--dashboard-success); }
.stat-card.stat-warning::before { background: var(--dashboard-warning); }
.stat-card.stat-danger::before { background: var(--dashboard-danger); }
.stat-card.stat-info::before { background: var(--dashboard-info); }
.stat-card.stat-secondary::before { background: var(--dashboard-secondary); }

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card.stat-primary .stat-icon { background: var(--dashboard-primary-light); color: var(--dashboard-primary); }
.stat-card.stat-success .stat-icon { background: rgba(25, 135, 84, 0.1); color: var(--dashboard-success); }
.stat-card.stat-warning .stat-icon { background: rgba(255, 193, 7, 0.2); color: #b8860b; }
.stat-card.stat-danger .stat-icon { background: rgba(220, 53, 69, 0.1); color: var(--dashboard-danger); }
.stat-card.stat-info .stat-icon { background: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.stat-card.stat-secondary .stat-icon { background: rgba(108, 117, 125, 0.1); color: var(--dashboard-secondary); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card.stat-primary .stat-value { color: var(--dashboard-primary); }
.stat-card.stat-success .stat-value { color: var(--dashboard-success); }
.stat-card.stat-warning .stat-value { color: #b8860b; }
.stat-card.stat-danger .stat-value { color: var(--dashboard-danger); }
.stat-card.stat-info .stat-value { color: #0d6efd; }
.stat-card.stat-secondary .stat-value { color: var(--dashboard-secondary); }

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    margin: 0;
}

.stat-card .stat-trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card .stat-trend.trend-up { color: var(--dashboard-success); }
.stat-card .stat-trend.trend-down { color: var(--dashboard-danger); }
.stat-card .stat-trend.trend-neutral { color: var(--dashboard-secondary); }

/* ------------------------------------------------------------------------- 
   PANEL DE CARDS
   ------------------------------------------------------------------------- */
.dashboard-card {
    background: rgba(255, 255, 255, 0.80);
    border-radius: var(--dashboard-radius);
    box-shadow: var(--dashboard-shadow);
    border: none;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.dashboard-card .card-header {
    background: var(--dashboard-primary);
    border-bottom: none;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dashboard-card .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
}

.dashboard-card .card-header h5 i {
    color: #ffffff;
}

.dashboard-card .card-header .card-actions {
    display: flex;
    gap: 0.5rem;
}

.dashboard-card .card-header .card-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.dashboard-card .card-header .card-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

.dashboard-card .card-body {
    padding: 1.25rem;
}

/* Variantes de header para cards */
.dashboard-card.card-light .card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}
.dashboard-card.card-light .card-header h5 { color: #212529; }
.dashboard-card.card-light .card-header h5 i { color: var(--dashboard-primary); }
.dashboard-card.card-light .card-header .card-actions .btn {
    background: transparent;
    border-color: #dee2e6;
    color: #495057;
}
.dashboard-card.card-light .card-header .card-actions .btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.dashboard-card.card-primary .card-header {
    background: var(--dashboard-primary);
    color: white;
}
.dashboard-card.card-primary .card-header h5,
.dashboard-card.card-primary .card-header h5 i { color: white; }

.dashboard-card.card-warning .card-header {
    background: var(--dashboard-warning);
    color: #212529;
}
.dashboard-card.card-warning .card-header h5,
.dashboard-card.card-warning .card-header h5 i { color: #212529; }
.dashboard-card.card-warning .card-header .card-actions .btn {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #212529;
}

.dashboard-card.card-danger .card-header {
    background: var(--dashboard-danger);
    color: white;
}
.dashboard-card.card-danger .card-header h5,
.dashboard-card.card-danger .card-header h5 i { color: white; }

.dashboard-card.card-success .card-header {
    background: var(--dashboard-success);
    color: white;
}
.dashboard-card.card-success .card-header h5,
.dashboard-card.card-success .card-header h5 i { color: white; }

.dashboard-card.card-info .card-header {
    background: var(--dashboard-info);
    color: #212529;
}
.dashboard-card.card-info .card-header h5,
.dashboard-card.card-info .card-header h5 i { color: #212529; }
.dashboard-card.card-info .card-header .card-actions .btn {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #212529;
}

/* ------------------------------------------------------------------------- 
   ACCIONES RÁPIDAS
   ------------------------------------------------------------------------- */
.quick-action {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(248, 249, 250, 0.80);
    border-radius: 10px;
    text-decoration: none !important;
    color: #212529 !important;
    transition: var(--dashboard-transition);
    border: 1px solid #e9ecef;
}

.quick-action:hover {
    background: rgba(0, 144, 69, 0.15);
    border-color: var(--dashboard-primary);
    color: #212529 !important;
    transform: translateX(4px);
    text-decoration: none !important;
}

.quick-action .action-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: white;
    color: var(--dashboard-primary) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: var(--dashboard-transition);
}

.quick-action:hover .action-icon {
    background: var(--dashboard-primary);
    color: white !important;
}

.quick-action .action-content {
    flex: 1;
}

.quick-action .action-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
    color: #212529 !important;
}

.quick-action .action-subtitle {
    font-size: 0.8rem;
    color: #6c757d !important;
    margin: 0;
}

.quick-action:hover .action-title {
    color: var(--dashboard-primary) !important;
}

.quick-action .action-arrow {
    color: #adb5bd !important;
    transition: var(--dashboard-transition);
}

.quick-action:hover .action-arrow {
    color: var(--dashboard-primary) !important;
    transform: translateX(4px);
}

/* ------------------------------------------------------------------------- 
   ALERTAS DEL DASHBOARD
   ------------------------------------------------------------------------- */
.dashboard-alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #fff3cd;
    border-left: 4px solid var(--dashboard-warning);
}

.dashboard-alert:last-child {
    margin-bottom: 0;
}

.dashboard-alert .alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 193, 7, 0.3);
    color: #997404;
    flex-shrink: 0;
}

.dashboard-alert .alert-content {
    flex: 1;
}

.dashboard-alert .alert-content strong {
    font-weight: 600;
}

.dashboard-alert .alert-action {
    flex-shrink: 0;
}

.dashboard-alert.alert-success {
    background: rgba(25, 135, 84, 0.1);
    border-left-color: var(--dashboard-success);
}
.dashboard-alert.alert-success .alert-icon {
    background: rgba(25, 135, 84, 0.2);
    color: var(--dashboard-success);
}

.dashboard-alert.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-left-color: var(--dashboard-danger);
}
.dashboard-alert.alert-danger .alert-icon {
    background: rgba(220, 53, 69, 0.2);
    color: var(--dashboard-danger);
}

.dashboard-alert.alert-info {
    background: rgba(13, 202, 240, 0.1);
    border-left-color: var(--dashboard-info);
}
.dashboard-alert.alert-info .alert-icon {
    background: rgba(13, 202, 240, 0.2);
    color: #0aa2c0;
}

/* Estado vacío para alertas */
.dashboard-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.dashboard-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.dashboard-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------------- 
   ACTIVIDAD RECIENTE
   ------------------------------------------------------------------------- */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-item:first-child {
    padding-top: 0;
}

.activity-item .activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-item .activity-icon.icon-success {
    background: rgba(25, 135, 84, 0.1);
    color: var(--dashboard-success);
}

.activity-item .activity-icon.icon-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--dashboard-danger);
}

.activity-item .activity-icon.icon-info {
    background: rgba(13, 202, 240, 0.1);
    color: #0aa2c0;
}

.activity-item .activity-icon.icon-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #997404;
}

.activity-item .activity-icon.icon-primary {
    background: var(--dashboard-primary-light);
    color: var(--dashboard-primary);
}

.activity-item .activity-content {
    flex: 1;
    min-width: 0;
}

.activity-item .activity-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.125rem;
    color: #212529;
}

.activity-item .activity-description {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

.activity-item .activity-time {
    font-size: 0.75rem;
    color: #adb5bd;
    white-space: nowrap;
}

/* ------------------------------------------------------------------------- 
   MINI ESTADÍSTICAS (para paneles laterales)
   ------------------------------------------------------------------------- */
.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: rgba(248, 249, 250, 0.80);
    border-radius: 10px;
    text-align: center;
    transition: var(--dashboard-transition);
    border: 1px solid #e9ecef;
}

.mini-stat:hover {
    background: rgba(233, 236, 239, 0.80);
    border-color: #dee2e6;
}

.mini-stat .mini-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.mini-stat .mini-stat-label {
    font-size: 0.8rem;
    color: #495057;
    margin: 0;
    font-weight: 500;
}

.mini-stat.mini-primary .mini-stat-value { color: var(--dashboard-primary); }
.mini-stat.mini-success .mini-stat-value { color: var(--dashboard-success); }
.mini-stat.mini-warning .mini-stat-value { color: #b8860b; }
.mini-stat.mini-danger .mini-stat-value { color: var(--dashboard-danger); }
.mini-stat.mini-info .mini-stat-value { color: #0891b2; }

/* Mini-stat con fondo de color */
.mini-stat.mini-primary-bg {
    background: var(--dashboard-primary-light);
    border-color: rgba(0, 144, 69, 0.2);
}
.mini-stat.mini-success-bg {
    background: rgba(25, 135, 84, 0.1);
    border-color: rgba(25, 135, 84, 0.2);
}
.mini-stat.mini-warning-bg {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
}

/* ------------------------------------------------------------------------- 
   RESUMEN DEL PERÍODO
   ------------------------------------------------------------------------- */
.periodo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.periodo-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.periodo-item:first-child {
    padding-top: 0;
}

.periodo-item .periodo-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
}

.periodo-item .periodo-label i {
    width: 20px;
    text-align: center;
}

.periodo-item .periodo-value {
    font-weight: 700;
    font-size: 1rem;
}

/* ------------------------------------------------------------------------- 
   LOADING STATES
   ------------------------------------------------------------------------- */
.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.dashboard-loading .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.75rem;
}

.dashboard-loading p {
    margin: 0;
    font-size: 0.875rem;
}

/* ------------------------------------------------------------------------- 
   RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .dashboard-header {
        padding: 1.25rem 1.5rem;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        text-align: center;
    }
    
    .dashboard-header .header-actions {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .quick-action {
        padding: 0.875rem 1rem;
    }
    
    .quick-action .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .dashboard-header .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .dashboard-header .btn {
        width: 100%;
    }
    
    .stat-card .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* ------------------------------------------------------------------------- 
   MEJORAS DE CONTRASTE Y VISIBILIDAD
   ------------------------------------------------------------------------- */

/* Textos con mejor contraste */
.text-warning-dark {
    color: #b8860b !important;
}

.text-info-dark {
    color: #0891b2 !important;
}

/* Colores de fondo para badges y texto */
.fw-bold.text-warning {
    color: #b8860b !important;
}

.fw-bold.text-info {
    color: #0891b2 !important;
}

/* Cards del resumen del período - mejor contraste */
.dashboard-card .card-body .text-muted {
    color: #495057 !important;
}

.dashboard-card .card-body .fw-bold {
    font-size: 1rem;
}

/* Asegurar que los iconos en textos muted se vean */
.dashboard-card .card-body .text-warning {
    color: #b8860b !important;
}

/* Stat card con tipo específico del dashboard */
.stat-card.stat-tipo .stat-icon {
    background: rgba(var(--tipo-color-rgb, 139, 69, 19), 0.1);
}

/* Quick actions mejorados */
.quick-action .action-icon {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.quick-action:hover .action-icon {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Empty state mejorado */
.dashboard-empty-state {
    background: #f8f9fa;
    border-radius: 10px;
    margin: 1rem;
    padding: 2.5rem 1.5rem;
}

.dashboard-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.dashboard-empty-state p {
    margin-bottom: 0.5rem;
}

.dashboard-empty-state .btn {
    margin-top: 1rem;
}
