/* assets/planning.css */

:root {
    --color-free: #7cc77c;
    --color-orange-1: #f28500;
    --color-orange-2: #d35400;
    --color-preview: #3498db;
    --bg-admin: #222;
}

.planning-container {
    max-width: 1000px;
    margin: 0 auto;
    touch-action: pan-y;
}

/* --- Header & Navigation --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.calendar-header h2 { margin: 0; color: #333; text-transform: capitalize; }
.header-nav { display: flex; align-items: center; }
.btn-logout { color: #999; margin-right: 15px; text-decoration: none; }
.nav-arrow { color: #3498db; font-size: 1.5rem; font-weight: bold; padding: 0 15px; user-select: none; text-decoration: none; }

/* --- Grille du Calendrier --- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.grid-day-name { text-align: center; font-weight: bold; color: #999; font-size: 0.8rem; padding-bottom: 5px; }

.day-cell {
    text-align: center;
    padding: 0.5rem 0;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    position: relative;
    min-height: 60px; /* Assure une hauteur constante */
    max-height: 60px; /* Empêche l'étirement vertical */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: background 0.1s;
    color: white;
    overflow: hidden; /* Sécurité supplémentaire */
}

.day-number { font-size: 1rem; z-index: 5; }

.res-name-label {
    font-weight: bold;
    margin-top: 18px;
    text-align: center;
    
    /* Empêche la déformation de la case */
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0 4px;
    
    /* Gestion du texte trop long */
    overflow: hidden;
    white-space: nowrap;
    /* text-overflow: ellipsis; */
}

/* --- Couleurs et États --- */
.free { background-color: var(--color-free); }
.occupied.orange-1 { background-color: var(--color-orange-1); }
.occupied.orange-2 { background-color: var(--color-orange-2); }
.arrival.orange-1 { background: linear-gradient(45deg, var(--color-free) 50%, var(--color-orange-1) 50%); }
.arrival.orange-2 { background: linear-gradient(45deg, var(--color-free) 50%, var(--color-orange-2) 50%); }
.departure.orange-1 { background: linear-gradient(45deg, var(--color-orange-1) 50%, var(--color-free) 50%); }
.departure.orange-2 { background: linear-gradient(45deg, var(--color-orange-2) 50%, var(--color-free) 50%); }

.switch { border: 1px solid #fff; }
.switch-orange-1-orange-2 { background: linear-gradient(45deg, var(--color-orange-1) 50%, var(--color-orange-2) 50%); }
.switch-orange-2-orange-1 { background: linear-gradient(45deg, var(--color-orange-2) 50%, var(--color-orange-1) 50%); }

/* --- Zone Formulaire --- */
.admin-form-zone {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 2px solid transparent;
    transition: max-height 0.4s ease-out, opacity 0.3s ease, margin-top 0.4s ease, padding-top 0.4s ease;
}
.admin-form-zone.open {
    max-height: 500px; 
    opacity: 1;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top-color: #eee;
}
.admin-dock { background: var(--bg-admin); color: #fff; padding: 15px; border-radius: 8px; }

/* Mise en page du formulaire */
.res-form-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input-firstname { flex: 1; min-width: 110px; }
.input-name { flex: 1; min-width: 110px; }
.input-email { flex: 2; min-width: 160px; }
.select-country { width: 85px; flex-shrink: 0; }

.admin-dock input { padding: 10px; border-radius: 4px; border: none; font-size: 0.9rem; color: #333; }
.admin-dock select { padding: 10px; border-radius: 4px; border: none; font-size: 0.9rem; background: white; }

/* Boutons */
.btn-save { background: #2ecc71; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-delete { background: #e74c3c; color: white; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; display: none; }
.btn-delete[data-visible="true"] { display: inline-block; } /* Gestion visibilité bouton SUPPR. */
.btn-cancel { background: #555; color: white; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; }
.btn-group { display: flex; gap: 10px; margin-left: auto; }

/* --- Liste des Réservations à venir --- */
.upcoming-container { margin-top: 2.5rem; border-top: 2px solid #eee; padding-top: 1rem; overflow-x: auto; }
.upcoming-title { color: #555; margin-bottom: 15px; }
.no-res-msg { color: #999; font-style: italic; }

.upcoming-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; color: #444; min-width: 450px; }
.upcoming-table th { text-align: left; border-bottom: 2px solid #ddd; color: #888; text-transform: uppercase; font-size: 0.75rem; padding: 10px 5px; }
.upcoming-table td { padding: 12px 5px; border-bottom: 1px solid #eee; }

/* État ligne actuelle (aujourd'hui) */
.row-current { background: #d4edda !important; }
.row-current td { border-bottom: 1px solid #c3e6cb; }

.client-name { font-weight: 600; }

/* Correction lisibilité ISO */
.iso-cell { 
    font-family: monospace; 
    color: #333 !important; 
    font-weight: bold;
    background: #f1f1f1; 
    padding: 2px 6px;
    border-radius: 3px;
    text-align: center;
}

/* Correction bouton modification (détachement du fond vert) */
.btn-small-edit { 
    padding: 5px 8px !important; 
    background-color: #ffffff !important; 
    color: #3498db !important; 
    border: 1px solid #3498db !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 4px;
}
.btn-small-edit:hover {
    background-color: #3498db !important;
    color: #ffffff !important;
}

/* --- Helpers --- */
/* Ajoute "th" au sélecteur pour qu'il soit aussi fort que la règle par défaut */
.upcoming-table th.text-center, 
.text-center { 
    text-align: center !important; 
}
.text-right { text-align: right; }

/* --- Interface de Connexion (Admin) --- */
.login-body { 
    background: #f4f4f4; 
    font-family: sans-serif; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    margin: 0; 
}

.login-box { 
    background: white; 
    padding: 40px; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    text-align: center; 
    width: 100%; 
    max-width: 320px; 
}

.login-box i { 
    font-size: 3rem; 
    color: #3498db; 
    margin-bottom: 20px; 
}

.login-box h2 { 
    margin-bottom: 25px; 
    color: #333; 
}

.login-box input { 
    width: 100%; 
    padding: 12px; 
    margin-bottom: 15px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    box-sizing: border-box; 
}

.login-box button { 
    width: 100%; 
    padding: 12px; 
    background: #3498db; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold; 
}

.login-error { 
    color: #e74c3c; 
    margin-top: 15px; 
    font-size: 0.9rem; 
}