@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #2d3748;
    line-height: 1.6;
    font-weight: 400;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

header p {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 35px 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(10px);
}

.activity-selector {
    display: flex;
    align-items: center;
    gap: 20px;
}

.activity-selector label {
    font-weight: 600;
    color: #374151;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

#activitySelect {
    padding: 14px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    font-weight: 500;
}

#activitySelect:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.activity-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.activity-option-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.month-navigation {
    display: flex;
    align-items: center;
    gap: 25px;
}

.month-navigation button {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    letter-spacing: -0.01em;
}

.month-navigation button:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.month-navigation button:active {
    transform: translateY(0);
}

.actions {
    display: flex;
    gap: 12px;
}

.clear-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    letter-spacing: -0.01em;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

#currentMonth {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1f2937;
    min-width: 220px;
    text-align: center;
    letter-spacing: -0.02em;
}

.calendar-container {
    padding: 40px 30px;
    background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
}

.calendar {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 16px;
    padding: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.day-header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: white;
    padding: 18px 12px;
    text-align: center;
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.week-total-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    padding: 18px 12px;
    text-align: center;
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.day-cell {
    background: white;
    min-height: 90px;
    padding: 8px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.day-cell:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.day-cell.has-activity {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
}

.day-number {
    font-weight: 700;
    color: #374151;
    margin-bottom: 4px;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.activity-hours {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    border-left: 4px solid;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.hours-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hours-count {
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    font-size: 0.75rem;
    color: #374151;
}

.control-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.control-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

.control-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.legend {
    padding: 40px 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
}

.legend h3 {
    color: #1f2937;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border-left: 4px solid;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend-name {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.summary {
    padding: 40px 30px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-top: 1px solid #e2e8f0;
}

.summary h3 {
    color: #1f2937;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.summary-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.summary-item-name {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.summary-item-hours {
    font-weight: 700;
    font-size: 1.2rem;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.other-month {
    color: #9ca3af;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    opacity: 0.6;
}

.other-month .day-number {
    color: #9ca3af;
}

.week-total-cell {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 90px;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: default;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.week-total-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.95);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    border-left: 4px solid;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

.week-total-hours {
    font-weight: 700;
    color: #374151;
    letter-spacing: -0.01em;
}

/* Styles pour l'authentification */
.login-screen, .change-password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.login-container, .change-password-container {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(20px);
}

.login-header, .change-password-header {
    margin-bottom: 35px;
}

.login-header h1, .change-password-header h1 {
    color: #1f2937;
    font-size: 2.2rem;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-header p, .change-password-header p {
    color: #6b7280;
    font-size: 1.1rem;
    font-weight: 400;
}

.login-form, .change-password-form {
    text-align: left;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fafbfc;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.form-group input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: white;
    transform: translateY(-1px);
}

.form-group small {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 8px;
    display: block;
    font-weight: 400;
}

.btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.4);
}

.login-footer {
    margin-top: 25px;
    text-align: center;
}

.admin-link {
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-link:hover {
    color: #4338ca;
    text-decoration: underline;
}

.user-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-actions .btn {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Styles pour l'application principale */
.container header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.container header h1 {
    margin-bottom: 0;
}

.container header p {
    margin-bottom: 0;
    font-size: 1rem;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 16px;
    }
    
    .controls {
        flex-direction: column;
        gap: 25px;
        align-items: stretch;
        padding: 25px 20px;
    }
    
    .activity-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    #activitySelect {
        min-width: auto;
        padding: 12px 18px;
    }
    
    .calendar {
        gap: 2px;
        padding: 8px;
    }
    
    .day-cell {
        min-height: 85px;
        padding: 6px;
    }
    
    .activity-item {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
    
    .control-btn {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .container header {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
    
    .container header h1 {
        font-size: 2.2rem;
    }
    
    .user-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .month-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    #currentMonth {
        font-size: 1.4rem;
        min-width: auto;
    }
    
    .legend, .summary {
        padding: 25px 20px;
    }
    
    .legend-items, .summary-content {
        gap: 15px;
    }
    
    .login-container, .change-password-container {
        margin: 20px;
        padding: 40px 30px;
    }
}

/* Styles pour les messages d'erreur */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
    z-index: 1001;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

.error-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.error-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
