/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@300;400;500;600;700&display=swap');

/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 8px;
}

body {
    font-family: 'Lexend Deca', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
    font-weight: 400;
}

/* Layout principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    margin: -20px -20px 30px -20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 300;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
    transition: background 0.3s;
}

.user-info a:hover {
    background: rgba(255,255,255,0.2);
}

/* Pages d'authentification */
.auth-page {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-form {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-form h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2rem;
}

.auth-form h2 {
    color: var(--secondary-color);
    margin-bottom: 30px;
    font-weight: 400;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.form-group small {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

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

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

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

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Alertes */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Liens d'authentification */
.auth-links {
    margin-top: 20px;
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Sélecteur de mois */
.month-selector {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.month-selector h2 {
    color: var(--primary-color);
    margin: 0;
}

#month-selector {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
}

/* Objectifs */
.objectives-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.category-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    font-size: 1.3rem;
    font-weight: 500;
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

.category-icon {
    font-size: 1.8rem;
    opacity: 0.9;
}

.category-title {
    flex: 1;
}

.category-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.category-stats {
    font-weight: 500;
}

.toggle-comments {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toggle-comments:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

.category-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #ecf0f1;
}

.category-progress {
    height: 100%;
    background: var(--success-color);
    transition: width 0.5s ease;
}

.category-mini-stats {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.category-header:hover .category-mini-stats {
    opacity: 1;
}

/* Sur mobile, toujours afficher les stats */
@media (max-width: 768px) {
    .category-mini-stats {
        opacity: 1;
        right: 15px;
    }
    
    .mini-circle {
        min-width: 32px;
        min-height: 32px;
    }
    
    .mini-percentage {
        font-size: 9px;
    }
    
    .mini-count {
        font-size: 11px;
    }
}

.mini-circle {
    position: relative;
    width: calc(90% * 0.8); /* 90% de la hauteur du header (environ 48px) */
    height: calc(90% * 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.mini-circle svg {
    position: absolute;
}

.mini-circle-progress {
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

.mini-percentage {
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    position: absolute;
}

.mini-count {
    font-size: 13px;
    color: white;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.objectives-list {
    padding: 20px;
}

.objective-item {
    padding: 15px 0;
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.3s;
}

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

.objective-item:hover {
    background: #f8f9fa;
}

.objective-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.objective-checkbox {
    transform: scale(1.2);
    flex-shrink: 0;
}

.objective-text {
    flex: 1;
    font-weight: 500;
    color: var(--secondary-color);
    line-height: 1.4;
}

.toggle-individual-comment {
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.toggle-individual-comment:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

.objective-comment-container {
    margin-top: 10px;
    margin-left: 32px; /* Aligné avec le texte */
}

.objective-comment {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    resize: vertical;
    min-height: 70px;
    font-size: 14px;
    font-family: inherit;
}

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

/* Statistiques */
.stats-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.stats-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #ecf0f1;
    transition: transform 0.3s, border-color 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

.progress-bar-container {
    background: #ecf0f1;
    border-radius: 20px;
    height: 20px;
    overflow: hidden;
    margin: 20px 0;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #2ecc71);
    border-radius: 20px;
    transition: width 1s ease;
    position: relative;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    font-size: 0.9rem;
}

/* Réflexions du mois */
.reflections-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.reflections-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.monthly-reflections {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.monthly-reflections:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

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

.circular-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.circle-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 20px;
}

.progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
}

.progress-bg {
    stroke: #ecf0f1;
}

.progress-bar-circle {
    stroke: var(--success-color);
    stroke-dasharray: 440; /* 2 * π * 70 (rayon) */
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-animate {
    /* Cette classe sera ajoutée pour déclencher l'animation */
}

.progress-warning {
    stroke: var(--warning-color);
}

.progress-danger {
    stroke: var(--danger-color);
}

.progress-text-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.progress-detail {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Statistiques par catégorie - Version compacte */
.category-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.category-stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-left: 3px solid var(--success-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.category-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.category-stat-card.category-stat-danger {
    border-left-color: var(--danger-color);
}

.category-stat-card.category-stat-warning {
    border-left-color: var(--warning-color);
}

.category-stat-card.category-stat-success {
    border-left-color: var(--success-color);
}

.category-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

.category-stat-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.2;
}

.category-stat-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.category-stat-percentage {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.category-stat-count {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.category-stat-bar {
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    overflow: hidden;
}

.category-stat-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-stat-danger .category-stat-fill {
    background: var(--danger-color);
}

.category-stat-warning .category-stat-fill {
    background: var(--warning-color);
}

.stats-actions {
    text-align: center;
    margin-top: 30px;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

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

.page-header h2 {
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-selector select {
    padding: 8px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
}

.yearly-overview {
    margin-bottom: 30px;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.overview-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease;
}

.overview-card:hover {
    transform: translateY(-2px);
}

.overview-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.overview-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.overview-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    height: 400px;
}

.chart-container h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.chart-container canvas {
    height: 300px !important;
}

.monthly-breakdown {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.monthly-breakdown h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.monthly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.monthly-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid var(--success-color);
    transition: transform 0.2s ease;
}

.monthly-card:hover {
    transform: translateY(-2px);
}

.monthly-card.success {
    border-left-color: var(--success-color);
}

.monthly-card.warning {
    border-left-color: var(--warning-color);
}

.monthly-card.danger {
    border-left-color: var(--danger-color);
}

.monthly-card h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.monthly-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.monthly-percentage {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.monthly-count {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.monthly-progress {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

.monthly-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 3px;
    transition: width 0.8s ease;
}

.monthly-card.warning .monthly-fill {
    background: var(--warning-color);
}

.monthly-card.danger .monthly-fill {
    background: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        margin: -10px -10px 20px -10px;
        padding: 20px;
    }
    
    .month-selector {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .category-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        align-items: center;
    }
    
    .category-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .objective-main {
        gap: 8px;
    }
    
    .objective-comment-container {
        margin-left: 15px;
    }
    
    .stats-visual {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .category-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .category-stat-card {
        padding: 12px;
    }
    
    .category-stat-title {
        font-size: 0.85rem;
    }
    
    .category-stat-percentage {
        font-size: 1.1rem;
    }
    
    .auth-form {
        padding: 30px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Responsive pour les stats annuelles */
    .page-header {
        flex-direction: column;
        text-align: center;
    }
    
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .monthly-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    .category-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .overview-cards {
        grid-template-columns: 1fr;
    }
    
    .circular-progress .progress-text-center {
        font-size: 1.8rem;
    }
    
    .objective-text {
        font-size: 0.9rem;
    }
    
    .category-icon {
        font-size: 1.5rem;
    }
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Utilitaires */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }