/* --- Universal Styles & Body --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    color: white;
    background-color: rgb(0, 65, 65);
    font-style: italic;
    font-family: "Comic Neue", cursive;
    padding-top: 15px;
    overflow-y: hidden;
}

/* --- Drag and Drop Style --- */
.dragging {
    opacity: 0.5;
    background: #006064;
}

/* --- Sidebar & Toggle Button --- */
#sidebar {
    width: 250px;
    height: 100dvh; /* Changed from vh */
    background-color: rgb(0, 32, 32);
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    transform: translateX(0);
}

#toggleBtn {
    position: fixed;
    top: 15px;
    left: 15px;
    background-color: rgb(0, 32, 32);
    color: white;
    border: 2px solid white;
    padding: 10px 15px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1001;
    transition: left 0.3s ease-in-out, background-color 0.3s ease-in-out;
    border-radius: 50px;
}

#sidebar.active~#toggleBtn {
    left: calc(250px + 15px);
    background-color: rgb(0, 65, 65);
}


/* --- Main Content & Task Styling --- */
.main-content {
    padding: 15px;
    margin-left: 60px;
    transition: margin-left 0.3s ease-in-out;
    height: calc(100dvh - 100px); /* Changed from vh */
    overflow-y: auto;
}

.task-wrapper {
    margin-top: 10px;
}

.task-wrapper.draggable {
    cursor: grab;
}
.task-wrapper.draggable:active {
    cursor: grabbing;
}

.task-item-container {
    display: flex;
    align-items: center;
    background-color: rgb(0, 32, 32);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: border-left-color 0.3s ease;
    border-left: 5px solid transparent; 
}

.task-is-completed {
    opacity: 0.6;
}
.task-is-completed .task-item-text {
    text-decoration: line-through;
}
.task-is-completed .tick-icon {
    font-size: 28px;
    color: #00c853;
}
.task-is-completed:hover {
    opacity: 1;
}

.delete-btn {
    padding: 15px;
    margin-left: auto;
    cursor: pointer;
    color: #ff5252;
    font-size: 20px;
    border-radius: 0 8px 8px 0;
}
.delete-btn:hover {
    background-color: rgba(255, 82, 82, 0.2);
}


.task-item-container.due-future {
    border-left-color: #00c853;
}
.task-item-container.due-today {
    border-left-color: #ffab00;
}
.task-item-container.overdue {
    border-left-color: #d50000;
}


.tick-icon {
    font-size: 24px;
    font-weight: bold;
    padding: 15px;
    cursor: pointer;
    color: #58a6ff;
    border-right: 1px solid rgb(0, 65, 65);
}

.tick-icon:hover {
    background-color: rgba(88, 166, 255, 0.1);
}

.task-text-wrapper {
    padding: 15px;
    flex-grow: 1;
    overflow: hidden;
}

.task-item-text {
    overflow-wrap: break-word;
    word-wrap: break-word; 
}

.task-source-badge {
    display: inline-block;
    background-color: #00454e;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 10px;
    margin-top: 5px;
    font-style: normal;
    font-weight: bold;
}

.task-actions {
    display: flex;
    align-items: center;
    padding-right: 15px;
    gap: 15px;
}

.notes-btn {
    font-size: 14px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.notes-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.date-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.due-date-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.due-date-picker {
    background-color: transparent;
    border: none;
    color: transparent;
    width: 25px; 
    overflow: hidden;
    position: relative;
}
.due-date-picker::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    font-size: 20px;
    position: absolute;
    right: 0;
}

.task-notes-area {
    display: none;
    padding: 0px 15px 15px 15px;
    background-color: rgb(0, 25, 25);
    border-radius: 0 0 8px 8px;
}

.task-notes-area textarea {
    width: 100%;
    height: 80px;
    background-color: rgb(0, 32, 32);
    border: 1px solid rgb(0, 65, 65);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    font-style: italic;
    resize: vertical;
}

.task-item-empty {
    padding: 15px;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.6);
}

.completed-section {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 15px;
}
.completed-toggle {
    cursor: pointer;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
}
.completed-toggle span {
    display: inline-block;
    transition: transform 0.2s;
}
.completed-toggle span.rotated {
    transform: rotate(-90deg);
}
.completed-tasks-container {
    display: none;
}


#sidebar.active~.main-content {
    margin-left: calc(250px + 20px);
}

.task-edit-input, .list-edit-input, .h1-edit-input, .h1-main-edit-input {
    width: 100%;
    font-family: "Comic Neue", cursive;
    font-style: italic;
    font-size: inherit;
    color: white;
    border: 1px solid #58a6ff;
    outline: none;
    background-color: transparent;
}

.task-edit-input {
    background-color: rgb(0, 32, 32);
    padding: 15px;
    border-radius: 8px;
}

