/* CSS Custom Properties for Theming */
:root {
    --bg-dark: #0b0f19;
    --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #17193b 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #f97316; /* Strava Orange */
    --accent-secondary: #ec4899;
    --accent-tertiary: #3b82f6;
    
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.2);
    --font-base: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    /* Chart Colors */
    --chart-grid: rgba(255, 255, 255, 0.05);
    --chart-tooltip-bg: rgba(15, 23, 42, 0.9);
}

body.light-mode {
    --bg-dark: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #475569;
    
    --shadow-glow: 0 4px 20px rgba(0, 0, 0, 0.08);
    
    --chart-grid: rgba(0, 0, 0, 0.05);
    --chart-tooltip-bg: rgba(255, 255, 255, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-base);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
}

.gradient-text {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out forwards;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 3.5rem;
    letter-spacing: -1px;
    margin-bottom: 0.2rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(249, 115, 22, 0.3);
}

.kpi-icon {
    font-size: 2.5rem;
    margin-right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--card-border);
}

.kpi-info h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.kpi-info p {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: var(--font-display);
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    padding: 1.5rem;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    animation-delay: 0.4s;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.15);
}

.chart-card h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Table Section */
.table-section {
    padding: 1.5rem;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    animation-delay: 0.5s;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.table-section:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.15);
}

.table-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead th {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0,0,0,0.2);
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

tbody td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    font-size: 0.95rem;
}

/* Activity Type Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.run { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.badge.ride { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge.walk { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge.workout { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
.badge.other { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

body.light-mode .badge.run { color: #c2410c; }
body.light-mode .badge.ride { color: #1d4ed8; }
body.light-mode .badge.walk { color: #047857; }
body.light-mode .badge.workout { color: #be185d; }
body.light-mode .badge.other { color: #334155; }

/* Heatmap Section */
.heatmap-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    animation-delay: 0.35s;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.heatmap-section:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.15);
}

body.light-mode .heatmap-section:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.15);
}

.heatmap-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.heatmap-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.heatmap-graph {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    gap: 4px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 1rem;
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: var(--card-border);
    transition: transform 0.1s ease;
}

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

.heatmap-cell.level-0 { background-color: rgba(255,255,255, 0.05); }
body.light-mode .heatmap-cell.level-0 { background-color: rgba(0,0,0, 0.05); }

.heatmap-cell.level-1 { background-color: #ffedd5; }
.heatmap-cell.level-2 { background-color: #fdba74; }
.heatmap-cell.level-3 { background-color: #f97316; }
.heatmap-cell.level-4 { background-color: #c2410c; }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.heatmap-legend span { margin: 0 0.5rem; }

footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark); 
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4); 
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    border-radius: 50px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-base);
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-out forwards;
}

.tab-content.active {
    display: block;
}

/* Sub-tabs */
.sub-tabs-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.sub-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.sub-tab-btn:hover {
    color: var(--text-main);
}

.sub-tab-btn.active {
    color: var(--accent-tertiary);
    border-bottom: 2px solid var(--accent-tertiary);
}

.sub-tab-content {
    display: none;
    animation: fadeInUp 0.4s ease-out forwards;
}

.sub-tab-content.active {
    display: block;
}

/* Filters */
.filters-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-group select {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-base);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    border-color: var(--accent-primary);
}

/* Home Cards Container */
.home-cards-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 4rem;
    flex-wrap: wrap;
}

.home-card {
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 2rem;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    border-radius: 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.home-card:nth-child(1) {
    animation-delay: 0.2s;
}

.home-card:nth-child(2) {
    animation-delay: 0.4s;
}

.home-card:nth-child(3) {
    animation-delay: 0.6s;
}

.home-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.4);
}

.home-card-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255,255,255,0.01) 100%);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    transition: transform 0.3s ease;
}

.home-card:hover .home-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.home-card h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.home-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}
