:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-main: #121212;
    --bg-card: #18181b;
    --text: #fafafa;
    --text-dim: #a1a1aa;
    --border: #27272a;
    --glass: rgba(24, 24, 27, 0.8);
    --success: #10b981;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

header {
    background: var(--glass);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 3rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.controls-bar h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary { background: var(--primary); color: white; border: none; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

.btn-success { background: var(--success); color: white; border: none; }
.btn-success:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }

.btn-danger { background: var(--danger); color: white; border: none; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

.btn-outline { 
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid var(--border); 
    color: var(--text); 
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255,255,255,0.3); }

/* Task Items */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    transition: transform 0.2s, background 0.2s;
}

.task-item:hover {
    border-color: var(--primary);
}

.task-date {
    background: rgba(59, 130, 246, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
    text-align: center;
    min-width: 80px;
}

.task-details { flex: 1; }
.task-details h3 { font-size: 1.1rem; margin-bottom: 0.25rem; color: var(--text); }
.task-details p { color: var(--text-dim); line-height: 1.5; margin: 0; font-size: 0.95rem; }

.task-actions {
    display: flex;
    gap: 0.5rem;
}

/* Subtasks */
.subtask-container {
    margin-left: 4.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: -0.75rem;
}

.subtask-container.collapsed {
    display: none;
}

.subtask-toggle {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    transition: color 0.2s;
}

.subtask-toggle:hover { color: var(--primary); }

.subtask-toggle svg {
    transition: transform 0.2s;
}

.subtask-toggle.expanded svg {
    transform: rotate(90deg);
}

.subtask-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 95%;
    max-width: 550px;
    padding: 2.5rem;
    border-radius: 20px;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
}

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

.close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover { color: var(--text); }

.form-group { margin-bottom: 1.5rem; }
.form-group label { 
    display: block;
    color: var(--text-dim); 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    margin-bottom: 0.75rem;
}
.form-group input, .form-group textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.task-item.is-completed {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.task-item.is-completed h3 {
    text-decoration: line-through;
    opacity: 0.6;
}

.completed-badge {
    color: var(--success) !important;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* --- Responsive Media Queries --- */

@media (max-width: 768px) {
    header {
        margin-bottom: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .user-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .email-badge {
        font-size: 0.8rem;
    }

    .container {
        padding: 0 1rem 2rem;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .controls-bar h2 {
        text-align: center;
    }

    .controls-bar .btn {
        width: 100%;
    }

    /* Task Item Responsive Layout */
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
        gap: 1rem;
    }

    .task-date {
        min-width: unset;
        width: fit-content;
        align-self: flex-start;
    }

    .task-details {
        width: 100%;
    }

    .task-details h3 {
        font-size: 1.2rem;
    }

    .task-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .task-actions .btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Subtask Responsiveness */
    .subtask-container {
        margin-left: 1rem;
        padding-left: 1rem;
        margin-top: -0.5rem;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }

    .subtask-item {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .task-actions {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        width: 90%;
        max-width: none;
    }

    .form-group input, .form-group textarea {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
    }
}
