* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

:root {
    /* Gradient Backgrounds */
    --bg-gradient-light: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
    --bg-gradient-dark: linear-gradient(135deg, #16222A 0%, #3A6073 100%);

    /* Application Background (Glassmorphism) */
    --app-bg-light: rgba(255, 255, 255, 0.65);
    --app-bg-dark: rgba(26, 32, 44, 0.7);

    /* Text Colors */
    --text-light: #2d3748;
    --text-dark: #e2e8f0;

    /* Input Backgrounds */
    --input-bg-light: rgba(255, 255, 255, 0.7);
    --input-bg-dark: rgba(255, 255, 255, 0.05);

    /* Accents */
    --accent-light: #6366f1; /* Indigo-500 */
    --accent-dark: #818cf8; /* Indigo-400 */

    /* Borders */
    --border-light: rgba(255, 255, 255, 0.5);
    --border-dark: rgba(255, 255, 255, 0.1);

    /* Text Muted */
    --text-muted-light: #718096;
    --text-muted-dark: #a0aec0;

    /* Highlights and Shadows */
    --update-highlight: rgba(99, 102, 241, 0.2);
    --shadow-light: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --shadow-dark: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] {
    --bg-gradient: var(--bg-gradient-light);
    --app-bg: var(--app-bg-light);
    --text: var(--text-light);
    --input-bg: var(--input-bg-light);
    --accent: var(--accent-light);
    --border: var(--border-light);
    --text-muted: var(--text-muted-light);
    --shadow: var(--shadow-light);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] {
    --bg-gradient: var(--bg-gradient-dark);
    --app-bg: var(--app-bg-dark);
    --text: var(--text-dark);
    --input-bg: var(--input-bg-dark);
    --accent: var(--accent-dark);
    --border: var(--border-dark);
    --text-muted: var(--text-muted-dark);
    --shadow: var(--shadow-dark);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 540px;
    padding: 20px;
}

.todo-app {
    background: var(--app-bg);
    width: 100%;
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    transition: all 0.3s ease;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.todo-app h2 {
    color: var(--text);
    display: flex;
    align-items: center;
    font-size: 28px;
}

.todo-app h2 i {
    margin-left: 10px;
    color: var(--accent);
}

.theme-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.3s, color 0.3s;
}

.theme-toggle:hover {
    color: var(--accent);
    transform: rotate(30deg);
}

.header-actions {
    display: flex;
    gap: 15px;
}

.row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

#input-box, #task-description {
    width: 100%;
    border: 1px solid transparent;
    outline: none;
    background: var(--input-bg);
    backdrop-filter: blur(5px);
    padding: 15px 20px;
    font-size: 16px;
    border-radius: 16px;
    color: var(--text);
    resize: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#input-box:focus, #task-description:focus {
    background: var(--app-bg);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--update-highlight);
}

.task-options {
    display: flex;
    gap: 12px;
    width: 100%;
}

.task-options select, .task-options input[type="date"] {
    flex: 1;
    border: 1px solid transparent;
    outline: none;
    background: var(--input-bg);
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.task-options select:hover, .task-options input[type="date"]:hover {
    background-color: var(--app-bg);
    border-color: var(--accent);
    transform: translateY(-2px);
    color: var(--text);
}

#add-btn {
    border: none;
    outline: none;
    padding: 14px 25px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#add-btn.editing {
    background: linear-gradient(135deg, #10b981, #059669); /* Green color for edit mode */
}

#add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-container {
    position: relative;
    margin-left: auto;
    margin-bottom: 10px;
}

#search-box {
    border: none;
    outline: none;
    background: var(--input-bg);
    padding: 8px 15px 8px 35px;
    font-size: 14px;
    border-radius: 20px;
    color: var(--text);
    transition: all 0.3s;
    width: 180px;
}

#search-box:focus {
    width: 220px;
    background-color: var(--accent);
    color: white;
}

#search-box:focus::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.3s;
}

#search-box:focus + .search-icon {
    color: white;
}

.filter-btn {
    border: none;
    background: var(--input-bg);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent);
    color: white;
}

.filter-btn:hover:not(.active) {
    transform: translateY(-2px);
}

ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

ul li {
    position: relative;
    padding: 16px 16px 16px 54px;
    font-size: 17px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text);
    animation: fadeIn 0.4s ease-out backwards;
    border: 1px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Définition de l'animation pour barrer le texte */
@keyframes strikethrough {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Définition de l'animation pour le fade de l'opacité */
@keyframes fadeColor {
    from {
        color: var(--text);
    }
    to {
        color: var(--text-muted);
    }
}

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

@keyframes highlight {
    0% { background-color: transparent; }
    50% { background-color: var(--update-highlight); }
    100% { background-color: transparent; }
}

ul li.updated {
    animation: highlight 1s ease;
}

ul li .task-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

ul li .task-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

ul li .task-category {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

ul li .task-priority[data-priority="high"] { color: #ef4444; }
ul li .task-priority[data-priority="low"] { color: #10b981; }

ul li:hover {
    background-color: var(--app-bg);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

ul li::before {
    content: '';
    position: absolute;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='1' y='1' width='22' height='22' rx='11' stroke='%23CBD5E1' stroke-width='2'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    left: 12px;
}

ul li.checked {
    color: var(--text-muted);
    position: relative;
    transition: color 0.5s ease;
    animation: fadeColor 0.5s forwards;
}

ul li.checked .task-text::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--text-muted);
    animation: strikethrough 0.3s ease-in-out forwards;
    pointer-events: none;
    z-index: 1;
    max-width: 100%;
}

ul li .task-text {
    position: relative;
    display: inline-block;
}

ul li.checked .task-meta {
    opacity: 0.6;
    transition: opacity 0.5s ease;
}

ul li.checked::before {
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='24' height='24' rx='12' fill='%234CA1AF'/%3E%3Cpath d='M7 12.5L10.5 16L17 9' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.task-actions {
    display: flex;
    gap: 10px;
}

.delete-btn, .edit-btn {
    background: transparent;
    border: none;
    outline: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.7;
}

.delete-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
    opacity: 1;
}

.edit-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
    opacity: 1;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.footer-actions {
    display: flex;
    gap: 15px;
}

#clear-completed, #sort-tasks {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
}

#clear-completed:hover, #sort-tasks:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

/* Styles pour le popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--app-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    position: relative;
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.modal-header h3 {
    color: var(--text);
    font-size: 20px;
    margin: 0;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
}

.close-modal:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    padding: 12px 15px;
    border: none;
    background: var(--input-bg);
    border-radius: 8px;
    color: var(--text);
    width: 100%;
    font-size: 16px;
    resize: none;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
}

.btn-cancel {
    background: var(--input-bg);
    color: var(--text);
}

.btn-cancel:hover {
    background: #ef4444;
    color: white;
}

.btn-save {
    background: var(--accent);
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Animation pour le popup */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

.modal-container.animate-in {
    animation: fadeInScale 0.4s forwards;
}

.modal-container.animate-out {
    animation: fadeOutScale 0.3s forwards;
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .todo-app {
        padding: 20px;
    }

    .task-options {
        flex-direction: column;
    }

    .filters {
        flex-wrap: wrap;
    }

    .footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .footer-actions {
        width: 100%;
        justify-content: space-between;
    }
}
#view-description {
    color: var(--text);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--input-bg);
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.category-badge {
    padding: 5px 10px;
    border-radius: 15px;
    color: white;
    font-size: 14px;
}

.add-category-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#new-category-color {
    width: 60px;
    padding: 0;
    height: 44px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: none;
}

#add-category-btn {
    width: auto;
    padding: 0 20px;
    height: 44px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
