/* Styles globaux */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
    padding: 0;
}

/* Modes */
.light-mode {
    background-color: #f4f4f4;
    color: #333;
}

.dark-mode {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

/* Conteneurs et éléments */
.task__adder__container {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#taskInput,
#dueDateInput,
#priorityInput,
#descriptionInput {
    box-sizing: border-box;
    /* Include padding and border in width */
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

#taskInput {
    flex: 1;
    background-color: #fff;
    color: #333;
}

#taskInput.dark-mode-input {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
}

#dueDateInput,
#priorityInput,
#descriptionInput {
    background-color: #fff;
    color: #333;
    width: 100%;
}

#dueDateInput.dark-mode-input,
#priorityInput.dark-mode-input,
#descriptionInput.dark-mode-input {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
}

#descriptionInput {
    height: 80px;
    resize: vertical;
}

#taskAdderButton,
#showFormButton,
#hideFormButton {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

#taskAdderButton {
    background-color: #007bff;
    color: #fff;
}

#taskAdderButton:hover {
    background-color: #0056b3;
}

/* Ensure that buttons have a consistent look and feel */
#showFormButton {
    background-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#showFormButton:hover {
    background-color: #0056b3;
}

#hideFormButton {
    background-color: #dc3545;
    color: #fff;
}

#hideFormButton:hover {
    background-color: #c82333;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#sortOptions {
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
}


#sortOptions.dark-mode-input {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
}

#todoContainer {
    max-width: 800px;
    margin: 0 auto;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
}

table.light-mode-table {
    background-color: #fff;
    color: #333;
}

