/**
 * ===================================================
 * STYLES.CSS v5.0 - Styles complets et corrigés
 * ===================================================
 */

/* VARIABLES */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* HEADER */
.app-header {
    background: white;
    padding: 20px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left h1 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.week-info {
    color: #666;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-display {
    font-weight: 600;
    color: var(--primary-color);
    padding: 8px 15px;
    background: var(--light-color);
    border-radius: 20px;
}

/* NAVIGATION */
.app-nav {
    background: white;
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--light-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    min-width: 150px;
}

.tab-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

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

/* CONTENUS DES ONGLETS */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* SECTION ARGENT */
.money-section {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.money-section h2 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.money-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.money-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.money-card.punishment-active {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
    animation: pulse 2s infinite;
}

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

.money-card h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.money-amount {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.money-details {
    font-size: 14px;
}

.points-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.points-line.bonus {
    color: #ffd700;
    font-weight: bold;
}

.punishment-warning {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    animation: blink 1s infinite;
}

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

/* SECTION DRAFT */
.draft-panel {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    border-left: 5px solid var(--info-color);
}

.draft-panel h3 {
    color: var(--info-color);
    margin-bottom: 10px;
    font-size: 22px;
}

.draft-panel p {
    color: #666;
    margin-bottom: 15px;
}

.draft-waiting {
    text-align: center;
    border-left-color: var(--warning-color);
}

.draft-waiting h3 {
    color: var(--warning-color);
}

.progress-info {
    background: var(--light-color);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.available-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.draft-task-card {
    background: white;
    border: 2px solid var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.draft-task-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}

.draft-task-card .task-name {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.draft-task-card .task-details {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.btn-select {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-select:hover {
    background: #0056b3;
}

.spinner {
    border: 4px solid var(--light-color);
    border-top: 4px solid var(--warning-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* SECTIONS */
.tasks-section, .extra-section, .stats-section, .admin-section {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.tasks-section h2, .extra-section h2, .stats-section h2, .admin-section h2 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 22px;
}

/* USER SECTIONS */
.user-section {
    margin-bottom: 30px;
}

.user-section h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.category-section {
    margin-bottom: 25px;
}

.category-section h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

/* GRILLE DE TÂCHES */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* CARTE DE TÂCHE */
.task-card {
    background: white;
    border: 2px solid var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.task-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

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

.task-card.not-my-turn {
    opacity: 0.6;
    background: #f8f9fa;
}

.task-card.help-pending {
    border-color: var(--info-color);
    background: #e7f5ff;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.task-name {
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
}

.badge-alternating {
    background: var(--info-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

.task-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.task-points {
    font-weight: 600;
    color: var(--primary-color);
}

.task-turn {
    background: var(--warning-color);
    color: #333;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.task-counter {
    text-align: center;
    margin: 10px 0;
}

.counter-display {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.btn-task {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    background: var(--primary-color);
    color: white;
}

.btn-task:hover {
    background: #0056b3;
    transform: scale(1.02);
}

.btn-task.btn-completed {
    background: var(--success-color);
}

.btn-help {
    width: 100%;
    padding: 10px;
    background: var(--info-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-help:hover {
    background: #138496;
}

.help-status {
    text-align: center;
    padding: 10px;
    background: var(--warning-color);
    border-radius: 5px;
    font-weight: 600;
}

.help-validation {
    background: #fff3cd;
    border: 2px solid var(--warning-color);
    padding: 12px;
    border-radius: 5px;
    margin-top: 10px;
}

.help-message {
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}

.help-actions {
    display: flex;
    gap: 10px;
}

.help-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

/* TÂCHES BONUS */
.extra-form {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.extra-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 10px;
}

.extra-form-row {
    display: flex;
    gap: 10px;
}

.extra-form select {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.extra-tasks-container, .extra-tasks-admin-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.extra-task-card {
    background: white;
    border: 2px solid var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.extra-task-card.status-pending {
    border-color: var(--warning-color);
}

.extra-task-card.status-approved {
    border-color: var(--success-color);
    background: #f0fff4;
}

.extra-task-card.status-rejected {
    border-color: var(--danger-color);
    background: #fff5f5;
}

.extra-task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status-badge {
    font-size: 20px;
}

.status-text {
    font-weight: 600;
}

.extra-task-description {
    margin-bottom: 10px;
    color: var(--dark-color);
}

.extra-task-user {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.extra-task-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.category-badge {
    padding: 3px 8px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
}

.category-badge.category-easy {
    background: var(--success-color);
}

.category-badge.category-medium {
    background: var(--warning-color);
    color: #333;
}

.category-badge.category-hard {
    background: var(--danger-color);
}

.extra-task-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.points-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
}

/* AIDE */
.help-requests-admin-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.help-request-card {
    background: white;
    border: 2px solid var(--info-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.help-request-info {
    margin-bottom: 15px;
    line-height: 1.6;
}

.help-request-actions {
    display: flex;
    gap: 10px;
}

/* STATISTIQUES */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.stats-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.stats-card h3 {
    margin-bottom: 20px;
    font-size: 22px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.progress-bar {
    margin-top: 15px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    transition: width 0.5s ease;
}

/* ADMINISTRATION */
.config-form {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.form-row label {
    font-weight: 600;
    flex: 1;
}

.form-row input, .form-row select {
    flex: 0 0 200px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.punishment-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.punishment-form select, .punishment-form input {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.punishments-admin-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.punishment-card {
    background: white;
    border: 2px solid var(--danger-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.punishment-user {
    font-weight: bold;
    color: var(--danger-color);
    margin-bottom: 8px;
}

.punishment-reason {
    margin-bottom: 10px;
    color: var(--dark-color);
}

.punishment-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

/* BOUTONS */
.btn-primary, .btn-success, .btn-danger, .btn-rules, .btn-logout {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-rules {
    background: var(--info-color);
    color: white;
}

.btn-rules:hover {
    background: #138496;
}

.btn-logout {
    background: var(--dark-color);
    color: white;
    text-decoration: none;
    display: inline-block;
}

.btn-logout:hover {
    background: #23272b;
}

.btn-large {
    padding: 15px 30px;
    font-size: 18px;
}

/* UTILITAIRES */
.no-data {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

.help-text {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
    font-style: italic;
}

.text-muted {
    color: #6c757d;
}

.loading-spinner {
    border: 4px solid var(--light-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

/* NOTIFICATIONS */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--success-color);
    color: white;
}

.notification-error {
    background: var(--danger-color);
    color: white;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .app-header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .tasks-grid, .available-tasks-grid, .stats-container, 
    .extra-tasks-container, .money-container {
        grid-template-columns: 1fr;
    }
    
    .app-nav {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-row input, .form-row select {
        flex: 1;
        width: 100%;
    }
}

/* MODAL RÈGLES */
.rules-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
    align-items: center;
    justify-content: center;
}

.rules-content {
    background: white;
    max-width: 900px;
    width: 100%;
    margin: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.rules-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.rules-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.close-rules {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 36px;
    color: white;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-rules:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.rules-body {
    padding: 30px;
}

.rule-section {
    margin-bottom: 30px;
}

.rule-section h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 24px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.rule-section h3 {
    color: var(--dark-color);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.rule-section p, .rule-section li {
    line-height: 1.8;
    color: #333;
    margin-bottom: 10px;
}

.rule-section ul, .rule-section ol {
    margin-left: 25px;
}

.example-box {
    background: var(--light-color);
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    margin: 15px 0;
    border-radius: 5px;
}

.formula-box {
    background: #fff3cd;
    padding: 15px;
    border-left: 4px solid var(--warning-color);
    margin: 15px 0;
    border-radius: 5px;
    font-family: monospace;
    font-weight: 600;
}

.warning-box {
    background: #f8d7da;
    padding: 15px;
    border-left: 4px solid var(--danger-color);
    margin: 15px 0;
    border-radius: 5px;
}

.tip-box {
    background: #d1ecf1;
    padding: 15px;
    border-left: 4px solid var(--info-color);
    margin: 15px 0;
    border-radius: 5px;
}
