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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header h1 {
    color: #2196F3;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #f44336;
    transition: background-color 0.3s ease;
}

.status-indicator.online {
    background-color: #4CAF50;
}

.status-indicator.syncing {
    background-color: #FF9800;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.sync-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.sync-label {
    font-size: 0.9rem;
    color: #666;
}

/* Filter buttons */
.filter-buttons {
    display: flex;
    gap: 5px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

.filter-btn.active {
    background-color: #2196F3;
    color: white;
    border-color: #2196F3;
}

/* Todo input */
.todo-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.todo-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.todo-input:focus {
    border-color: #2196F3;
}

.add-btn {
    padding: 12px 20px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 50px;
    height: 50px;
}

.add-btn:hover {
    background-color: #1976D2;
}

.add-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Todo list */
.todo-list {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    min-height: 200px;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
    animation: slideIn 0.3s ease;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:hover {
    background-color: #f9f9f9;
}

.todo-item.completed {
    opacity: 0.6;
}

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

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

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

.todo-text {
    flex: 1;
    font-size: 1rem;
    word-break: break-word;
}

.todo-delete {
    background: none;
    border: none;
    color: #f44336;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.todo-delete:hover {
    background-color: #ffebee;
}

/* Todo stats */
.todo-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 0.9rem;
    color: #666;
}

.clear-btn {
    background: none;
    border: 1px solid #f44336;
    color: #f44336;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background-color: #f44336;
    color: white;
}

.clear-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.clear-btn:disabled:hover {
    background-color: transparent;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    display: none;
    animation: slideDown 0.3s ease;
}

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

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 1.1rem;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 600px) {
    #app {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .todo-input-container {
        flex-direction: column;
    }
    
    .add-btn {
        align-self: center;
        border-radius: 25px;
    }
    
    .todo-stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    .todo-list,
    .todo-stats {
        background-color: #1e1e1e;
    }
    
    .todo-input {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .filter-btn {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .filter-btn:hover {
        background-color: #333;
    }
    
    .todo-item {
        border-bottom-color: #333;
    }
    
    .todo-item:hover {
        background-color: #2a2a2a;
    }
}