/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-work: #3B82F6;
    --color-personal: #10B981;
    --color-study: #8B5CF6;
    --color-bg: #f0f2f5;
    --color-white: #ffffff;
    --color-text: #1a1a2e;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-width: 320px;
    --header-height: 80px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container - Full Width Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--color-work), var(--color-study));
    color: var(--color-white);
    padding: 24px 48px;
    text-align: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.app-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Content - Sidebar Layout */
.main-content {
    display: flex;
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 32px;
    gap: 32px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin-bottom: 16px;
}

/* Progress Section */
.progress-section {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.progress-percent {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-work), var(--color-study));
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

/* 100% Completion Effect */
.progress-section.completed {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid var(--color-personal);
}

.progress-fill.completed {
    background: linear-gradient(90deg, var(--color-personal), #34d399);
    animation: celebrate 1s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.3); }
}

/* Filter Section */
.filter-section {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background-color: var(--color-bg);
    color: var(--color-text-light);
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-icon {
    font-size: 1.1rem;
}

.filter-btn:hover {
    background-color: var(--color-white);
    border-color: var(--color-border);
    color: var(--color-text);
}

.filter-btn.active {
    background-color: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
}

.filter-btn[data-filter="work"].active {
    background-color: var(--color-work);
    border-color: var(--color-work);
}

.filter-btn[data-filter="personal"].active {
    background-color: var(--color-personal);
    border-color: var(--color-personal);
}

.filter-btn[data-filter="study"].active {
    background-color: var(--color-study);
    border-color: var(--color-study);
}

/* Stats Section */
.stats-section {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border-radius: var(--radius);
    background: var(--color-bg);
}

.stat-card.work {
    background: rgba(59, 130, 246, 0.1);
}

.stat-card.personal {
    background: rgba(16, 185, 129, 0.1);
}

.stat-card.study {
    background: rgba(139, 92, 246, 0.1);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.stat-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.stat-card.work .stat-count {
    color: var(--color-work);
}

.stat-card.personal .stat-count {
    color: var(--color-personal);
}

.stat-card.study .stat-count {
    color: var(--color-study);
}

/* Todo Main Area */
.todo-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

/* Todo Form */
.todo-form {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: center;
}

.todo-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.todo-input:focus {
    outline: none;
    border-color: var(--color-work);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.todo-input::placeholder {
    color: #94a3b8;
}

.category-select {
    min-width: 140px;
    padding: 16px 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--color-white);
    cursor: pointer;
    transition: var(--transition);
}

.category-select:focus {
    outline: none;
    border-color: var(--color-work);
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    background-color: var(--color-work);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.add-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-icon {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Todo List Container */
.todo-list-container {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0 24px;
}

.list-header .section-title {
    margin-bottom: 0;
}

.todo-count {
    font-size: 0.9rem;
    color: var(--color-text-light);
    background: var(--color-bg);
    padding: 6px 12px;
    border-radius: 20px;
}

/* Todo List */
.todo-list {
    list-style: none;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--color-border);
    transition: var(--transition);
}

.todo-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.todo-item.work {
    border-left-color: var(--color-work);
}

.todo-item.personal {
    border-left-color: var(--color-personal);
}

.todo-item.study {
    border-left-color: var(--color-study);
}

.todo-item.completed {
    opacity: 0.6;
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--color-text-light);
}

/* Checkbox */
.todo-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--color-work);
    flex-shrink: 0;
}

/* Category Badge */
.category-badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.category-badge.work {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--color-work);
}

.category-badge.personal {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-personal);
}

.category-badge.study {
    background-color: rgba(139, 92, 246, 0.15);
    color: var(--color-study);
}

/* Todo Title */
.todo-title {
    flex: 1;
    font-size: 1rem;
    word-break: break-word;
    color: var(--color-text);
}

/* Action Buttons */
.edit-btn,
.delete-btn {
    padding: 10px 18px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.edit-btn:hover {
    background-color: var(--color-work);
    border-color: var(--color-work);
    color: var(--color-white);
}

.delete-btn:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: var(--color-white);
}

/* Edit Mode */
.edit-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--color-work);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
}

.edit-actions {
    display: flex;
    gap: 8px;
}

.save-btn,
.cancel-btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.save-btn:hover {
    background-color: #2563eb;
}

.cancel-btn {
    background-color: var(--color-border);
    color: var(--color-text);
}

.cancel-btn:hover {
    background-color: #cbd5e1;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-light);
    text-align: center;
    font-size: 1.1rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--color-text-light);
    font-size: 0.9rem;
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
}

/* Responsive - Tablet */
@media (max-width: 1200px) {
    .main-content {
        padding: 24px;
        gap: 24px;
    }

    .sidebar {
        width: 280px;
    }
}

/* Responsive - Mobile */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar > section {
        flex: 1;
        min-width: 250px;
    }

    .filter-group {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .app-header {
        padding: 20px 16px;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
    }

    .todo-input,
    .category-select,
    .add-btn {
        width: 100%;
    }

    .sidebar > section {
        min-width: 100%;
    }

    .filter-btn {
        min-width: calc(50% - 4px);
    }

    .todo-item {
        flex-wrap: wrap;
        padding: 16px;
    }

    .edit-btn,
    .delete-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}
