/* ===== Estadísticas CSS - Coherente con el Rediseño y Modo Oscuro ===== */

/* Variables específicas para estadísticas */
:root {
    --stats-gradient-primary: linear-gradient(135deg, #28a745, #20c997);
    --stats-gradient-secondary: linear-gradient(135deg, #17a2b8, #007bff);
    --stats-gradient-tertiary: linear-gradient(135deg, #6f42c1, #e83e8c);
    --stats-gradient-quaternary: linear-gradient(135deg, #ffc107, #fd7e14);
    --stats-bg: rgba(255, 255, 255, 0.05);
    --stats-border: rgba(255, 255, 255, 0.1);
    --stats-card-bg: #ffffff;
    --stats-card-text: #161616;
}

/* Variables específicas para modo oscuro */
[data-theme="dark"] {
    --stats-bg: rgba(255, 255, 255, 0.08);
    --stats-border: rgba(255, 255, 255, 0.15);
    --stats-card-bg: #2c2c2c;
    --stats-card-text: #e0e0e0;
}

/* ==== Contenedor principal de estadísticas ==== */
.writing-stats {
    background: var(--secondary-color);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.writing-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--stats-gradient-primary);
    border-radius: 15px 15px 0 0;
}

.writing-stats h3 {
    font-family: 'Comfortaa', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--card-text);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.writing-stats h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--stats-gradient-primary);
    border-radius: 2px;
}

/* ==== Badge de autenticidad mejorado ==== */
.authenticity-badge {
    background: var(--stats-gradient-tertiary);
    color: white;
    padding: 18px 24px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
}

.authenticity-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

.authenticity-badge i {
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

/* ==== Grid de estadísticas inline ==== */
.stats-grid-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-mini {
    background: var(--stats-card-bg);
    color: var(--stats-card-text);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--input-border);
}

/* Modo oscuro específico para stat-mini */
[data-theme="dark"] .stat-mini {
    background: var(--stats-card-bg);
    color: var(--stats-card-text);
    border-color: var(--stats-border);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.stat-mini::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stats-gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-mini:hover::before {
    transform: scaleX(1);
}

.stat-mini:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .stat-mini:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.stat-mini:nth-child(1)::before { background: var(--stats-gradient-primary); }
.stat-mini:nth-child(2)::before { background: var(--stats-gradient-secondary); }
.stat-mini:nth-child(3)::before { background: var(--stats-gradient-tertiary); }
.stat-mini:nth-child(4)::before { background: var(--stats-gradient-quaternary); }

.stat-mini i {
    display: block;
    font-size: 24px;
    margin-bottom: 12px;
    background: var(--stats-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 1px rgba(40, 167, 69, 0.3));
}

/* Modo oscuro para iconos de estadísticas */
[data-theme="dark"] .stat-mini i {
    color: var(--stats-card-text);
    -webkit-text-fill-color: var(--stats-card-text);
    filter: none;
}

.stat-mini:nth-child(1) i {
    background: var(--stats-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-mini:nth-child(2) i {
    background: var(--stats-gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-mini:nth-child(3) i {
    background: var(--stats-gradient-tertiary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-mini:nth-child(4) i {
    background: var(--stats-gradient-quaternary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Modo oscuro - usar colores sólidos para los iconos */
[data-theme="dark"] .stat-mini:nth-child(1) i { color: #28a745; -webkit-text-fill-color: #28a745; }
[data-theme="dark"] .stat-mini:nth-child(2) i { color: #17a2b8; -webkit-text-fill-color: #17a2b8; }
[data-theme="dark"] .stat-mini:nth-child(3) i { color: #6f42c1; -webkit-text-fill-color: #6f42c1; }
[data-theme="dark"] .stat-mini:nth-child(4) i { color: #ffc107; -webkit-text-fill-color: #ffc107; }

.stat-mini span {
    font-family: 'Bebas Neue', cursive;
    font-size: 28px;
    color: var(--stats-card-text);
    display: block;
    line-height: 1;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-mini small {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ==== Chart Container Mejorado ==== */
.chart-container {
    background: var(--stats-card-bg);
    color: var(--stats-card-text);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--input-border);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .chart-container {
    background: var(--stats-card-bg);
    border-color: var(--stats-border);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stats-gradient-secondary);
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: 8px;
}

/* ==== Indicadores en tarjetas de entrada ==== */
.entry-indicators .indicator {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    transition: all 0.3s ease;
}

.entry-indicators .indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-indicator {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.9), rgba(0, 86, 179, 0.9)) !important;
}

.handwritten-indicator {
    background: linear-gradient(135deg, rgba(111, 66, 193, 0.9), rgba(232, 62, 140, 0.9)) !important;
    position: relative;
    overflow: hidden;
}

.handwritten-indicator::before {
    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;
}

.time-indicator {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.9), rgba(32, 201, 151, 0.9)) !important;
}

/* ==== Estadísticas del Hero ==== */
.authenticity-stats .stat-item {
    position: relative;
    overflow: hidden;
}

.authenticity-stats .stat-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.authenticity-stats .stat-item:hover::after {
    opacity: 1;
}

.authenticity-stats .stat-icon {
    position: relative;
    z-index: 2;
}

.authenticity-stats .stat-info {
    position: relative;
    z-index: 2;
}

/* ==== Animaciones ==== */
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(111, 66, 193, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(111, 66, 193, 0.6);
        transform: scale(1.02);
    }
}

@keyframes count-up {
    from { 
        opacity: 0;
        transform: translateY(10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Aplicar animación de conteo a los números */
.stat-mini span,
.stat-number {
    animation: count-up 0.8s ease forwards;
}

.stat-mini:nth-child(1) span { animation-delay: 0.1s; }
.stat-mini:nth-child(2) span { animation-delay: 0.2s; }
.stat-mini:nth-child(3) span { animation-delay: 0.3s; }
.stat-mini:nth-child(4) span { animation-delay: 0.4s; }

/* ==== Estados de hover mejorados ==== */
.authenticity-badge:hover {
    animation: pulse-glow 2s infinite;
    transform: translateY(-2px);
}

/* ==== Responsive para estadísticas ==== */
@media (max-width: 768px) {
    .stats-grid-inline {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-mini {
        padding: 15px 10px;
    }
    
    .stat-mini i {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .stat-mini span {
        font-size: 24px;
    }
    
    .authenticity-badge {
        padding: 15px 18px;
        gap: 12px;
    }
    
    .authenticity-badge i {
        font-size: 20px;
    }
    
    .writing-stats {
        padding: 20px;
    }
    
    .chart-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .stats-grid-inline {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-mini {
        padding: 12px 8px;
    }
    
    .stat-mini i {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .stat-mini span {
        font-size: 20px;
    }
    
    .stat-mini small {
        font-size: 10px;
    }
    
    .authenticity-badge {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
}

/* ==== Efectos visuales avanzados ==== */
.stat-mini {
    position: relative;
}

.stat-mini::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    z-index: 0;
}

[data-theme="dark"] .stat-mini::after {
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
}

.stat-mini:hover::after {
    width: 120%;
    height: 120%;
}

.stat-mini > * {
    position: relative;
    z-index: 1;
}

/* ==== Indicadores de progreso para estadísticas ==== */
.progress-indicator {
    width: 100%;
    height: 4px;
    background: var(--input-bg);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--stats-gradient-primary);
    border-radius: 2px;
    transition: width 1.5s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==== Transiciones suaves para cambios de tema ==== */
.writing-stats,
.stat-mini,
.chart-container,
.authenticity-badge,
.progress-indicator {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}