table.dark-mode-table {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

thead {
    background-color: var(--table-header-background);
    color: var(--table-header-text);
}

thead th {
    color: inherit;
}

td,
th {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.state-button {
    border: none;
    background: none;
    color: blue;
    cursor: pointer;
}

.state-button:hover {
    text-decoration: underline;
}

th {
    font-weight: bold;
}

td {
    color: #666;
}

.light-mode tr:hover {
    background-color: #eee;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.delete-button,
.edit-button,
.complete-button {
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1.2em;
    padding: 0;
    margin: 0;
    color: #e0e0e0;
}

.delete-button {
    color: #dc3545;
}

.edit-button {
    color: #28a745;
}

.complete-button {
    color: #28a745;
}

.complete-button:hover {
    color: #218838;
    /* Vert foncé au survol */
}

.edit-input {
    display: none;
    width: 100%;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.edit-input.dark-mode-input {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

.edit-input.light-mode-input {
    background-color: #fff;
    color: #333;
}

.edit-input.active {
    display: block;
}

/* Commutateur de thème */
.theme-switcher {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-switcher {
    margin-right: auto;
    /* Push other elements to the right */
}

/* Default */
.theme {
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.theme__fill,
.theme__icon {
    transition: 0.3s;
}

.theme__fill {
    background-color: var(--bg);
    display: block;
    mix-blend-mode: difference;
    position: fixed;
    inset: 0;
    height: 100%;
    transform: translateX(-100%);
}

.theme__icon,
.theme__toggle {
    z-index: 1;
}

.theme__icon,
.theme__icon-part {
    position: absolute;
}

.theme__icon {
    display: block;
    top: 0.5em;
    left: 0.5em;
    width: 1.5em;
    height: 1.5em;
}

.theme__icon-part {
    border-radius: 50%;
    box-shadow: 0.4em -0.4em 0 0.5em hsl(0, 0%, 100%) inset;
    top: calc(50% - 0.5em);
    left: calc(50% - 0.5em);
    width: 1em;
    height: 1em;
    transition: box-shadow var(--transDur) ease-in-out,
        opacity var(--transDur) ease-in-out,
        transform var(--transDur) ease-in-out;
    transform: scale(0.5);
}

.theme__icon-part~.theme__icon-part {
    background-color: hsl(0, 0%, 100%);
    border-radius: 0.05em;
    top: 50%;
    left: calc(50% - 0.05em);
    transform: rotate(0deg) translateY(0.5em);
    transform-origin: 50% 0;
    width: 0.1em;
    height: 0.2em;
}

.theme__icon-part:nth-child(3) {
    transform: rotate(45deg) translateY(0.45em);
}

.theme__icon-part:nth-child(4) {
    transform: rotate(90deg) translateY(0.45em);
}

.theme__icon-part:nth-child(5) {
    transform: rotate(135deg) translateY(0.45em);
}

.theme__icon-part:nth-child(6) {
    transform: rotate(180deg) translateY(0.45em);
}

.theme__icon-part:nth-child(7) {
    transform: rotate(225deg) translateY(0.45em);
}

.theme__icon-part:nth-child(8) {
    transform: rotate(270deg) translateY(0.5em);
}

.theme__icon-part:nth-child(9) {
    transform: rotate(315deg) translateY(0.5em);
}

.theme__label,
.theme__toggle,
.theme__toggle-wrap {
    position: relative;
}

.theme__toggle,
.theme__toggle:before {
    display: block;
}

.theme__toggle {
    background-color: hsl(48, 90%, 85%);
    border-radius: 25% / 50%;
    box-shadow: 0 0 0 0.125em var(--primaryT);
    padding: 0.25em;
    width: 6em;
    height: 3em;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color var(--transDur) ease-in-out,
        box-shadow 0.15s ease-in-out,
        transform var(--transDur) ease-in-out;
}

.theme__toggle:before {
    background-color: hsl(48, 90%, 55%);
    border-radius: 50%;
    content: "";
    width: 2.5em;
    height: 2.5em;
    transition: 0.3s;
}

.theme__toggle:focus {
    box-shadow: 0 0 0 0.125em var(--primary);
    outline: transparent;
}

/* Checked */
.theme__toggle:checked {
    background-color: hsl(198, 90%, 15%);
}

.theme__toggle:checked:before,
.theme__toggle:checked~.theme__icon {
    transform: translateX(3em);
}

.theme__toggle:checked:before {
    background-color: hsl(198, 90%, 55%);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(1) {
    box-shadow: 0.2em -0.2em 0 0.2em hsl(0, 0%, 100%) inset;
    transform: scale(1);
    top: 0.2em;
    left: -0.2em;
}

.theme__toggle:checked~.theme__icon .theme__icon-part~.theme__icon-part {
    opacity: 0;
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(2) {
    transform: rotate(45deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(3) {
    transform: rotate(90deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(4) {
    transform: rotate(135deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(5) {
    transform: rotate(180deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(6) {
    transform: rotate(225deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(7) {
    transform: rotate(270deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(8) {
    transform: rotate(315deg) translateY(0.8em);
}

.theme__toggle:checked~.theme__icon .theme__icon-part:nth-child(9) {
    transform: rotate(360deg) translateY(0.8em);
}

.theme__toggle-wrap {
    margin: 0 0.75em;
}

@supports selector(:focus-visible) {
    .theme__toggle:focus {
        box-shadow: 0 0 0 0.125em var(--primaryT);
    }

    .theme__toggle:focus-visible {
        box-shadow: 0 0 0 0.125em var(--primary);
    }
}

/* Ajout d'animation pour le thème */
.transition {
    transition: all 0.3s ease;
}

/* Styles pour le formulaire d'ajout de tâche */
/* Task Form Card */
.task-form {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center the form */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
    width: 90%;
    max-width: 500px;
    /* Limit the width */
    z-index: 1000;
    /* Ensure it is above the overlay */
}

/* Dark Mode Adjustments */
.dark-mode .overlay {
    background: rgba(30, 30, 30, 0.5);
    /* Darker overlay */
}

.dark-mode .task-form {
    background: #333;
    color: #e0e0e0;
}

.dark-mode .task-form input,
.dark-mode .task-form select,
.dark-mode .task-form textarea {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
}

.task-form input,
.task-form select,
.task-form textarea {
    margin-bottom: 10px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    /* Include padding and border in width */
}

#showFormButton,
#hideFormButton {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

/* Ensure elements align nicely within the navbar */
#showFormButton,
.sort-container,
.filter-container {
    margin-left: 20px;
}

#filterInput {
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
}

/* Adjust spacing between the filter and the sort container */
.filter-container {
    margin-left: 20px;
}

.sort-container {
    margin-left: 20px;
}


/* Overlay */
.overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent background */
    z-index: 999;
    /* Ensure it covers everything */
}

#tagsInput {
    background-color: #fff;
    color: #333;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
    width: 100%;
}

#tagsInput.dark-mode-input {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
}

/* Navbar Styles */
.navbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px;
    background-color: #f4f4f4;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.dark-mode .navbar {
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}