/* ================= RESET ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html, body {
    height: 100%;
}

/* ================= THEME VARIABLES ================= */
:root {
    --bg: linear-gradient(135deg, #eef2ff, #fdf2f8);
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #6366f1;
    --accent2: #ec4899;
    --border: #e5e7eb;
}

body.dark {
    --bg: linear-gradient(135deg, #020617, #0f172a);
    --sidebar-bg: #020617;
    --card-bg: #020617;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #1e293b;
}

/* ================= BODY ================= */
body {
    background: var(--bg);
    overflow: hidden;
    color: var(--text);
}

/* ================= APP ================= */
.app {
    display: flex;
    height: 100vh;
    width: 100vw;
    animation: appFade 0.6s ease;
}

/* App Fade Animation */
@keyframes appFade {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.nav-btn {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: background 0.2s ease, transform 0.15s ease;
}

.nav-btn:hover {
    transform: translateX(6px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #ffffff;
    border: none;
}

/* Sidebar Footer */
.sidebar-footer button {
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #ffffff;
    cursor: pointer;
}

/* ================= CONTENT ================= */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ================= SEARCH ================= */
.topbar input {
    width: 100%;
    max-width: 320px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

/* ================= DASHBOARD ================= */
.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.stat {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border);
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat h3 {
    font-size: 30px;
    color: var(--accent);
}

/* ================= ADD GOAL ================= */
.add-goal {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 12px;
    margin-bottom: 20px;
}

.add-goal input,
.add-goal select {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

.add-goal button {
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    color: #ffffff;
    cursor: pointer;
}

/* ================= GOALS ================= */
.goal-item {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: goalSlide 0.3s ease;
}

/* Goal Slide Animation */
@keyframes goalSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.goal-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

.goal-left input {
    accent-color: var(--accent);
}

/* IMPORTANT: FIX DARK MODE VISIBILITY */
.goal-text {
    color: var(--text);
}

.goal-text.completed {
    text-decoration: line-through;
    color: var(--muted);
}

/* Category Tag */
.tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #ffffff;
}

/* Delete Button */
.delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
}

/* ================= EMPTY STATE ================= */
#emptyState {
    margin-top: 40px;
    text-align: center;
    color: var(--muted);
}

/* ================= MOBILE NAV & FAB ================= */
.mobile-nav {
    display: none;
}

.fab {
    display: none;
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .dashboard {
        grid-template-columns: 1fr 1fr;
    }

    .add-goal {
        grid-template-columns: 1fr;
    }

    /* Bottom Navigation */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        height: 64px;
        width: 100%;
        background: var(--sidebar-bg);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
    }

    .mobile-nav button {
        flex: 1;
        background: none;
        border: none;
        color: var(--muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 11px;
    }

    .mobile-nav .nav-btn.active {
        color: var(--accent);
    }

    /* Floating Add Button */
    .fab {
        display: flex;
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--accent), var(--accent2));
        color: #ffffff;
        font-size: 22px;
        align-items: center;
        justify-content: center;
        border: none;
        z-index: 1100;
        cursor: pointer;
    }

    /* Space for nav */
    .content {
        padding-bottom: 120px;
    }
}

/* ================= TAP FEEDBACK ================= */
button:active {
    transform: scale(0.96);
}
