/* FlexTodo - Styles CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    position: relative;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.checklist {
    border-left: 4px solid #667eea;
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.checklist-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #667eea;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.toggle-btn:hover {
    background-color: #f0f0f0;
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.checklist-header h3 {
    color: #333;
    font-size: 1.4em;
    margin: 0;
}

.checklist-nom {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.checklist-nom:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.checklist-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checklist-description-header {
    margin-bottom: 10px;
    padding: 0 10px;
}

.checklist-content {
    transition: all 0.3s ease;
}

.checklist-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.completion {
    background: #e8f5e8;
    color: #2d5a2d;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
}

.description {
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border: 1px dashed transparent;
}

.description:hover {
    background-color: rgba(102, 126, 234, 0.05);
    border-color: #667eea;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress {
    background: linear-gradient(90deg, #4CAF50, #45a049);
    height: 100%;
    transition: width 0.3s ease;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

input[type="text"], textarea {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

.taches {
    margin-top: 15px;
}

.tache {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.tache:hover {
    background: #e9ecef;
}

.tache:hover .tache-actions {
    display: block !important;
}

.tache.terminee {
    opacity: 0.6;
    background: #e8f5e8;
}

.tache.terminee .tache-titre {
    text-decoration: line-through;
    color: #666;
}

.tache-titre {
    flex: 1;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tache-titre:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.tache-actions {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.checkbox {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    margin-right: 10px;
    transition: transform 0.2s ease;
}

.checkbox:hover {
    transform: scale(1.1);
}


.no-taches {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 500px;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #667eea;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Boutons supplémentaires */
.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Page de connexion */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container .card {
    max-width: 400px;
    width: 100%;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    .checklist-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-inline {
        flex-direction: column;
    }
    
    .tache {
        flex-wrap: wrap;
    }
    
    .checklist-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-content {
        margin: 20px;
        min-width: auto;
    }
}

/* Styles pour les nouvelles fonctionnalités */

/* Drag & Drop pour les tâches */
.tache {
    position: relative;
    transition: all 0.3s ease;
}

.tache.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.tache.drag-over {
    border-top: 3px solid #007bff;
    margin-top: 5px;
}

.drag-handle {
    cursor: grab;
    color: #999;
    font-size: 16px;
    padding: 5px;
    margin-right: 10px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.drag-handle:hover {
    color: #007bff;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Contenu des tâches */
.tache-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tache-description {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    min-height: 20px;
}

.tache-description:hover {
    background-color: #f8f9fa;
}

.tache-description.placeholder {
    color: #999;
    font-style: italic;
}

.tache-description.placeholder:hover {
    background-color: #e9ecef;
}

/* Amélioration de l'affichage des tâches */
.tache {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
    transition: all 0.2s ease;
}

.tache:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.tache.terminee {
    background: #f8f9fa;
    opacity: 0.7;
}

.tache.terminee .tache-titre {
    text-decoration: line-through;
    color: #6c757d;
}

.tache.terminee .tache-description {
    color: #adb5bd;
}

/* Zone de drop pour réorganiser */
.taches {
    min-height: 50px;
    transition: all 0.3s ease;
}

.taches.drag-active {
    background: #f8f9fa;
    border: 2px dashed #007bff;
    border-radius: 8px;
}

/* Indicateur de position de drop */
.drop-indicator {
    height: 3px;
    background: #007bff;
    margin: 5px 0;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.drop-indicator.active {
    opacity: 1;
}

/* Amélioration des modals */
.modal-content textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Animation pour les tâches qui changent d'ordre */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tache.slide-in {
    animation: slideIn 0.3s ease;
}

/* ===== STYLES POUR LES CATÉGORIES ===== */

/* Panneau des catégories */
.categories-panel {
    margin-bottom: 20px;
}

.categories-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.categories-tree {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    background: white;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.category-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.category-item.root {
    font-weight: bold;
    background: #f8f9fa;
}

.category-item.sub {
    margin-left: 20px;
    background: #ffffff;
    border-left: 3px solid #007bff;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.category-icon {
    font-size: 16px;
}

.category-name {
    font-weight: 500;
}

.category-count {
    color: #6c757d;
    font-size: 0.9em;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.category-actions .btn {
    padding: 4px 8px;
    font-size: 0.8em;
}

/* Affichage des catégories dans les checklists */
.checklist-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.checklist-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    font-size: 0.9em;
    font-weight: 500;
    padding: 5px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checklist-category:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.category-name {
    flex: 1;
}

.category-name.placeholder {
    color: #6c757d;
    font-style: italic;
}

.category-arrow {
    font-size: 0.8em;
    color: #6c757d;
    transition: transform 0.2s ease;
}

.checklist-category:hover .category-arrow {
    transform: rotate(180deg);
}

.parent-category {
    color: #6c757d;
    font-size: 0.8em;
    font-style: italic;
}

/* Liste des catégories dans le modal */
.category-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.category-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    background: white;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-list-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-list-item.sub {
    margin-left: 20px;
    border-left: 3px solid #007bff;
}

/* Panneau des filtres */
.category-filters-panel {
    margin-bottom: 20px;
}

/* Filtres par catégorie */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.category-filter {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    user-select: none;
}

.category-filter:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-filter.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.filter-icon {
    font-size: 16px;
}

.filter-name {
    font-weight: 500;
}

.filter-count {
    font-size: 0.8em;
    opacity: 0.8;
    margin-left: 5px;
}

/* Animation pour les filtres */
.category-filter {
    position: relative;
    overflow: hidden;
}

.category-filter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.category-filter:hover::before {
    left: 100%;
}

/* Formulaires de catégorie */
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input[type="color"] {
    width: 50px;
    height: 35px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* Drag & Drop pour les catégories */
.category-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.category-item.drag-over {
    border-left: 3px solid #007bff;
    background: #f8f9fa;
}

.category-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.category-item:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-item:active {
    transform: translateY(0);
}

/* Indicateur de niveau pour la hiérarchie */
.category-item[data-level="0"] {
    font-weight: bold;
}

/* Catégorie active (filtrée) */
.category-item.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.category-item.active:hover {
    background: #0056b3;
}

.category-item[data-level="1"] {
    border-left: 2px solid #007bff;
}

.category-item[data-level="2"] {
    border-left: 2px solid #28a745;
}

.category-item[data-level="3"] {
    border-left: 2px solid #ffc107;
}

.category-item[data-level="4"] {
    border-left: 2px solid #dc3545;
}

/* Sélecteur de catégorie pour les checklists */
.category-selector {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 0.9em;
    margin-right: 10px;
    min-width: 150px;
}

.category-selector:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Amélioration de l'affichage des actions de checklist */
.checklist-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive pour les catégories */
@media (max-width: 600px) {
    .categories-tree {
        max-height: 200px;
    }
    
    .category-item.sub {
        margin-left: 10px;
    }
    
    .category-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-filter {
        justify-content: center;
    }
    
    .category-selector {
        min-width: 120px;
        font-size: 0.8em;
    }
}
