:root {
    --bg-color: #f0f2f5;
    --sidebar-bg: #ffffff;
    --text-color: #2d3436;
    --text-muted: #636e72;
    --primary-color: #6c5ce7;
    /* Soft Purple */
    --primary-hover: #5b4bc4;
    --secondary-color: #a29bfe;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #ff7675;
    --card-bg: #ffffff;
    --border-color: #dfe6e9;
    --hover-bg: #f8f9fa;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    --font-main: 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

.dark-theme {
    --bg-color: #1e1e2e;
    /* Dark Blue-Grey */
    --sidebar-bg: #252538;
    /* Slightly lighter */
    --text-color: #f5f6fa;
    --text-muted: #b2bec3;
    --primary-color: #8c7ae6;
    --primary-hover: #9c88ff;
    --card-bg: #2d2d44;
    --border-color: #353b48;
    --hover-bg: #353b48;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.4);
    --gradient-primary: linear-gradient(135deg, #8c7ae6 0%, #9c88ff 100%);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    transition: background-color 0.3s;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.logo h2 {
    margin-bottom: 40px;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 28px;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-link.active {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.nav-link .icon {
    margin-right: 14px;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.theme-toggle-container {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.sidebar-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.sidebar-footer strong {
    color: var(--primary-color);
}

/* Main Content */
.content {
    flex: 1;
    padding: 40px 60px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.section {
    display: none;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 1200px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 40px;
    display: flex;
    align-items: baseline;
}

.section-header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-header small {
    font-size: 16px;
    color: var(--text-muted);
    margin-left: 15px;
    font-weight: 400;
}

/* Buttons & Inputs */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #2d3436;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-secondary {
    background-color: var(--text-muted);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
}

input[type="text"],
input[type="date"],
textarea {
    padding: 14px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

/* Tasks Layout */
.tasks-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
}

.task-list {
    list-style: none;
    margin-top: 25px;
}

.task-item {
    background-color: var(--card-bg);
    padding: 18px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    border-left: 6px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.task-item:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-md);
}

.task-item.selected {
    border-left-color: var(--primary-color);
    background-color: var(--hover-bg);
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.7;
}

.task-text {
    font-size: 1.05rem;
    font-weight: 500;
}

.task-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-item:hover .task-actions {
    opacity: 1;
}

#add-task-form {
    display: flex;
    gap: 15px;
}

#add-task-form input {
    flex: 1;
}

/* Pomodoro Panel */
.timer-card {
    background-color: var(--card-bg);
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 20px;
}

.timer-display {
    font-size: 72px;
    font-weight: 800;
    margin: 30px 0;
    font-variant-numeric: tabular-nums;
    color: var(--primary-color);
    letter-spacing: -2px;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Habits */
.inline-form {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.habit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.habit-card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.habit-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    align-items: center;
}

.habit-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.category-tag {
    font-size: 11px;
    background-color: var(--hover-bg);
    padding: 4px 8px;
    border-radius: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-left: 8px;
}

.streak {
    font-weight: 700;
    color: var(--warning-color);
    background: rgba(253, 203, 110, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

.weekly-view {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 0;
}

.day-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s;
}

.day-circle.done {
    background-color: var(--success-color);
    color: white;
    transform: scale(1.1);
}

.btn-check {
    width: 100%;
    background-color: var(--hover-bg);
    color: var(--text-color);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-check.done {
    background-color: var(--success-color);
    color: white;
}

/* Notes */
.notes-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.note-area {
    width: 100%;
    height: 65vh;
    resize: none;
    font-size: 18px;
    line-height: 1.8;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: none;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

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

.stat-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 5px;
}

.chart-container {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 250px;
    margin-top: 30px;
    padding-top: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 100%;
    cursor: pointer;
}

.chart-bar {
    width: 40px;
    background: var(--gradient-primary);
    border-radius: 8px 8px 0 0;
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 4px;
    opacity: 0.8;
}

.chart-col:hover .chart-bar {
    opacity: 1;
    transform: scaleX(1.1);
}

.chart-label {
    margin-top: 15px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 900px) {
    .content {
        padding: 20px;
    }

    .tasks-layout {
        grid-template-columns: 1fr;
    }

    .timer-card {
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 15px 20px;
        overflow-x: auto;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .logo h2 {
        margin-bottom: 0;
        margin-right: 25px;
        font-size: 20px;
    }

    .nav-links {
        display: flex;
        margin: 0;
    }

    .nav-link {
        padding: 10px;
        margin-bottom: 0;
        margin-right: 5px;
        font-size: 0;
    }

    .nav-link .icon {
        margin-right: 0;
        font-size: 20px;
    }

    .sidebar-footer {
        display: none;
        /* Hide footer on mobile */
    }

    .theme-toggle-container {
        margin-left: auto;
    }
}