/* Reset et styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

header h1 {
    color: #2d3748;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

/* Layout principal */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    align-items: start;
}

/* Section Calendrier */
.calendar-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.calendar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

.calendar-header h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.week-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.week-navigation button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.week-navigation button:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.week-navigation h3 {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Calendrier hebdomadaire */
.weekly-calendar {
    display: flex;
    background: white;
    min-height: 800px;
    border-top: 1px solid #e2e8f0;
}

.time-column {
    width: 80px;
    background: #f8f9fa;
    border-right: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.time-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #4a5568;
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e0;
    font-size: 0.9rem;
}

.time-slots {
    position: relative;
}

.time-slot {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #718096;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
}

.time-slot:nth-child(even) {
    background: #f9fafb;
}

/* Conteneur des jours */
.days-container {
    display: flex;
    flex: 1;
    min-width: 0;
}

.day-column {
    flex: 1;
    border-right: 1px solid #e2e8f0;
    min-width: 0;
}

.day-column:last-child {
    border-right: none;
}

.day-header {
    height: 80px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.day-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 4px;
}

.day-date {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

.day-name.today, .day-date.today {
    color: #667eea;
}

.day-grid {
    position: relative;
    height: 1440px; /* 24 heures × 60px */
}

.hour-slot {
    height: 60px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.hour-slot:hover {
    background: #f0f9ff;
}

.hour-slot:nth-child(even) {
    background: #fafbfc;
}

.hour-slot:nth-child(even):hover {
    background: #e6f3ff;
}

/* Événements */
.event-block {
    position: absolute;
    left: 2px;
    right: 2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.event-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 6;
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

.event-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    line-height: 1.2;
}

.event-time {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 2px;
}

.event-description {
    font-size: 0.7rem;
    opacity: 0.8;
    line-height: 1.1;
    margin-top: 4px;
}

.event-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
}

.event-block:hover .event-delete {
    opacity: 1;
}

.event-delete:hover {
    background: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}

/* Formulaire d'événement */
.event-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.event-form:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.event-form h3 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.event-form select,
.event-form input,
.event-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.event-form select:focus,
.event-form input:focus,
.event-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.event-form textarea {
    resize: vertical;
    font-family: inherit;
}

.event-form button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.event-form button:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* Section Objectifs */
.objectives-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.objectives-section h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.8rem;
    text-align: center;
    font-weight: 600;
}

.daily-objectives, .weekly-objectives {
    margin-bottom: 30px;
}

.daily-objectives h3, .weekly-objectives h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.objective-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.objective-form input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.objective-form input:focus {
    outline: none;
    border-color: #667eea;
}

.objective-form button {
    padding: 10px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.objective-form button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* Éléments d'objectif */
.objective-item {
    background: #fafbfc;
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.objective-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-color: #cbd5e0;
}

.objective-item.completed {
    background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
    border-color: #48bb78;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.2);
}

.objective-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.objective-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
    flex: 1;
}

.objective-item.completed .objective-title {
    color: #2f855a;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
}

.objective-item.completed .progress-fill {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.progress-text {
    font-weight: 700;
    color: #4a5568;
    min-width: 40px;
    text-align: right;
    font-size: 0.9rem;
}

.progress-controls {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.progress-controls button {
    padding: 6px 10px;
    background: #a0aec0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.progress-controls button:hover {
    background: #718096;
    transform: scale(1.05);
}

.complete-btn {
    background: #48bb78 !important;
    padding: 6px 12px !important;
    font-weight: 600 !important;
}

.complete-btn:hover {
    background: #38a169 !important;
}

.delete-btn {
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.delete-btn:hover {
    background: #c53030;
    transform: scale(1.1);
}

.no-objectives {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 20px;
}

/* Statistiques */
.stats {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.stats h3 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 0.95rem;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span:last-child {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .objectives-section {
        position: static;
    }
}

@media (max-width: 768px) {
    .weekly-calendar {
        min-height: 600px;
    }
    
    .time-column {
        width: 60px;
    }
    
    .time-slot {
        height: 40px;
        font-size: 0.7rem;
    }
    
    .hour-slot {
        height: 40px;
    }
    
    .day-grid {
        height: 960px; /* 24 × 40px */
    }
    
    .day-header {
        height: 60px;
    }
    
    .day-name {
        font-size: 0.8rem;
    }
    
    .day-date {
        font-size: 1rem;
    }
    
    .event-block {
        font-size: 0.7rem;
        padding: 6px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .event-form {
        padding: 18px;
        margin-bottom: 20px;
    }
    
    .event-form h3 {
        font-size: 1.1rem;
    }
    
    .week-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .week-navigation button {
        width: 100%;
        max-width: 200px;
    }
    
    .progress-controls {
        gap: 4px;
    }
    
    .progress-controls button {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .calendar-section, .objectives-section {
        padding: 15px;
    }
    
    .event-form {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .weekly-calendar {
        overflow-x: auto;
    }
    
    .days-container {
        min-width: 500px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
    
    .info-label {
        min-width: 80px;
        font-size: 0.9rem;
    }
}

/* Modale */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeInOverlay 0.3s ease-out;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideInModal 0.3s ease-out;
    border: 1px solid #e2e8f0;
    word-wrap: break-word;
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
}

.modal-info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.modal-info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: #4a5568;
    min-width: 100px;
    margin-right: 15px;
    font-size: 0.95rem;
}

.modal-info-item span:last-child,
.modal-info-item div:last-child {
    color: #2d3748;
    font-size: 1rem;
    line-height: 1.5;
    flex: 1;
}

#modalEventDescription {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 8px;
    font-style: italic;
    color: #4a5568;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: none;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.6;
}

.modal-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
}

.modal-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.edit-btn {
    background: #667eea;
    color: white;
}

.edit-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.delete-btn {
    background: #e53e3e;
    color: white;
}

.delete-btn:hover {
    background: #c53030;
    transform: translateY(-2px);
}

.close-btn {
    background: #a0aec0;
    color: white;
}

.close-btn:hover {
    background: #718096;
    transform: translateY(-2px);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.objective-item, .event-block {
    animation: slideIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.objective-item.completed {
    animation: pulse 2s ease-in-out infinite;
}