/* ===== CALENDRIER FUTURISTE APERTURE SCIENCE ===== */

:root {
    --primary: #ff6b35;
    --primary-dark: #e55a2b;
    --secondary: #2c3e50;
    --dark: #1a1a1a;
    --darker: #0d1117;
    --light: #f8f9fa;
    --text: #e0e0e0;
    --text-muted: #8b949e;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border: #30363d;
    --gradient: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--darker);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== CONTAINER PRINCIPAL ===== */
.calendar-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
    position: relative;
}

/* ===== HEADER ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 107, 53, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.calendar-header h1 {
    font-size: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.current-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.view-controls {
    display: flex;
    gap: 5px;
    background: var(--dark);
    border-radius: 8px;
    padding: 4px;
}

.btn-view {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view.active,
.btn-view:hover {
    background: var(--primary);
    color: white;
}

/* ===== NAVIGATION ===== */
.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    background: rgba(44, 62, 80, 0.1);
    backdrop-filter: blur(5px);
}

.nav-btn {
    background: var(--dark);
    border: 1px solid var(--border);
    color: var(--text);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

#periodTitle {
    font-size: 1.8rem;
    font-weight: 300;
    min-width: 300px;
    text-align: center;
}

/* ===== GRILLE CALENDRIER ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin: 20px;
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.calendar-day {
    background: var(--dark);
    min-height: 120px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.calendar-day:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    border-color: var(--primary);
}

.calendar-day.other-month {
    opacity: 0.3;
    background: var(--darker);
}

.day-number {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-item {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}


.event-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    z-index: 10;
}

.event-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-actions-mini {
    display: none;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.event-item:hover .event-actions-mini {
    display: flex;
    opacity: 1;
}

.event-btn-mini {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.event-btn-mini:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.event-btn-mini.edit:hover {
    background: var(--warning);
}

.event-btn-mini.delete:hover {
    background: var(--danger);
}

.event-btn-mini.move:hover {
    background: var(--success);
}

/* ===== JAUGE DE PROGRESSION ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.event-item.task {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 8px;
}

.event-item.task .event-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.task-progress {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* ===== HEADER PERSONNALISABLE ===== */
.calendar-header {
    position: relative;
    overflow: hidden;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    z-index: -1;
}

.header-emoji {
    font-size: 2rem;
    margin-right: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.header-emoji:hover {
    transform: scale(1.2) rotate(10deg);
}

.header-customization {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 5px;
    display: flex;
    gap: 5px;
}

.header-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== DRAG & DROP ===== */
.event-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
}

.calendar-day.drag-over {
    background: rgba(255, 107, 53, 0.3) !important;
    border-color: var(--primary) !important;
    border-style: dashed !important;
}

.drop-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.calendar-day.drag-over .drop-indicator {
    opacity: 1;
}

/* ===== RESPONSIVE POUR LES BOUTONS ===== */
@media (max-width: 768px) {
    .event-actions-mini {
        display: flex !important;
        opacity: 1 !important;
    }
    
    .event-btn-mini {
        width: 20px;
        height: 20px;
        font-size: 0.8rem;
    }
}

.event-item.high-priority {
    background: var(--danger);
    animation: pulse 2s infinite;
}

.event-item.medium-priority {
    background: var(--warning);
}

.event-item.low-priority {
    background: var(--success);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: var(--dark);
    border-left: 1px solid var(--border);
    transition: right 0.3s ease;
    z-index: 200;
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    background: var(--darker);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-sidebar {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-sidebar:hover {
    background: var(--border);
}

.sidebar-content {
    padding: 20px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--dark);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--darker);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-modal:hover {
    background: var(--border);
}

/* ===== FORMULAIRE ===== */
form {
    padding: 20px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.image-preview {
    margin-top: 10px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ===== BOUTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

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

.btn-secondary:hover {
    background: #34495e;
}

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

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

.btn-today {
    background: var(--success);
    color: white;
    padding: 10px 20px;
}

.btn-today:hover {
    background: #229954;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

.calendar-day {
    animation: slideIn 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-nav {
        gap: 15px;
    }
    
    #periodTitle {
        font-size: 1.4rem;
        min-width: auto;
    }
    
    .calendar-grid {
        margin: 10px;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 5px;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* ===== SCROLLBAR PERSONNALISÉE ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}


/* ===== EMOJI PICKER ===== */
.emoji-picker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.emoji-picker-content {
    background: var(--dark);
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    text-align: center;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.emoji-btn {
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.5rem;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* ===== TASK PROGRESS MODAL ===== */
.progress-bar {
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--warning) 50%, var(--danger) 100%);
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* ===== MOVE MODE ===== */
.calendar-day.move-mode {
    border: 2px dashed var(--primary) !important;
    background: rgba(255, 107, 53, 0.1) !important;
}

.calendar-day.move-mode:hover {
    background: rgba(255, 107, 53, 0.2) !important;
    transform: scale(1.02);
}

/* ===== RESPONSIVE AMÉLIORÉ ===== */
@media (max-width: 1200px) {
    .header-customization {
        position: relative;
        top: auto;
        right: auto;
        background: transparent;
        margin-top: 10px;
    }
    
    .calendar-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .day-header {
        font-size: 0.8rem;
        padding: 10px 5px;
    }
    
    .event-item {
        font-size: 0.7rem;
        padding: 2px 4px;
    }
    
    .event-actions-mini {
        display: flex !important;
        opacity: 1 !important;
    }
}


/* ===== Fin du feuille de style original ===== */


