/* ===================================
   PINGIG STATS DASHBOARD - ROCK/METAL AESTHETIC
   Analytics-focused design with dark theme
   =================================== */

/* ========== STATS VIEW CONTAINER ========== */
.stats-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--charcoal) 0%, var(--dark-gunmetal) 100%);
    z-index: 1000;
    overflow-y: auto;
    padding-bottom: 40px;
}

.stats-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

/* ========== STATS HEADER ========== */
.stats-header {
    margin-bottom: 30px;
    text-align: center;
}

.stats-title {
    font-family: 'Rubik Mono One', monospace;
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 10px;
}

.stats-subtitle {
    color: var(--steel);
    font-size: 1rem;
    font-weight: 400;
}

/* ========== TIME RANGE FILTER ========== */
.stats-time-filter {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 25px 0 35px;
    flex-wrap: wrap;
}

.time-filter-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--gunmetal), var(--dark-gunmetal));
    border: 2px solid var(--steel);
    border-radius: 12px;
    color: var(--silver);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-filter-btn:hover {
    background: linear-gradient(135deg, var(--steel), var(--gunmetal));
    border-color: var(--silver);
    transform: translateY(-2px);
}

.time-filter-btn.active {
    background: linear-gradient(135deg, var(--flame-red), var(--hot-orange));
    border-color: var(--flame-red);
    color: white;
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.4);
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Full-width stat panels */
.stat-panel:not(.stats-grid .stat-panel) {
    margin-bottom: 20px;
}

/* ========== SUMMARY STATS GRID ========== */
.stats-grid-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-panel-summary {
    background: linear-gradient(135deg, rgba(42, 52, 57, 0.9), rgba(26, 31, 36, 0.9));
    border: 2px solid rgba(139, 148, 160, 0.3);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.stat-panel-summary:hover {
    border-color: var(--flame-red);
    box-shadow: 0 0 30px rgba(255, 69, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(-4px);
}

.stat-panel-header-centered {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 69, 0, 0.2);
}

.stat-panel-title-centered {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
    text-align: center;
}

.stat-panel-body-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.stat-value-large {
    font-size: 3rem;
    font-weight: 800;
    color: var(--flame-red);
    line-height: 1;
    margin-bottom: 8px;
    text-align: center;
}

.stat-unit {
    font-size: 0.9rem;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* ========== STAT CARD ========== */
.stat-panel {
    background: linear-gradient(135deg, rgba(42, 52, 57, 0.9), rgba(26, 31, 36, 0.9));
    border: 2px solid rgba(139, 148, 160, 0.3);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.stat-panel:hover {
    border-color: var(--flame-red);
    box-shadow: 0 0 30px rgba(255, 69, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(-4px);
}

.stat-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-panel-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px rgba(255, 107, 53, 0.4));
}

.stat-panel-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--silver);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.stat-panel-body {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== CIRCULAR PROGRESS INDICATOR ========== */
.circular-progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.circular-progress {
    position: relative;
    width: 180px;
    height: 180px;
}

.circular-progress svg {
    transform: rotate(-90deg);
}

.circular-progress-bg {
    fill: none;
    stroke: rgba(139, 148, 160, 0.2);
    stroke-width: 12;
}

.circular-progress-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.circular-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.circular-progress-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--flame-red);
    display: block;
    line-height: 1;
    margin-bottom: 5px;
    max-width: 140px;
    word-break: break-all;
}

.circular-progress-label {
    font-size: 0.8rem;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== CHART CONTAINERS ========== */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-container canvas {
    max-height: 280px;
}

/* ========== ACHIEVEMENT GRID ========== */
.achievements-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.achievement-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(42, 52, 57, 0.5);
    border: 2px solid rgba(139, 148, 160, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.achievement-progress-item:hover {
    border-color: var(--flame-red);
    background: rgba(255, 69, 0, 0.1);
}

.achievement-mini-circle {
    position: relative;
    width: 80px;
    height: 80px;
}

.achievement-mini-circle svg {
    transform: rotate(-90deg);
}

.achievement-mini-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
}

.achievement-mini-label {
    font-size: 0.75rem;
    color: var(--steel);
    text-align: center;
    line-height: 1.2;
}

.achievement-mini-progress {
    font-size: 0.7rem;
    color: var(--flame-red);
    font-weight: 600;
}

/* ========== XP LEVEL BAR ========== */
.xp-level-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px 0;
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 69, 0, 0.2), rgba(255, 107, 53, 0.1));
    border: 2px solid var(--flame-red);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.3);
}

.level-badge-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(255, 107, 53, 0.6));
}

.level-badge-info {
    flex: 1;
}

