/* Reset and base styles */
body {
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    transition: background 0.5s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

/* Layout: Make body a flex column to push footer to bottom */
body {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

/* Main content grows to fill space */
main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Footer always at bottom, centered */
.footer {
    flex-shrink: 0;
    width: 100%;
    background: transparent;
    color: #444;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.7;
    letter-spacing: 0.03em;
}

/* Footer in dark mode */
body.dark-mode .footer {
    color: #eee;
    background: transparent;
    opacity: 0.85;
}

/* Glassmorphism container */
.container {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.22), 0 1.5px 8px rgba(106, 17, 203, 0.08);
    padding: 2.7rem 2.2rem 2.2rem 2.2rem;
    margin: 2rem 0;
    backdrop-filter: blur(16px) saturate(180%);
    border: 1.5px solid rgba(255,255,255,0.22);
    transition: box-shadow 0.3s, background 0.4s;
    position: relative;
}

.container:hover {
    box-shadow: 0 16px 48px rgba(44, 62, 80, 0.28);
    background: rgba(255,255,255,0.88);
}

.dark-mode {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
}

.dark-mode .container {
    background: rgba(34, 40, 49, 0.95) !important;
    color: #fff !important;
    box-shadow: 0 8px 32px rgba(20, 20, 20, 0.22);
    border: 1.5px solid rgba(80,80,80,0.22);
}

.dark-mode h2,
.dark-mode .task-text,
.dark-mode #taskInput,
.dark-mode .list-group-item,
.dark-mode #taskCounter,
.dark-mode .filter-btn,
.dark-mode .footer {
    color: #fff !important;
    background: none !important;
}

.dark-mode .list-group-item {
    background: rgba(44, 62, 80, 0.28) !important;
}

.dark-mode #addBtn {
    background: linear-gradient(90deg, #232526 0%, #6a11cb 100%) !important;
    color: #fff !important;
}

.dark-mode #addBtn:hover, 
.dark-mode #addBtn:focus {
    background: linear-gradient(90deg, #6a11cb 0%, #232526 100%) !important;
}

h2 {
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #2575fc;
    margin-bottom: 1.7rem;
    text-shadow: 0 2px 8px rgba(106, 17, 203, 0.08);
    font-size: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.04);
    border-radius: 14px;
    overflow: hidden;
}

#taskInput {
    border-radius: 14px 0 0 14px;
    border: 1.5px solid #e0e0e0;
    padding: 0.85rem 1.1rem;
    font-size: 1.13rem;
    transition: border 0.2s, background 0.3s;
    background: rgba(255,255,255,0.7);
}

#taskInput:focus {
    border-color: #2575fc;
    outline: none;
    box-shadow: 0 0 0 2px #d0e2ff;
    background: #fff;
}

#addBtn {
    border-radius: 0 14px 14px 0;
    font-weight: 700;
    background: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
    border: none;
    color: #fff;
    transition: background 0.3s, box-shadow 0.2s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.09);
    padding: 0 1.3rem;
    font-size: 1.13rem;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#addBtn::after {
    content: '';
    position: absolute;
    left: -75%;
    top: 0;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,0.18);
    transform: skewX(-20deg);
    transition: left 0.4s;
}

#addBtn:hover, #addBtn:focus {
    background: linear-gradient(90deg, #2575fc 0%, #6a11cb 100%);
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.13);
    transform: translateY(-2px) scale(1.03);
}

#addBtn:hover::after {
    left: 120%;
}

.list-group {
    background: transparent;
    border: none;
    padding: 0;
}

.list-group-item {
    background: rgba(247,250,255,0.95);
    border: none;
    border-radius: 14px;
    margin-bottom: 0.9rem;
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.09);
    transition: background 0.25s, box-shadow 0.25s, transform 0.18s;
    position: relative;
    animation: fadeIn 0.5s;
}

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

.list-group-item.removed {
    animation: fadeOut 0.4s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(60px);}
}

.list-group-item:last-child {
    margin-bottom: 0;
}

.list-group-item:hover {
    background: #eaf1fb;
    box-shadow: 0 4px 18px rgba(44, 62, 80, 0.13);
    transform: scale(1.01);
}

