/* Progress Page Styles */

/* Enable scrolling for this page */
body.progress-page {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

body.progress-page #app {
    height: auto;
    min-height: 100vh;
}

:root {
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.progress-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 80px;
}

/* Hero Section */
.progress-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--gradient-primary);
    border-radius: 20px;
    color: var(--text-primary);
}

.hero-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.hero-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

.streak-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.streak-fire {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.streak-count {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-elevated);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stat-card.primary {
    background: var(--gradient-primary);
    border: none;
    color: var(--text-primary);
}

.stat-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border-radius: 14px;
}

.stat-card.primary .stat-icon {
    background: rgba(255, 255, 255, 0.2);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card.primary .stat-value {
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-card.primary .stat-label {
    color: var(--text-secondary);
}

/* Twin Evolution Card */
.twin-evolution-card {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.stage-badge {
    background: var(--gradient-primary);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.twin-progress {
    margin-bottom: 1.5rem;
}

.twin-stages {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    position: relative;
}

.stage-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.stage-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--surface-subtle);
    border: 3px solid var(--border-subtle);
    transition: all 0.3s;
}

.stage-marker.active .stage-dot {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-primary);
}

.stage-marker.completed .stage-dot {
    background: var(--success);
    border-color: var(--success);
}

.stage-marker span {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.stage-marker.active span,
.stage-marker.completed span {
    color: var(--text-primary);
    font-weight: 500;
}

.stage-progress-bar {
    height: 6px;
    background: var(--surface-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.stage-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.tei-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.tei-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tei-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Chart Section */
.chart-section {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-btn:hover {
    background: var(--surface-subtle);
}

.chart-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.chart-container {
    height: 250px;
    margin-top: 1rem;
}

/* Weekly Summary */
.weekly-summary {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.weekly-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.weekly-stat {
    text-align: center;
    padding: 1rem;
    background: var(--surface-subtle);
    border-radius: 12px;
}

.weekly-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.weekly-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.week-calendar {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.calendar-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background: var(--surface-subtle);
    border-radius: 10px;
    transition: all 0.2s;
}

.calendar-day.active {
    background: var(--gradient-success);
    color: var(--text-primary);
}

.calendar-day.today {
    border: 2px solid var(--accent-primary);
}

.day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.calendar-day.active .day-name {
    color: var(--text-secondary);
}

.day-number {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-day.active .day-number {
    color: var(--text-primary);
}

.day-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-subtle);
}

.calendar-day.active .day-indicator {
    background: white;
}

/* Insights Section */
.insights-section {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-subtle);
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
}

.insight-item.positive {
    border-left-color: var(--success);
}

.insight-item.motivation {
    border-left-color: var(--warning);
}

.insight-item.suggestion {
    border-left-color: var(--info);
}

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

.insight-message {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Achievements */
.achievements-section {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.achievement-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.achievement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem;
    background: var(--surface-subtle);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: var(--accent-primary);
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.achievement-card.locked .achievement-icon {
    filter: grayscale(1);
}

.achievement-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Domains Section */
.domains-section {
    background: var(--surface-elevated);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
}

.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.domain-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-subtle);
    border-radius: 12px;
    transition: all 0.2s;
}

.domain-card:hover {
    transform: translateX(4px);
}

.domain-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--glass-bg);
    border-radius: 12px;
}

.domain-info {
    flex: 1;
}

.domain-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.domain-progress-bar {
    height: 6px;
    background: var(--border-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.domain-progress-fill {
    height: 100%;
    background: var(--gradient-success);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.domain-score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* ============================================= */
/* HQ Journey Chart                              */
/* ============================================= */
.hq-chart-container {
    height: 280px;
}

/* ============================================= */
/* Enhanced Domain Progress Bars                 */
/* ============================================= */
.domain-sort-controls {
    display: flex;
    gap: 0.5rem;
}

.domain-bars-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 660px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.domain-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--surface-subtle);
    border-radius: 10px;
    transition: transform 0.15s;
}

.domain-bar-row:hover {
    transform: translateX(4px);
}

.domain-bar-icon {
    font-size: 1.2rem;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.domain-bar-name {
    width: 140px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.domain-bar-track {
    flex: 1;
    height: 10px;
    background: var(--border-subtle);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.domain-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.domain-bar-fill.score-low    { background: linear-gradient(90deg, #ef4444, #f87171); }
.domain-bar-fill.score-mid    { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.domain-bar-fill.score-high   { background: linear-gradient(90deg, #10b981, #34d399); }

.domain-bar-score {
    width: 36px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.domain-bar-delta {
    width: 48px;
    text-align: right;
    font-size: 0.78rem;
    font-weight: 500;
    flex-shrink: 0;
}

.domain-bar-delta.positive { color: #10b981; }
.domain-bar-delta.negative { color: #ef4444; }
.domain-bar-delta.neutral  { color: var(--text-muted); }

/* ============================================= */
/* Streak Heatmap Calendar                       */
/* ============================================= */
.streak-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.streak-current-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.streak-current-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #10b981;
}

.heatmap-container {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 3px;
    padding: 1rem 0;
    overflow-x: auto;
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-day {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--surface-subtle);
    position: relative;
    cursor: default;
}

.heatmap-day[title] {
    cursor: help;
}

.heatmap-day.level-0 { background: var(--surface-subtle); }
.heatmap-day.level-1 { background: rgba(16, 185, 129, 0.25); }
.heatmap-day.level-2 { background: rgba(16, 185, 129, 0.5); }
.heatmap-day.level-3 { background: rgba(16, 185, 129, 0.75); }
.heatmap-day.level-4 { background: rgb(16, 185, 129); }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    padding-top: 0.5rem;
}

.heatmap-legend-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0 4px;
}

.heatmap-legend .heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

/* ============================================= */
/* Milestones (Enhanced Achievement Cards)       */
/* ============================================= */
.milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.milestone-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--surface-subtle);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.milestone-card.earned {
    background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(99,102,241,0.08) 100%);
    border-color: rgba(16, 185, 129, 0.4);
}

.milestone-card.earned::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #6366f1);
}

.milestone-card.locked {
    opacity: 0.45;
}

.milestone-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
    background: var(--glass-bg);
}

.milestone-card.earned .milestone-icon-wrap {
    background: rgba(16, 185, 129, 0.15);
}

.milestone-card.locked .milestone-icon-wrap {
    filter: grayscale(1);
}

.milestone-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.milestone-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.milestone-check {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.9rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

@media (max-width: 768px) {
    .progress-main {
        padding: 1rem;
        padding-top: 70px;
    }

    .progress-hero {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .twin-stages {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .stage-marker span {
        font-size: 0.6rem;
    }

    .weekly-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .week-calendar {
        overflow-x: auto;
    }

    .calendar-day {
        min-width: 50px;
    }

    .achievements-grid,
    .milestones-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .domains-grid {
        grid-template-columns: 1fr;
    }

    .domain-bar-name {
        width: 100px;
        font-size: 0.75rem;
    }

    .domain-sort-controls {
        flex-wrap: wrap;
    }

    .heatmap-container {
        gap: 2px;
    }

    .heatmap-day {
        width: 11px;
        height: 11px;
    }
}

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