/* style.css */
:root {
    --primary-color: #E2725B;
    /* Terra Cotta */
    --secondary-color: #CC4E5C;
    /* Darker Terra Cotta */
    --accent-color: #F4A460;
    /* Sandy Brown */
    --bg-color: #FDFBF7;
    /* Off-white / Cream */
    --text-color: #4A4A4A;
    /* Dark Grey */
    --white: #ffffff;
    --error: #e74c3c;
    --success: #2ecc71;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3 {
    color: var(--primary-color);
    text-align: center;
}

/* Auth Screens */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.auth-container input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* User Grid */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
}

.user-card {
    background: var(--white);
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    text-align: center;
}

.user-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    background-color: #fff5f2;
}

/* Main Dashboard */
.dashboard-container {
    max-width: 900px;
    margin: 50px auto;
    text-align: center;
    padding: 20px;
    flex-grow: 1;
}

.main-btn {
    display: block;
    width: 80%;
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    font-size: 1.5rem;
    border-radius: 8px;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}

.main-btn:hover {
    background-color: var(--secondary-color);
}

/* Planning View */
.planning-header {
    margin-bottom: 20px;
}

.planning-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.month-container {
    margin-bottom: 40px;
    overflow-x: auto;
}

table.planning-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 0.9rem;
}

table.planning-table th,
table.planning-table td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: center;
}

table.planning-table th {
    background-color: #f8f8f8;
}

/* Desiderata Calendar */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 20px;
}

/* =========================================
   CALENDAR SYSTEM (Google Style + List)
   ========================================= */

/* Controls */
.view-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    gap: 10px;
}

.view-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Wrapper */
.calendar-wrapper {
    width: 100%;
}

/* -------------------------------------
   MODE: GRID (Desktop Default)
   ------------------------------------- */
.calendar-wrapper.view-grid .cal-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f1f3f4;
    border: 1px solid #e0e0e0;
    border-bottom: none;
}

.calendar-wrapper.view-grid .cal-header-day {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    color: #70757a;
    border-right: 1px solid #e0e0e0;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.calendar-wrapper.view-grid .cal-header-day:last-child {
    border-right: none;
}

.calendar-wrapper.view-grid .cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #e0e0e0;
    border-top: none;
    background: white;
}

.calendar-wrapper.view-grid .cal-day {
    min-height: 120px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 5px;
    position: relative;
    background: white;
}

/* Every 7th item (Sunday) remove right border override if needed, 
   but grid usually handles this. CSS Grid gaps are alternative. */

/* Placeholders (Empty cells before 1st of month) */
.calendar-wrapper.view-grid .cal-day.empty {
    background: #f9f9f9;
}

/* Date Number */
.cal-day .day-num {
    font-size: 0.9rem;
    font-weight: 500;
    color: #3c4043;
    margin-bottom: 5px;
    display: block;
    text-align: right;
}

.is-today .day-num {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    display: inline-block;
}

/* Holidays / Weekends in Grid */
.calendar-wrapper.view-grid .cal-day.is-weekend {
    background-color: #f8f9fa;
}

.calendar-wrapper.view-grid .cal-day.is-holiday {
    background-color: #fff0f0;
}

.calendar-wrapper.view-grid .cal-day.frozen {
    background-image: linear-gradient(45deg, #f5f5f5 25%, #ffffff 25%, #ffffff 50%, #f5f5f5 50%, #f5f5f5 75%, #ffffff 75%, #ffffff 100%);
    background-size: 10px 10px;
    cursor: not-allowed;
}

/* Events in Grid */
.cal-event {
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #e8f0fe;
    color: #1967d2;
    cursor: pointer;
}

.cal-event.type-garde {
    background: #feeae6;
    color: #b31412;
}

.cal-event.type-congé {
    background: #e6f4ea;
    color: #137333;
}

.cal-event.c-G1 {
    background: #ffcccc;
    color: #a00;
}

.cal-event.c-G2 {
    background: #ffe6cc;
    color: #d35400;
}

.cal-event.c-C {
    background: #ccffcc;
    color: #006600;
}

/* -------------------------------------
   MODE: LIST (Mobile Optimized)
   ------------------------------------- */
.calendar-wrapper.view-list .cal-header {
    display: none;
}

/* Hide Mon/Tue...*/

.calendar-wrapper.view-list .cal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-wrapper.view-list .cal-day {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    min-height: auto;
}

.calendar-wrapper.view-list .cal-day.empty {
    display: none;
}

/* Hide placeholders */

.calendar-wrapper.view-list .cal-day.is-weekend {
    border-left: 5px solid #ccc;
}

.calendar-wrapper.view-list .cal-day.is-holiday {
    border-left: 5px solid #ff9999;
}

.calendar-wrapper.view-list .day-num {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 50px;
    margin-right: 15px;
    text-align: center;
    margin-bottom: 0;
}

.calendar-wrapper.view-list .day-content {
    flex-grow: 1;
}

/* Mobile Responsive Override (Force List on Small Screens if desired, or let toggle handle it) */
@media (max-width: 768px) {
    /* Optional: Force list view on mobile by default? 
       For now, we rely on the JS Toggle, but we can update defaults. */
}

.event-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 3px;
    margin-top: 2px;
    display: block;
}

/* Admin Panel */
.admin-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 10px 20px;
    background: #eee;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
}

.admin-nav a.active {
    background: var(--primary-color);
    color: white;
}

.admin-section {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: none;
    /* Toggled by JS */
}

.admin-section.active {
    display: block;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}