.task-text {
    font-size: 1.13rem;
    color: #222;
    transition: color 0.2s, opacity 0.2s;
    cursor: pointer;
    user-select: none;
    padding-left: 2.3rem;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    word-break: break-word;
}

.task-text.completed {
    text-decoration: line-through;
    color: #6a11cb;
    opacity: 0.7;
}

.completeBtn, .deleteBtn {
    border: none;
    outline: none;
    background: none;
    margin-left: 0.2rem;
    padding: 0.45rem 0.6rem;
    border-radius: 9px;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    font-size: 1.18rem;
}

.completeBtn {
    color: #27ae60;
}

.completeBtn:hover {
    background: #eafaf1;
    color: #219150;
    transform: scale(1.13);
}

.deleteBtn {
    color: #e74c3c;
}

.deleteBtn:hover {
    background: #fdecea;
    color: #c0392b;
    transform: scale(1.13);
}

/* Custom animated checkbox for completed tasks */
.task-text::before {
    content: '';
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2.2px solid #b2bec3;
    border-radius: 7px;
    margin-right: 0.8rem;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.06);
}

.task-text.completed::before {
    border-color: #2575fc;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
}

.task-text.completed::after {
    content: '';
    position: absolute;
    left: 0.38rem;
    top: 0.22rem;
    width: 0.45rem;
    height: 0.85rem;
    border: solid #fff;
    border-width: 0 0.19rem 0.19rem 0;
    transform: rotate(45deg);
    opacity: 1;
    transition: opacity 0.2s;
}

/* Task counter and filter bar (optional, for future JS features) */
#taskFooter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.2rem;
    font-size: 1.02rem;
    color: #6a11cb;
    opacity: 0.85;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background: none;
    border: none;
    color: #2575fc;
    font-weight: 600;
    padding: 0.2rem 0.7rem;
    border-radius: 7px;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.filter-btn.active,
.filter-btn:hover {
    background: #eaf1fb;
    color: #6a11cb;
}

/* Dark mode toggle button */
#darkModeToggle {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.13);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    z-index: 10;
}

#darkModeToggle:hover {
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
    transform: scale(1.08);
}

/* --- DARK MODE FIXES --- */
body.dark-mode {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    color: #fff !important;
}

body.dark-mode .container {
    background: rgba(34, 40, 49, 0.95) !important;
    color: #fff !important;
    box-shadow: 0 8px 32px rgba(20, 20, 20, 0.22);
    border: 1.5px solid rgba(80,80,80,0.22);
}

body.dark-mode h2,
body.dark-mode .task-text,
body.dark-mode #taskInput,
body.dark-mode .list-group-item,
body.dark-mode #taskCounter,
body.dark-mode .filter-btn,
body.dark-mode .footer {
    color: #fff !important;
    background: none !important;
}

body.dark-mode .list-group-item {
    background: rgba(44, 62, 80, 0.28) !important;
}

body.dark-mode #addBtn {
    background: linear-gradient(90deg, #232526 0%, #6a11cb 100%) !important;
    color: #fff !important;
}

body.dark-mode #addBtn:hover, 
body.dark-mode #addBtn:focus {
    background: linear-gradient(90deg, #6a11cb 0%, #232526 100%) !important;
}

body.dark-mode #taskInput {
    background: rgba(44, 62, 80, 0.18) !important;
    border-color: #444 !important;
}

body.dark-mode #taskInput::placeholder {
    color: #bbb !important;
    opacity: 1;
}

body.dark-mode .filter-btn.active,
body.dark-mode .filter-btn:hover {
    background: #232526 !important;
    color: #6a11cb !important;
}

body.dark-mode .footer {
    color: #eee !important;
    background: transparent !important;
    opacity: 0.85;
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        max-width: 98vw;
        padding: 1.2rem 0.5rem 1.5rem 0.5rem;
    }
    h2 {
        font-size: 1.3rem;
        padding: 1rem 0;
    }
    .list-group-item {
        padding: 0.7rem 0.7rem;
    }
    #taskInput {
        font-size: 1rem;
    }
    #darkModeToggle {
        top: 0.7rem;
        right: 0.7rem;
        width: 2rem;
        height: 2rem;
        font-size: 1.1rem;
    }
}