/* Stats & Profile Styles */

/* Streak Banner */
.streak-banner {
    background: linear-gradient(135deg, #ff9966, #ff5e62);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
    animation: slideDown 0.5s ease-out;
}

.streak-banner.hidden {
    display: none;
}

.streak-banner.inactive {
    background: linear-gradient(135deg, #555, #333);
    box-shadow: none;
    opacity: 0.8;
}

.streak-icon {
    font-size: 1.5rem;
}

.streak-text {
    font-weight: bold;
    font-size: 1.1rem;
    flex-grow: 1;
}

.streak-weekly {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Skill Profile Screen */
.skill-profile-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.skill-profile-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.skill-profile-container {
    background-color: #1a1a1a;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 12px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.skill-profile-header {
    padding: 20px 30px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #222;
}

.skill-profile-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.5rem;
}

.skill-profile-body {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Overall Rating */
.overall-rating-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.overall-rating-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, #2a2a2a, #1a1a1a);
    border: 4px solid #E87B35;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(232, 123, 53, 0.3);
    margin-bottom: 15px;
}

.rating-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.rating-label {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 5px;
}

.rating-change {
    font-size: 1rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: #333;
}

.rating-change.positive {
    color: #2ecc71;
    background-color: rgba(46, 204, 113, 0.1);
}

.rating-change.negative {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.rating-change.neutral {
    color: #aaa;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.chart-section {
    background-color: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.chart-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #ddd;
    border-left: 3px solid #E87B35;
    padding-left: 10px;
}

.chart-section canvas {
    width: 100%;
    height: 250px;
}

/* Weekly Summary */
.weekly-summary-section {
    background-color: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.weekly-summary-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #ddd;
    border-left: 3px solid #3498db;
    padding-left: 10px;
}

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

.summary-item {
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
}

.summary-value.positive {
    color: #2ecc71;
}

.summary-value.negative {
    color: #e74c3c;
}

/* Personal Bests */
.personal-bests-section {
    background-color: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.personal-bests-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #ddd;
    border-left: 3px solid #f1c40f;
    padding-left: 10px;
}

.bests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.best-item {
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 6px;
    border-left: 2px solid #555;
    transition: transform 0.2s;
}

.best-item:hover {
    transform: translateY(-2px);
    border-left-color: #E87B35;
}

.best-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 5px;
}

.best-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.best-date {
    font-size: 0.75rem;
    color: #666;
}

/* =========================================
   Modern Stats Screen Styles
   ========================================= */

.stats-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    font-family: 'Inter', sans-serif;
    color: #e0e0e0;
}

.stats-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.stats-container-modern {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: linear-gradient(145deg, #1a1a20, #131318);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.stats-header {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
}

.session-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
}

.session-meta {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.separator {
    color: #444;
}

.icon-button {
    background: none;
    border: none;
    color: #888;
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
}

.icon-button:hover {
    color: #fff;
}

/* Content Area */
.stats-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Hero Section */
.stats-hero {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.primary-stat {
    flex: 0 0 250px;
    background: linear-gradient(135deg, rgba(232, 123, 53, 0.1), rgba(232, 123, 53, 0.05));
    border: 1px solid rgba(232, 123, 53, 0.3);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.primary-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #E87B35;
}

.stat-label {
    font-size: 0.9rem;
    color: #E87B35;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-value-large {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 20px rgba(232, 123, 53, 0.4);
}

.stat-rank {
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: rgba(232, 123, 53, 0.2);
    padding: 4px 12px;
    border-radius: 4px;
}

.secondary-stats {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s, background 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.stat-item .label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-item .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

/* Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    flex-grow: 1;
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.card h3 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: #ccc;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.card h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 16px;
    background: #00FFCC;
    margin-right: 10px;
    border-radius: 2px;
}

.canvas-container {
    flex-grow: 1;
    min-height: 250px;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    /* Flex to stretch child */
}

.canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.graph-card {
    flex: 1;
    min-height: 300px;
}

.heatmap-card {
    flex: 1.5;
    min-height: 400px;
    /* Increase min-height for heatmap */
}

/* Comparison Table */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.modern-table th {
    text-align: left;
    color: #666;
    font-weight: 500;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-table td {
    padding: 12px 10px;
    color: #ddd;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.modern-table td:first-child {
    color: #aaa;
}

.modern-table td:nth-child(2) {
    color: #fff;
    font-weight: 600;
}

/* Diagnostics List */
.diagnostics-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diagnostics-list li {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
}

.diagnostics-list li::before {
    content: '•';
    margin-right: 10px;
    font-weight: bold;
}

.diagnostics-list li.positive {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.diagnostics-list li.warning {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.diagnostics-list li.suggestion {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* Mini Charts */
.mini-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.mini-chart h4 {
    margin: 0 0 10px 0;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

.mini-chart canvas {
    width: 100%;
    height: 100px;
}

/* Footer */
.stats-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
}

.footer-actions {
    display: flex;
    gap: 15px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-primary {
    background: #E87B35;
    border: none;
    color: #fff;
    padding: 10px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #d35400;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-hero {
        flex-direction: column;
    }

    .primary-stat {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .secondary-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stats-content {
        padding: 15px;
    }

    .stats-header {
        padding: 15px;
    }

    .chart-section canvas {
        height: 200px;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}