/* ----------------------------------
   VARIABLES & THEME CONFIG
---------------------------------- */
:root {
    /* Light Theme Defaults */
    --bg-body: #F0F4F8;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --primary: #4F46E5; /* Indigo 600 */
    --primary-glow: rgba(79, 70, 229, 0.3);
    --accent: #EC4899; /* Pink 500 */
    --input-bg: #FFFFFF;
    --border-color: #E2E8F0;
    --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Animation Speeds */
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    /* Dark Theme Overrides */
    --bg-body: #0F172A; /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.75); /* Slate 800 */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --primary: #818CF8; /* Indigo 400 */
    --primary-glow: rgba(129, 140, 248, 0.3);
    --accent: #F472B6; /* Pink 400 */
    --input-bg: #1E293B;
    --border-color: #334155;
    --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------
   GLOBAL RESET & TYPOGRAPHY
---------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ----------------------------------
   COMPONENTS & UTILITIES
---------------------------------- */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* ----------------------------------
   NAVBAR
---------------------------------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pro-badge {
    font-size: 0.75rem;
    background: var(--primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    -webkit-text-fill-color: #fff; /* Reset text fill */
}

/* Theme Toggle */
.theme-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    background: rgba(128, 128, 128, 0.1);
}

[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }

/* ----------------------------------
   HERO: PROGRESS RING
---------------------------------- */
.hero-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.progress-ring-container {
    position: relative;
    width: 220px;
    height: 220px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle-bg {
    fill: transparent;
    stroke: var(--border-color);
    stroke-width: 15;
}

.progress-ring__circle {
    fill: transparent;
    stroke: var(--primary);
    stroke-width: 15;
    stroke-linecap: round;
    stroke-dasharray: 565.48; /* 2 * PI * 90 */
    stroke-dashoffset: 565.48; /* Starts empty */
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.progress-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#progress-percentage {
    font-size: 3rem;
    font-weight: 700;
    display: block;
    line-height: 1;
}

.progress-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ----------------------------------
   METRICS GRID
---------------------------------- */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
    margin-bottom: 0; /* Override default card margin */
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.metric-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

.metric-info p {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ----------------------------------
   INPUTS & BUTTONS
---------------------------------- */
.inputs-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

input[type="number"] {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.primary-btn {
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}

/* ----------------------------------
   WEEKLY CHART
---------------------------------- */
.chart-container {
    height: 150px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.bar {
    flex: 1;
    background: var(--primary);
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
    opacity: 0.7;
    position: relative;
    min-height: 4px; /* Ensure visible even if 0 */
}

.bar:hover {
    opacity: 1;
}

.bar.today {
    background: var(--accent);
    opacity: 1;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
}

.chart-labels span {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ----------------------------------
   ACHIEVEMENTS / BADGES
---------------------------------- */
.badges-container {
    display: flex;
    justify-content: space-around;
}

.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    width: 30%;
    transition: all 0.4s ease;
}

.badge-icon {
    font-size: 2.5rem;
    filter: grayscale(100%) opacity(0.5);
    transition: all 0.4s ease;
}

.badge span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Unlocked State */
.badge.unlocked {
    background: var(--primary-glow);
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.badge.unlocked .badge-icon {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.1);
}

.badge.unlocked span {
    color: var(--text-main);
    font-weight: 600;
}

/* ----------------------------------
   FOOTER
---------------------------------- */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: auto;
}

/* ----------------------------------
   RESPONSIVE
---------------------------------- */
@media (min-width: 600px) {
    .container {
        padding: 40px;
    }
}
