
:root {
    --color-primary:  #0083A3;
    --color-dark:     #2c3e50;
    --color-event:    #3498db;
    --color-event-hv: #2980b9;
    --color-libre:    #2fa98c;
    --color-occupe:   #c0325e;
    --color-border:   #e0e0e0;
    --color-bg-row:   #f8f9fa;
    --color-text-muted: #666;
    --radius-card:    8px;
    --color-primary: #0083A3;
    --color-success: #2fa98c;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f4f6f8;
    color: #222;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-primary);
    padding: 0.5em 1em;
    position: relative;
    min-height: 60px;
}

header .navbar-brand img {
    height: 50px;
    width: auto;
}

header h1 {
    font-size: clamp(1rem, 3vw, 2rem);
    letter-spacing: 2px;
    color: white;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    max-width: calc(100% - 400px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.formSection {
    margin-left: auto;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.formSection label {
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
    margin: 0;
}

.formSection select,
select {
    max-width: 220px;
    width: auto;
    border-radius: 6px;
    border: none;
    padding: 5px 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

main {
    max-width: 1200px;
    margin: 1.5em auto;
    padding: 0 1rem;
}

.schedule-container {
    background: white;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-primary);
    color: white;
    padding: 10px 16px;
}

#current-week {
    font-weight: 600;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    text-align: center;
    flex: 1;
}

.btn-week {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.btn-week:hover {
    background-color: rgba(255,255,255,0.35);
}

.view-desktop  { display: block; }
.view-mobile   { display: none;  }

.calendar-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar-grid {
    display: grid;
    grid-template-columns: minmax(70px, 100px) repeat(15, minmax(50px, 1fr));
    grid-auto-rows: minmax(50px, 75px);
    gap: 1px;
    background-color: var(--color-border);
    border: 1px solid var(--color-border);
    min-width: 700px;
}

.calendar-grid > div {
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.corner-info {
    grid-column: 1;
    grid-row: 1;
    background-color: var(--color-dark) !important;
    color: white;
    flex-direction: column;
    font-size: 0.75rem;
    text-align: center;
    gap: 2px;
}

.cellule-Heure {
    grid-row: 1;
    background-color: var(--color-bg-row) !important;
    font-weight: bold;
    font-size: 0.68rem;
    border-bottom: 2px solid var(--color-dark);
    color: #444;
}

.day-label {
    grid-column: 1;
    flex-direction: column;
    background-color: var(--color-bg-row) !important;
    font-weight: bold;
    border-right: 2px solid var(--color-dark);
    font-size: 0.8rem;
    gap: 2px;
}

.day-label span {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: normal;
}

.slot-cell {
    border: 0.5px solid #f0f0f0;
}

.event {
    background-color: var(--color-event) !important;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    padding: 4px 6px !important;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s;
}

.event:hover {
    background-color: var(--color-event-hv) !important;
}

.event-subject {
    display: block;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    word-wrap: break-word;
}

.mobile-day-chips {
    display: flex;
    gap: 0.35rem;
    padding: 0.6rem 0.9rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    background: #fafafa;
    -webkit-overflow-scrolling: touch;
}

.mobile-day-chips::-webkit-scrollbar { display: none; }

.day-chip {
    flex-shrink: 0;
    padding: 0.3rem 0.7rem;
    border-radius: 14px;
    font-size: 0.68rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background: white;
    color: #555;
    cursor: pointer;
    text-align: center;
    line-height: 1.3;
    transition: all 0.18s;
}

.day-chip small { display: block; font-size: 0.58rem; opacity: 0.7; }

.day-chip.today-chip {
    border-color: rgba(0,131,163,0.4);
    color: var(--color-primary);
}

.day-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.mobile-body {
    padding: 0.9rem 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
}

.mob-day-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.mob-day-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #222;
    margin: 0;
}

.mob-day-title em {
    color: var(--color-primary);
    font-style: normal;
}

.mob-total {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    background: #f0f0f0;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
}

.mob-event-card {
    background: white;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-event);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.mob-event-card:hover,
.mob-event-card:active {
    box-shadow: 0 2px 8px rgba(0,131,163,0.15);
    border-left-color: var(--color-primary);
}

.mob-event-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.2rem;
}

.mob-event-time,
.mob-event-org {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 0.18rem;
}

.mob-no-ev {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    padding: 1.5rem 0;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.res-dialog {
    border: none;
    background: transparent;
    padding: 0;
    max-width: 450px;
    width: 90%;
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

.res-dialog::backdrop {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.dialog-card {
    background: var(--glass-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.dialog-header {
    padding: 24px;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border-bottom: 1px solid #eee;
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    order: 2;
}

.badge {
    order: 1;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px; 
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.status-waiting { background: #fff3cd; color: #856404; }
.status-confirmed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }

.dialog-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-group label, .time-block label {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 8px;
}

.user-chip {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 10px 14px;
    border-radius: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.time-grid {
    border-top: 1px dashed #e2e8f0;
    padding-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.time-block p {
    font-weight: 600;
    color: #334155;
    margin-top: 4px;
}




button {
    background-color: #006a85;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

button:hover { background-color: #005570; }

.error-message {
    background-color: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 25px;
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1em;
}



/* ── MOBILE : < 600px ── */
@media (max-width: 599px) {
    .view-desktop { display: none; }
    .view-mobile  { display: block; }

    header h1 { display: none; }

    header {
        padding: 0.4em 0.7em;
        min-height: 50px;
    }

    header .navbar-brand img { height: 38px; }

    .formSection label { display: none; }
    .formSection select { max-width: 160px; font-size: 0.82rem; }

    main {
        max-width: 100%;
        margin: 0.5em auto;
        padding: 0 0.5rem;
    }

    .btn-week { padding: 5px 10px; font-size: 1rem; }

    #current-week { font-size: 0.75rem; }
}

/* ── DESKTOP & Tablet : > 1024px ── */
@media (min-width: 600px) {
    .view-desktop { display: block; }

    .view-mobile  { display: none; }
}
