/* Walk Tracker - Dark Gamified Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #13131a;
    --bg-card-hover: #1a1a24;
    --accent: #10b981;
    --accent-light: #34d399;
    --accent-dark: #059669;
    --accent-glow: rgba(16, 185, 129, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: rgba(255, 255, 255, 0.08);
    --success: #22c55e;
    --warning: #f59e0b;
    --fire: #f97316;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
}

.app {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 40px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.greeting {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.icon-btn.loading svg {
    animation: spin 1s linear infinite;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 24px;
}

.progress-ring-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
}

.progress-ring {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 12;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 534;
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 1.5s ease-out;
}

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

.big-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    line-height: 1;
}

.unit {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.goal-text {
    display: block;
    font-size: 0.875rem;
    color: var(--accent);
    margin-top: 8px;
    font-weight: 600;
}

/* Hero Stats Row */
.hero-stats {
    display: flex;
    gap: 12px;
}

.streak-card {
    flex: 1;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.streak-icon {
    font-size: 2rem;
    animation: pulse-fire 2s ease-in-out infinite;
}

@keyframes pulse-fire {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

.streak-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--fire);
}

.streak-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.best-streak {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.today-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.today-card.walked {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.today-card.not-walked {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.today-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.today-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.today-card.not-walked .today-icon {
    background: #ef4444;
}

.today-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.today-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

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

.today-stat strong {
    color: var(--text-primary);
    font-weight: 700;
}

.today-divider {
    color: var(--text-muted);
}

/* Motivation Banner */
.motivation-banner {
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 24px;
    text-align: center;
}

#motivationText {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pace-icon { background: rgba(99, 102, 241, 0.2); }
.calories-icon { background: rgba(249, 115, 22, 0.2); }
.steps-icon { background: rgba(16, 185, 129, 0.2); }
.time-icon { background: rgba(139, 92, 246, 0.2); }

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

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.stat-change {
    font-size: 0.7rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: #ef4444;
}

/* Chart Section */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.week-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    gap: 8px;
}

.chart-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.chart-bar-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chart-bar {
    width: 100%;
    max-width: 36px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.8s ease-out;
    position: relative;
}

.chart-bar.empty {
    background: var(--bg-card-hover);
    min-height: 4px;
}

.chart-bar.today {
    box-shadow: 0 0 20px var(--accent-glow);
}

.chart-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chart-day {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.chart-day.today {
    color: var(--accent);
    font-weight: 700;
}

/* Achievements Section */
.achievements-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.achievement {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    transition: all 0.2s ease;
    opacity: 0.4;
}

.achievement.unlocked {
    opacity: 1;
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, transparent 100%);
}

.achievement-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
    display: block;
}

.achievement-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.achievement.unlocked .achievement-name {
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Confetti Canvas */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Responsive */
@media (max-width: 480px) {
    .app {
        padding: 16px;
    }

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

    .stats-section {
        grid-template-columns: 1fr;
    }

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

    .big-number {
        font-size: 2.5rem;
    }

    .progress-ring-container {
        width: 180px;
        height: 180px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .chart-section, .achievements-section {
    animation: fadeIn 0.5s ease-out;
}

/* Number counting animation class */
.counting {
    transition: all 0.1s ease-out;
}

/* Gradient definitions for SVG */
.gradient-defs {
    position: absolute;
    width: 0;
    height: 0;
}
