:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-accent: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    font-family: 'Inter', sans-serif;
    color-scheme: dark;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    background-color: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    padding-left: 8px;
}

.mt-4 {
    margin-top: 24px;
}

.mb-4 {
    margin-bottom: 24px;
}

.nav-list {
    list-style: none;
    margin-bottom: 24px;
}

.nav-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--bg-accent);
    color: var(--text-primary);
}

.add-checklist-container {
    display: flex;
    gap: 8px;
}

input[type="text"] {
    flex: 1;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--accent-color);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 48px;
    max-width: 800px;
}

.main-header {
    padding: 48px 0 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

/* Progress Bar */
.progress-container {
    width: 300px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success-color);
    width: 0%;
    transition: width 0.3s ease-out;
}

.task-list-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
}

.task-list {
    list-style: none;
}

/* Task Items */
.task-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: grab;
}

.task-item:active {
    cursor: grabbing;
}

.task-item.dragging {
    opacity: 0.5;
    border: 1px dashed var(--accent-color);
}

.task-item:hover {
    border-color: #475569;
}

.task-header {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 16px;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.task-checkbox:hover {
    border-color: var(--accent-color);
}

.task-checkbox.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.task-checkbox.checked::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.task-title {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.task-title.strikethrough {
    text-decoration: line-through;
    color: var(--text-secondary);
}

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

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

/* Expansion Areas */
.subtasks-container {
    display: none;
    padding: 0 16px 16px 52px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.subtasks-container.expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.subtask-item {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.subtask-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subtask-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    /* Square for subtasks to distinguish */
    border: 2px solid var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subtask-checkbox.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.subtask-checkbox.checked::after {
    content: '';
    width: 3px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.notes-container {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.notes-container.expanded {
    display: block;
}

textarea.note-input {
    width: 100%;
    min-height: 80px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

textarea.note-input:focus {
    border-color: var(--accent-color);
}

.add-task-container {
    padding: 24px 0;
    background-color: var(--bg-primary);
}

.input-wrapper {
    display: flex;
    gap: 16px;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 8px 8px 8px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
}

.checkbox-placeholder {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.input-wrapper input {
    background: transparent;
    border: none;
    padding: 8px 0;
}

.input-wrapper input:focus {
    border: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* ================= PRINT STYLES ================= */
@media print {
    body {
        background-color: white !important;
        color: black !important;
        display: block;
    }

    .app-container {
        display: block;
        height: auto;
    }

    .no-print,
    .sidebar,
    .add-task-container,
    .task-actions,
    .add-subtask-container {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .main-header {
        padding: 0 0 20px 0 !important;
    }

    .task-item {
        background-color: white !important;
        border: none !important;
        border-bottom: 1px solid #ccc !important;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
        border-radius: 0 !important;
    }

    .task-header {
        padding: 8px 0 !important;
    }

    .task-title.strikethrough {
        text-decoration: none !important;
        /* Users might want to manual check on physical paper */
        color: black !important;
    }

    .subtasks-container {
        display: block !important;
        /* Always expand for print */
        background-color: transparent !important;
        border: none !important;
        padding-left: 30px !important;
        margin-bottom: 10px;
    }

    .subtask-item {
        background-color: transparent !important;
        border: none !important;
        padding: 4px 0 !important;
        margin-top: 4px !important;
    }

    /* Print Checkboxes */
    .task-checkbox,
    .subtask-checkbox {
        border-color: black !important;
        background-color: transparent !important;
    }

    .task-checkbox.checked::after,
    .subtask-checkbox.checked::after {
        border-color: black !important;
    }

    /* Display Notes slightly for print */
    .notes-container {
        display: block !important;
        border-top: none !important;
        padding-top: 4px !important;
        margin-top: 4px !important;
    }

    textarea.note-input {
        background: transparent !important;
        color: black !important;
        border: 1px solid #eee !important;
        min-height: 40px !important;
        /* Print empty lines if empty? */
    }
}