.list-edit-input {
    background-color: #00454e;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 6px;
}

.h1-edit-input {
    padding: 5px;
    border-radius: 6px;
    text-align: center;
}

.h1-main-edit-input {
    padding: 0;
    border-radius: 6px;
}


#addTask {
    position: fixed;
    bottom: 40px; /* MODIFIED: Raised to make space for footer */
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    margin-left: 60px;
    width: calc(100% - 60px);
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
    z-index: 999; /* ADDED: For stacking context */
}

#sidebar.active~#addTask {
    margin-left: calc(250px + 20px);
    width: calc(100% - (250px + 20px));
}

#addTask form {
    display: flex;
    width: 80%;
    gap: 10px;
}

#taskInput {
    flex-grow: 1;
    padding: 15px;
    border-radius: 30px;
    border: 1px solid #00d2ff;
    outline: none;
    background-color: black;
    color: white;
    box-shadow: 0 0 10px #58a6ff;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    font-size: 16px;
}

#taskInputBtn {
    padding: 0 25px;
    border-radius: 30px;
    border: 1px solid #00d2ff;
    outline: none;
    background-color: black;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 10px #58a6ff;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    font-size: 16px;
    font-family: "Comic Neue", cursive;
}

#sidebar h1.bar {
    margin-top: 60px;
    text-align: center;
    cursor: pointer;
}

#sidebarList, #listContainer {
    list-style: none;
}

#sidebarList {
    margin-top: 13px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 20px;
}
/* This makes the static sidebar links clickable */
#sidebarList .list-link {
    cursor: pointer;
}

.singleline {
    height: 1px;
    background-color: grey;
    margin-top: 25px;
}

.scrollable-lists {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 20px;
    padding-right: 5px;
}

#newList {
    margin-top: 10px;
    cursor: pointer;
    font-size: 19px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
}

#newList:hover {
     background-color: rgba(88, 166, 255, 0.1);
}

.list-link {
    padding: 10px;
    background-color: #00454e;
    margin-bottom: 5px;
    border-radius: 6px;
    list-style: none;
    cursor: grab;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.list-link:active {
    cursor: grabbing;
}

#helpBtn {
    margin-top: auto;
    padding: 10px;
    background-color: #00454e;
    border: 1px solid #58a6ff;
    color: white;
    font-family: inherit;
    font-style: italic;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.modal {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: rgb(0, 32, 32);
    padding: 30px;
    border: 1px solid #58a6ff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid grey;
    padding-bottom: 10px;
}

.modal-content ul {
    list-style: none;
    padding: 0;
}

.modal-content li {
    margin-bottom: 15px;
    line-height: 1.5;
}

/* --- Footer --- */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgb(0, 32, 32);
    padding: 10px 0;
    text-align: center;
    z-index: 998;
}

footer p {
    font-style: normal;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}


@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

.scrollable-lists::-webkit-scrollbar {
    width: 8px;
}

.scrollable-lists::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-lists::-webkit-scrollbar-thumb {
    background-color: rgba(88, 166, 255, 0.4);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

@media (max-width: 768px) {
    #addTask form {
        width: 95%;
    }
}

/* --- MOBILE STYLES --- */
@media (max-width: 480px) {
    #sidebar {
        width: 80vw;
    }

    #sidebar.active~#toggleBtn {
        left: calc(80vw + 10px);
    }

    .main-content {
        margin-left: 0;
        padding: 10px 15px 100px 15px;
    }

    .main-content h1 {
        font-size: 28px;
        margin-top: 2px;
        margin-bottom: 20px;
        margin-left: 55px;
    }

    #sidebar h1.bar {
        font-size: 24px;
    }
    
    .list-link {
        font-size: 16px;
        padding: 8px;
    }

    .tick-icon {
        font-size: 20px;
        padding: 12px;
    }

    .task-text-wrapper { 
        padding: 12px;
    }

    .task-item-text { font-size: 15px; }
    
    /* Center the Notes button */
    .task-actions {
        min-width: 90px;
        justify-content: center;
    }
    
    .notes-btn {
        padding: 5px;
        font-size: 12px;
    }
    
    /* Hide the date group on mobile */
    .date-group {
        display: none;
    }

    #newList {
        font-size: 16px;
    }

    #sidebar.active~.main-content {
        margin-left: 0;
        filter: brightness(0.4);
        pointer-events: none;
    }

    #addTask {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }

    #addTask form {
        width: 100%;
    }

    #sidebar.active~#addTask {
        display: none;
    }

    /* ADDED: Hides footer when sidebar is open on mobile */
    #sidebar.active~footer {
        display: none;
    }

    #taskInput {
        padding: 12px 15px;
        font-size: 14px;
    }

    #taskInputBtn {
        padding: 0 20px;
    }
}