/**
 * Estilos mejorados del dashboard
 * Plataforma SaaS Email Marketing
 * Diseño profesional con gráficos y efectos hover
 */

:root {
    --dashboard-primary: #4f46e5;
    --dashboard-secondary: #7c3aed;
    --dashboard-success: #10b981;
    --dashboard-info: #06b6d4;
    --dashboard-warning: #f59e0b;
    --dashboard-danger: #ef4444;
    --dashboard-dark: #1f2937;
    --dashboard-light: #f9fafb;
    --dashboard-border: #e5e7eb;
    --dashboard-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --dashboard-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --dashboard-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Tipografía mejorada */
.main-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Color púrpura para plantillas */
.bg-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Estilos para mini estadísticas */
.stat-mini {
    padding: 1rem;
    transition: transform 0.2s ease;
}

.stat-mini:hover {
    transform: translateY(-2px);
}

.stat-mini h4 {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dashboard-dark);
}

.stat-mini p {
    font-size: 0.875rem;
}

/* Tarjetas de estadísticas mejoradas */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: none;
    border-radius: 16px;
    box-shadow: var(--dashboard-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    height: 100%;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--dashboard-primary), var(--dashboard-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--dashboard-shadow-xl);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .card-body {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card:hover .stat-icon::before {
    opacity: 1;
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.03em;
    transition: color 0.3s ease;
}

.stat-card:hover .stat-value {
    color: var(--dashboard-primary);
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
    margin: 0.15rem 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Cards generales mejoradas */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: var(--dashboard-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: #ffffff;
}

.card:hover {
    box-shadow: var(--dashboard-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid var(--dashboard-border);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: #111827;
}

.card-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
    margin: 0;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 0.75rem;
}

/* Gráficos mejorados - COMPACTOS */
.chart-container {
    position: relative;
    height: 220px;
    padding: 0.5rem;
}

#activityChart {
    max-height: 220px;
}

/* Engagement Card - Diseño Premium con Gráfico de Torta */
.engagement-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.engagement-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.engagement-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 1.25rem 1.75rem;
    position: relative;
    overflow: hidden;
}

.engagement-card .card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.engagement-card .card-header .card-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.125rem;
    position: relative;
    z-index: 1;
}

.engagement-card .card-header .badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

/* Gráfico de torta premium - COMPACTO */
.engagement-pie-wrapper {
    position: relative;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.75rem;
}

.pie-chart-container {
    position: relative;
    width: 100%;
    max-width: 180px;
    height: 180px;
    margin: 0 auto 1rem;
    min-height: 180px;
}

.pie-chart-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 180px !important;
    max-height: 180px !important;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.pie-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.pie-center-value {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.pie-center-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.pie-center-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dashboard-success);
}

/* Leyenda interactiva */
.pie-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 16px;
    border: 1px solid var(--dashboard-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--dashboard-primary);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.legend-item.active {
    border-color: var(--dashboard-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.legend-item:hover .legend-color {
    transform: scale(1.2) rotate(5deg);
}

.legend-content {
    flex: 1;
    min-width: 0;
}

.legend-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.legend-value {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

/* Grid de métricas */
.engagement-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--dashboard-border);
}

.metric-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 8px;
    border: 1px solid var(--dashboard-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.metric-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--dashboard-primary);
}

.metric-box-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.metric-box-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-box:hover .metric-box-icon::before {
    opacity: 1;
}

.metric-box-icon.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.metric-box-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.metric-box-icon.bg-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.metric-box-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.metric-box-content {
    flex: 1;
    min-width: 0;
}

.metric-box-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.metric-box-value {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* Responsive para engagement */
@media (max-width: 768px) {
    .pie-chart-container {
        max-width: 260px;
        height: 260px;
    }
    
    .pie-center-value {
        font-size: 2.5rem;
    }
    
    .pie-legend {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .engagement-metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .metric-box {
        padding: 1rem;
    }
    
    .metric-box-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .metric-box-value {
        font-size: 1.5rem;
    }
}

/* Progress bars mejoradas */
.progress {
    height: 12px;
    border-radius: 8px;
    background-color: #e5e7eb;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-bar {
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    background: linear-gradient(90deg, var(--dashboard-success) 0%, #059669 100%);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-bar.bg-danger {
    background: linear-gradient(90deg, var(--dashboard-danger) 0%, #dc2626 100%);
}

.progress-bar.bg-warning {
    background: linear-gradient(90deg, var(--dashboard-warning) 0%, #d97706 100%);
}

/* Tablas mejoradas */
.table {
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.table thead th {
    border-bottom: 2px solid var(--dashboard-border);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #6b7280;
    padding: 1rem 1.25rem;
    background: #f9fafb;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--dashboard-border);
}

.table tbody tr:hover {
    background-color: #f9fafb;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Badges mejorados */
.badge {
    padding: 0.5em 0.875em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Botones mejorados */
.btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: var(--dashboard-shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--dashboard-shadow-lg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Empty state mejorado */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 5rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.empty-state:hover i {
    opacity: 1;
    transform: scale(1.1);
}

.empty-state h4 {
    font-family: 'Poppins', sans-serif;
    color: #374151;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.empty-state p {
    color: #9ca3af;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Animaciones de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.card {
    animation: fadeInUp 0.6s ease-out;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Responsive */
@media (max-width: 768px) {
    .stat-card .card-body {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .engagement-circle {
        width: 150px;
        height: 150px;
    }
    
    .engagement-value {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

/* Scrollbar personalizado */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.main-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}




