.level-badge-title {
    font-family: 'Rubik Mono One', monospace;
    font-size: 1.8rem;
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    margin: 0 0 5px;
}

.level-badge-subtitle {
    font-size: 0.9rem;
    color: var(--steel);
}

.xp-progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(139, 148, 160, 0.2);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--flame-red), var(--hot-orange));
    border-radius: 15px;
    transition: width 1s ease;
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.5);
}

.xp-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* ========== CALENDAR HEATMAP ========== */
.heatmap-container {
    padding: 10px;
    overflow-x: auto;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
    gap: 4px;
    min-width: 600px;
}

.heatmap-cell {
    aspect-ratio: 1;
    background: rgba(139, 148, 160, 0.2);
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 10;
}

.heatmap-cell[data-intensity="0"] {
    background: rgba(139, 148, 160, 0.1);
}

.heatmap-cell[data-intensity="1"] {
    background: rgba(255, 107, 53, 0.3);
}

.heatmap-cell[data-intensity="2"] {
    background: rgba(255, 107, 53, 0.5);
}

.heatmap-cell[data-intensity="3"] {
    background: rgba(255, 107, 53, 0.7);
}

.heatmap-cell[data-intensity="4"] {
    background: rgba(255, 107, 53, 0.9);
}

.heatmap-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gunmetal);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}

.heatmap-cell:hover .heatmap-tooltip {
    opacity: 1;
}

/* ========== STATS COMPARISON ========== */
.stats-comparison {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    padding: 20px 0;
}

.comparison-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: rgba(42, 52, 57, 0.5);
    border: 2px solid rgba(139, 148, 160, 0.2);
    border-radius: 12px;
}

.comparison-item.winner {
    border-color: var(--flame-red);
    background: rgba(255, 69, 0, 0.1);
}

.comparison-label {
    font-size: 0.9rem;
    color: var(--steel);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--flame-red);
}

.comparison-subtext {
    font-size: 0.8rem;
    color: var(--steel);
    margin-top: 5px;
}

/* ========== LOADING STATE ========== */
.stats-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 15px;
}

.stats-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 148, 160, 0.2);
    border-top: 4px solid var(--flame-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.stats-loading-text {
    color: var(--steel);
    font-size: 1rem;
}

/* ========== EMPTY STATE ========== */
.stats-empty {
    text-align: center;
    padding: 40px 20px;
}

.stats-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.stats-empty-title {
    font-size: 1.5rem;
    color: var(--steel);
    margin-bottom: 10px;
}

.stats-empty-text {
    color: var(--steel);
    opacity: 0.7;
}

/* ========== EXPORT/SHARE BUTTON ========== */
/* Removed - now using floating SHARE button in style.css */
/* .stats-export-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: linear-gradient(135deg, var(--flame-red), var(--hot-orange));
    border: none;
    border-radius: 50px;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.stats-export-btn:hover {
    box-shadow: 0 0 30px rgba(255, 69, 0, 0.6), 0 12px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(-3px) scale(1.05);
} */

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
    .stats-container {
        padding: 70px 15px 100px;
    }

    .stats-title {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid-summary {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }

    .stat-panel-title-centered {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }

    .stat-value-large {
        font-size: 2.5rem;
    }

    .chart-container {
        height: 220px;
    }

    .achievements-progress-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .circular-progress {
        width: 140px;
        height: 140px;
    }

    .circular-progress-value {
        font-size: 2rem;
    }

    .stats-comparison {
        flex-direction: column;
        gap: 15px;
    }

    /* .stats-export-btn {
        bottom: 80px;
        right: 20px;
        padding: 12px 20px;
        font-size: 0.9rem;
    } */

    .level-badge {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .level-badge-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-container {
        padding: 60px 10px 100px;
    }

    .stats-title {
        font-size: 1.7rem;
    }

    .stat-panel {
        padding: 18px;
    }

    .stat-panel-title {
        font-size: 0.95rem;
    }

    .chart-container {
        height: 200px;
    }

    .achievements-progress-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .achievement-mini-circle {
        width: 60px;
        height: 60px;
    }

    .achievement-mini-text {
        font-size: 1.5rem;
    }

    .time-filter-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}

/* ========== TREND INDICATORS ========== */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
}

.trend-indicator.up {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-green);
}

.trend-indicator.down {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.trend-indicator.neutral {
    background: rgba(139, 148, 160, 0.2);
    color: var(--steel);
}

/* ========== STAT RECORDS ========== */
.stat-records {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(42, 52, 57, 0.5);
    border-left: 3px solid var(--flame-red);
    border-radius: 8px;
}

.stat-record-label {
    font-size: 0.9rem;
    color: var(--silver);
}

.stat-record-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--flame-red);
}
