/* ═══════════════════════════════════════════════
   Daily Tracker — Glassmorphism Dark Theme
   ═══════════════════════════════════════════════ */

:root {
    /* Colors */
    --bg: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-solid: #1e293b;
    --surface: rgba(51, 65, 85, 0.4);
    --border: rgba(148, 163, 184, 0.1);
    --border-glow: rgba(99, 102, 241, 0.3);

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

    /* Mood Colors */
    --mood-1: #ef4444;
    --mood-2: #f97316;
    --mood-3: #eab308;
    --mood-4: #22c55e;
    --mood-5: #10b981;
    --mood-empty: rgba(51, 65, 85, 0.3);

    /* Spacing */
    --padding: 16px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 50px;

    /* Font */
    --font: 'Inter', -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    padding-bottom: 100px;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        var(--bg);
}

/* ─── Header ──────────────────────────────────── */

.header {
    position: relative;
    padding: 24px var(--padding) 16px;
    overflow: hidden;
}

.header-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 200px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.header-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.header-title {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.stat-pill:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.stat-icon { font-size: 16px; }
.stat-value { font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 11px; }

/* ─── Tabs ────────────────────────────────────── */

.tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0 var(--padding);
    margin: 8px 0 16px;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--text-secondary);
    background: var(--surface);
}

.tab.active {
    color: var(--text);
    background: var(--bg-card);
    border-color: var(--border-glow);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.tab-icon { font-size: 16px; }

.tab-content { display: none; padding: 0 var(--padding); }
.tab-content.active { display: block; }

/* ─── Glass Card ──────────────────────────────── */

.card {
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--radius);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Mood Calendar ───────────────────────────── */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

#cal-month-label {
    font-weight: 600;
    font-size: 15px;
}

.cal-nav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cal-nav:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    transition: all 0.2s ease;
    cursor: default;
}

.cal-day.empty {
    visibility: hidden;
}

.cal-day.no-mood {
    background: var(--mood-empty);
    color: var(--text-muted);
}

.cal-day.has-mood {
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    animation: pop-in 0.3s ease;
}

.cal-day.today {
    box-shadow: 0 0 0 2px var(--accent);
}

.cal-day.has-mood:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px currentColor;
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.mood-legend {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ─── Habits Grid ─────────────────────────────── */

.habits-grid {
    display: grid;
    gap: 12px;
}

.habit-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
    animation: slide-up 0.4s ease;
    animation-fill-mode: backwards;
}

.habit-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.habit-card.completed {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.habit-emoji {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 12px;
    flex-shrink: 0;
}

.habit-info {
    flex: 1;
    min-width: 0;
}

.habit-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text);
}

.habit-streak-text {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.habit-streak-fire {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(180deg, #f97316, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.habit-streak-fire.active {
    animation: fire-pulse 1.5s ease infinite;
}

@keyframes fire-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.habit-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.habit-check.done {
    background: var(--mood-5);
    border-color: var(--mood-5);
    color: white;
}

/* ─── Charts ──────────────────────────────────── */

.chart-container {
    position: relative;
    width: 100%;
    padding: 8px 0;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

/* ─── Loading ─────────────────────────────────── */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Animations ──────────────────────────────── */

.fade-in {
    animation: fade-in 0.5s ease;
    animation-fill-mode: backwards;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Scrollbar ───────────────────────────────── */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

/* ─── Responsive ──────────────────────────────── */

@media (max-width: 360px) {
    :root { --padding: 12px; }
    .header-title { font-size: 24px; }
    .stat-pill { padding: 6px 10px; font-size: 12px; }
}

@media (min-width: 500px) {
    body { max-width: 500px; margin: 0 auto; }
}
