* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #22c55e;
    --success-dark: #16a34a;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
}

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

.header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Navigation */
.nav-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.tab-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

/* Vues */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Aujourd'hui */
.today-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.today-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.today-header p {
    opacity: 0.9;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.progress-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.progress-number {
    font-size: 1.5rem;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 0.75rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 9999px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Grille des tâches */
.tasks-grid {
    display: grid;
    gap: 1.5rem;
}

.child-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.child-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.child-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.child-header h3 {
    font-size: 1.5rem;
    color: var(--gray-800);
}

.tasks-list {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-300);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.task-item:hover {
    background: var(--gray-100);
}

.task-item.completed {
    background: #dcfce7;
    border-color: var(--success);
}

.task-item.completed:hover {
    background: #bbf7d0;
}

.task-text {
    font-size: 1.1rem;
    color: var(--gray-800);
    transition: all 0.2s;
}

.task-item.completed .task-text {
    color: var(--success-dark);
    text-decoration: line-through;
}

.task-checkbox {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.task-item.completed .task-checkbox {
    background: var(--success);
}

.checkmark {
    display: none;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
}

.task-item.completed .checkmark {
    display: block;
}

/* Historique */
.history-item {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.history-item.today {
    border: 2px solid var(--primary);
}

.history-header {
    padding: 1.5rem;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.history-item.today .history-header {
    background: #dbeafe;
}

.history-info h3 {
    font-size: 1.25rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    text-transform: capitalize;
}

.history-info p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.history-stats {
    text-align: right;
}

.history-score {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gray-600);
}

.history-score.complete {
    color: var(--success);
}

.history-label {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.history-tasks {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.history-child {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-child h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.history-task {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.history-task-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-task-icon.completed {
    background: var(--success);
}

.history-task-icon.incomplete {
    background: var(--gray-300);
}

.history-task-text {
    color: var(--gray-700);
}

.history-task-text.completed {
    text-decoration: line-through;
    color: var(--gray-500);
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.stat-card h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

.child-stats {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.child-stats h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

.child-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.child-name {
    font-weight: 600;
    color: var(--gray-800);
}

.child-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

/* Loading & Error */
.loading, .error {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.spinner {
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.hidden {
    display: none !important;
}

.error {
    background: #fee2e2;
    color: var(--danger);
}

.error button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.error button:hover {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .history-header {
        flex-direction: column;
        text-align: center;
    }

    .history-stats {
        text-align: center;
    }
}
