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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 700px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

header h1 {
    font-size: 3rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

header .subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
}

/* Add Task Container */
.add-task-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out;
}

#taskInput {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#taskInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#dueDateInput {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

#dueDateInput:focus {
    outline: none;
    border-color: #f093fb;
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.1);
}

#prioritySelect {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
    transition: all 0.3s ease;
    font-weight: 600;
}

#prioritySelect:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

/* Tasks Container */
.tasks-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    background: #fafafa;
}

.filter-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.filter-btn:hover {
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
}

.filter-btn.active {
    color: #667eea;
}

.filter-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Task List */
.task-list {
    list-style: none;
    max-height: 500px;
    overflow-y: auto;
    padding: 0;
}

.task-list:empty::after {
    content: 'No tasks yet! Add one above to get started 🚀';
    display: block;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
}

.task-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
}

.task-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(240, 147, 251, 0.05) 100%);
}

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

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.task-checkbox:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.task-item.completed .task-checkbox {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.task-item.completed .task-checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-text {
    font-size: 1rem;
    color: #333;
    word-break: break-word;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.task-text:hover {
    background: rgba(102, 126, 234, 0.05);
}

.task-text.editing {
    background: #fff;
    border: 2px solid #667eea;
    outline: none;
    padding: 6px 10px;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #999;
}

.task-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
}

.task-priority {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #fff;
}

.priority-medium {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

.priority-low {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
}

.task-due-date {
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-due-date::before {
    content: '📅';
}

.task-due-date.overdue {
    color: #fa709a;
    font-weight: 600;
}

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

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

.btn-delete {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* Task Summary */
.task-summary {
    padding: 15px 20px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

#taskCount {
    color: #666;
    font-weight: 600;
}

.btn-text {
    background: transparent;
    border: none;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-text:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrollbar */
.task-list::-webkit-scrollbar {
    width: 8px;
}

.task-list::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.task-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.task-detail-section {
    margin-bottom: 20px;
}

.task-detail-section label {
    display: block;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.task-detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-input,
.modal-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-input:focus,
.modal-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.subtasks-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.subtasks-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    color: #333;
}

.add-subtask-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.add-subtask-container input[type="text"] {
    flex: 1;
    min-width: 150px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.add-subtask-container input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-subtask-container input[type="date"],
.add-subtask-container select {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
}

.btn-add-subtask {
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add-subtask:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.subtask-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subtask-list:empty::after {
    content: 'No subtasks yet';
    display: block;
    text-align: center;
    padding: 30px 20px;
    color: #999;
    font-size: 0.95rem;
}

/* Nested/Indented Task Styles */
.task-item {
    position: relative;
}

.task-item.has-subtasks {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.03) 0%, rgba(240, 147, 251, 0.03) 100%);
}

.task-item.nested-level-1 {
    padding-left: 50px;
    background: rgba(102, 126, 234, 0.02);
}

.task-item.nested-level-2 {
    padding-left: 80px;
    background: rgba(102, 126, 234, 0.04);
}

.task-item.nested-level-3 {
    padding-left: 110px;
    background: rgba(102, 126, 234, 0.06);
}

.task-item.nested-level-4 {
    padding-left: 140px;
    background: rgba(102, 126, 234, 0.08);
}

/* Collapse/Expand Button */
.collapse-btn {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #667eea;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.collapse-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.collapse-btn.collapsed::before {
    content: '▶';
}

.collapse-btn:not(.collapsed)::before {
    content: '▼';
}

.task-item.collapsed {
    display: none;
}

/* Nesting connection lines */
.task-item.nested-level-1::before {
    content: '';
    position: absolute;
    left: 35px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea 0%, rgba(102, 126, 234, 0.2) 100%);
}

.task-item.nested-level-2::before {
    left: 65px;
}

.task-item.nested-level-3::before {
    left: 95px;
}

.task-item.nested-level-4::before {
    left: 125px;
}

/* Task item click cursor */
.task-item .task-content {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .add-task-container {
        flex-direction: column;
    }

    #taskInput,
    #dueDateInput,
    #prioritySelect,
    .btn-primary {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 20px;
    }

    .task-detail-row {
        grid-template-columns: 1fr;
    }

    .add-subtask-container {
        flex-direction: column;
    }

    .add-subtask-container input[type="text"],
    .add-subtask-container input[type="date"],
    .add-subtask-container select,
    .btn-add-subtask {
        width: 100%;
    }
}
