/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* En-tête de l'application */
.app-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

.app-header h1 {
    font-size: 2.5rem;
    color: #3f51b5;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.app-header p {
    color: #777;
    font-size: 1.1rem;
}

/* Contenu principal */
.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Section de l'application ToDo */
.todo-app {
    padding: 30px;
}

/* Zone de saisie des tâches */
.todo-input-container {
    display: flex;
    margin-bottom: 25px;
    gap: 10px;
}

.todo-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.todo-input:focus {
    outline: none;
    border-color: #3f51b5;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.2);
}

.add-btn {
    background: #3f51b5;
    color: white;
    border: none;
    border-radius: 8px;
    width: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.add-btn:hover {
    background: #303f9f;
    transform: scale(1.05);
}

.add-btn:active {
    transform: scale(0.98);
}

/* Filtres */
.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background: #f5f5f5;
}

.filter-btn.active {
    background: #3f51b5;
    color: white;
    border-color: #3f51b5;
}

/* Liste des tâches */
.todo-list {
    list-style: none;
    margin-bottom: 25px;
    min-height: 200px;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeIn 0.3s ease;
}

.todo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0.08);
}

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

.todo-checkbox {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3f51b5;
}

.todo-text {
    flex: 1;
    font-size: 1.1rem;
    word-break: break-word;
    padding-right: 15px;
}

.todo-text.completed {
    text-decoration: line-through;
    color: #999;
}

.delete-btn {
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
}

.delete-btn:hover {
    background: #e00000;
    transform: scale(1.1);
}

/* Statistiques et bouton de nettoyage */
.todo-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.items-left {
    color: #777;
    font-size: 0.9rem;
}

.sync-status {
    display: flex;
    align-items: center;
    margin: 0 15px;
}

.sync-status-text {
    font-size: 0.8rem;
    color: #27ae60;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sync-status-text.syncing {
    color: #f39c12;
}

.sync-status-text.error {
    color: #e74c3c;
}

.clear-btn {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.clear-btn:hover {
    background: #f57c00;
}

/* Pied de page */
.app-footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #777;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .todo-app {
        padding: 20px;
    }
    
    .todo-input-container {
        flex-direction: column;
    }
    
    .add-btn {
        width: 100%;
    }
    
    .filters {
        flex-wrap: wrap;
    }
    
    .todo-stats {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .clear-btn {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.7rem;
    }
    
    .todo-input-container {
        gap: 8px;
    }
    
    .todo-item {
        padding: 12px;
    }
    
    .todo-text {
        font-size: 1rem;
    }
}

/* Animation pour les tâches terminées */
.completed-animation {
    animation: completedEffect 0.5s ease;
}

@keyframes completedEffect {
    0% { background-color: #f9f9f9; }
    50% { background-color: #e8f5e9; }
    100% { background-color: #f9f9f9; }
}

/* Indicateur de mode hors ligne */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff9800;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: none;
}

.offline-indicator.show {
    display: block;
}