/* style.css - V7.0 GOLD : CSS SÉJOUR INCLUS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* --- MODE SOMBRE (DÉFAUT) --- */
    --bg-app: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
    --glass-sidebar: rgba(22, 42, 64, 0.95); 
    --glass-card:    rgba(22, 42, 64, 0.80); 
    --glass-input:   rgba(255, 255, 255, 0.08);
    --glass-header:  rgba(13, 27, 42, 0.98);
    --border-glass:  rgba(255, 255, 255, 0.12);
    --border-focus:  rgba(255, 195, 0, 0.8);
    --gold:       #FFC300;
    --gold-hover: #E6B000;
    --gold-glow:  rgba(255, 195, 0, 0.20);
    --text-main:  #e2e8f0;
    --text-muted: #94a3b8;
    --error:      #FF453A;
    --error-bg:   rgba(255, 69, 58, 0.15);
    --success:    #30D158;
    --red-gradient: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    --select-bg: #162a40;
    --select-color: #fff;
    --sidebar-width: 40vw; 
    --main-width:    60vw; 
    --radius: 8px;         
    --radius-l: 16px;
    --input-height: 38px;   
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.3);
    --blur-strength: 20px; 
    --row-gap: 10px;
}

body.light-mode {
    --bg-app: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    --glass-sidebar: rgba(255, 255, 255, 0.95); 
    --glass-card:    rgba(255, 255, 255, 0.85); 
    --glass-input:   rgba(255, 255, 255, 0.9); 
    --glass-header:  rgba(255, 255, 255, 0.98);
    --border-glass:  rgba(0, 0, 0, 0.08); 
    --border-focus:  rgba(217, 119, 6, 0.8);
    --text-main:  #0f172a; 
    --text-muted: #64748b; 
    --gold:       #d97706; 
    --gold-hover: #b45309;
    --red-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --select-bg: #ffffff;
    --select-color: #0f172a;
}

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13px; background: var(--bg-app); background-attachment: fixed; color: var(--text-main); height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }

/* LAYOUT PRINCIPAL */
.app-layout { display: flex; height: 100vh; width: 100vw; }

/* HEADER & SIDEBAR */
.sidebar-header, .main-header { height: 50px; flex: 0 0 50px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border-glass); background: var(--glass-header); z-index: 20; }
.main-header { justify-content: space-between; background: transparent; padding-right: 30px; }
.brand { font-size: 1.1rem; font-weight: 800; color: var(--gold); letter-spacing: -0.5px; text-transform: uppercase; }
.section-title { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* DASHBOARD (GAUCHE - 40%) */
.sidebar { width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); background-color: var(--glass-sidebar); border-right: 1px solid var(--border-glass); display: flex; flex-direction: column; z-index: 10; backdrop-filter: blur(var(--blur-strength)); box-shadow: 5px 0 30px rgba(0,0,0,0.15); }

/* RESULTATS (DROITE - 60%) */
.main-content { width: var(--main-width); flex: 0 0 var(--main-width); display: flex; flex-direction: column; overflow: hidden; background: transparent; position: relative; }

.sidebar-content { flex: 1; overflow-y: auto; padding: 20px 25px; display: flex; flex-direction: column; gap: 15px; }

/* CONTENEURS */
.sidebar-block { background: transparent; display: flex; flex-direction: column; }
.form-section-title { color: var(--text-muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; margin-bottom: 10px; border-bottom: 1px solid var(--border-glass); padding-bottom: 5px; letter-spacing: 0.5px; }

.form-group { margin-bottom: var(--row-gap); width: 100%; position: relative; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row .form-group { flex: 1; margin-bottom: var(--row-gap); }

label { display: block; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; margin-bottom: 5px; margin-left: 2px; }

/* INPUTS */
input:not([type="checkbox"]), select { width: 100%; height: var(--input-height); background: var(--glass-input); color: var(--text-main); border: 1px solid var(--border-glass); border-radius: var(--radius); padding: 0 12px; font-family: inherit; font-size: 0.9rem; font-weight: 500; transition: all 0.2s ease; appearance: none; }
select { background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; padding-right: 30px; cursor: pointer; }
select option { background-color: var(--select-bg); color: var(--select-color); padding: 8px; }
input:focus, select:focus { background: rgba(255,255,255,0.12); border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 3px var(--gold-glow); }
input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; background: rgba(0,0,0,0.2); }

/* BOUTONS */
.sidebar-footer { padding: 15px 25px; border-top: 1px solid var(--border-glass); background: rgba(0,0,0,0.1); display: grid; grid-template-columns: 2fr 1fr; gap: 15px; flex: 0 0 auto; }
.btn { width: 100%; height: 42px; border: none; border-radius: var(--radius); font-weight: 700; text-transform: uppercase; cursor: pointer; font-size: 0.85rem; letter-spacing: 0.5px; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--gold); color: #0f172a; box-shadow: 0 4px 12px rgba(255, 195, 0, 0.2); }
.btn-primary:hover { background: var(--gold-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 195, 0, 0.3); }
.btn-ghost { background: transparent; border: 1px solid var(--border-glass); color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-main); border-color: var(--text-main); }

/* CHECKBOX TILES */
.checkbox-tile { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: var(--input-height); cursor: pointer; background: var(--glass-input); border: 1px solid var(--border-glass); border-radius: var(--radius); transition: 0.2s; }
.checkbox-tile:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.1); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; margin: 0; }
.checkbox-tile label { margin: 0; font-size: 0.85rem; color: var(--text-main); cursor: pointer; }

/* RESULTATS (DROITE) */
.top-bar { flex: 1; padding: 25px 30px; overflow-y: auto; display: flex; flex-direction: column; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 0; }
.card { background: var(--glass-card); border: 1px solid var(--border-glass); border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; }
.card-label { color: var(--text-muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-glass); letter-spacing: 1px; }
.card-price { background: var(--red-gradient); border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 10px 30px rgba(185, 28, 28, 0.3); }
.card-price .card-label { border-bottom-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.9); }
.card-value { font-size: 3rem; font-weight: 800; color: #fff; margin-bottom: 5px; letter-spacing: -1.5px; line-height: 1; }
.card-sub { font-size: 0.9rem; color: rgba(255,255,255,0.85); margin-top: auto; font-weight: 500; }

.detail-row { display: flex; justify-content: space-between; font-size: 0.95rem; padding: 6px 0; border-bottom: 1px dashed var(--border-glass); }
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--text-muted); }
.detail-row strong { color: var(--text-main); font-weight: 600; }
.sub-row { padding-left: 15px; font-size: 0.85rem; opacity: 0.8; }
.sep { height: 1px; background: var(--border-glass); margin: 10px 0; }
.highlight-blue { background: rgba(59, 130, 246, 0.15); padding: 10px 12px; border-radius: 6px; border-left: 3px solid #3b82f6; margin: 8px 0; }

/* MAP */
.map-wrapper { flex: 0 0 280px; margin: 0 30px 30px 30px; border-radius: var(--radius-l); border: 1px solid var(--border-glass); box-shadow: var(--shadow-soft); overflow: hidden; position: relative; background: #000; transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); }
#map-container { width: 100%; height: 100%; opacity: 0.9; }
.map-collapsed { flex: 0 0 0 !important; height: 0 !important; margin: 0 30px 0 30px !important; border: none !important; opacity: 0; }

/* TOGGLE SWITCH */
.map-toggle-wrapper { display: flex; align-items: center; background: var(--glass-input); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-glass); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(150,150,150,0.3); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(18px); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* UTILITAIRES & ETATS */
.hidden { display: none !important; }
.pulse-error { border-color: var(--error) !important; background-color: var(--error-bg) !important; color: var(--error) !important; animation: pulseRed 1.5s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); } 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); } }

.loader { position:absolute; inset:0; background:rgba(13, 27, 42, 0.95); backdrop-filter:blur(10px); z-index:99; display:flex; align-items:center; justify-content:center; flex-direction: column; }
.spinner { width:40px; height:40px; border:4px solid rgba(255,255,255,0.1); border-top-color:var(--gold); border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* TOAST */
#notification-container { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; pointer-events: none; width: auto; min-width: 300px; }
.alert-toast { background: var(--glass-header); border: 1px solid var(--border-glass); border-left: 4px solid var(--gold); padding: 15px 25px; border-radius: var(--radius); color: var(--text-main); font-weight: 600; box-shadow: 0 10px 40px rgba(0,0,0,0.3); pointer-events: auto; backdrop-filter: blur(15px); text-align: center; }

/* MODAL ADMIN */
.admin-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.admin-content { background: #1e293b; border: 1px solid var(--gold); border-radius: 16px; width: 700px; max-width: 95%; max-height: 90vh; display: flex; flex-direction: column; color: white; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.admin-header { padding: 20px 25px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); }
.admin-header h2 { margin: 0; font-size: 1.2rem; color: var(--gold); }
.close-admin { background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }
.admin-body { padding: 25px; overflow-y: auto; }
.admin-section { margin-bottom: 25px; background: rgba(255,255,255,0.03); padding: 20px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.admin-section h3 { margin-top: 0; margin-bottom: 15px; font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.admin-field label { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 6px; }
.admin-field input { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15); color: #fff; height: 36px; padding: 0 10px; border-radius: 6px; width: 100%; }
.admin-field input:focus { border-color: var(--gold); outline: none; }

/* PRINT */
.print-only { display: none; }
@media print {
    @page { margin: 1cm; size: A4 portrait; }
    body { background: #fff; color: #000; overflow: visible; height: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .app-layout { display: block; height: auto; width: 100%; }
    .sidebar, .map-wrapper, .sidebar-footer, #notification-container, .btn, .relais-controls, .admin-modal, .map-toggle-wrapper, #theme-toggle, #print-btn, #admin-btn { display: none !important; }
    .main-content { width: 100%; flex: none; overflow: visible; background: #fff; }
    .main-header { display: none; }
    .print-only { display: block !important; margin-bottom: 20px; padding: 20px; border: 2px solid #0f172a; border-radius: 8px; background: #f8fafc; }
    .print-header-row { display: flex; justify-content: space-between; margin-bottom: 10px; border-bottom: 1px dashed #cbd5e1; padding-bottom: 5px; }
    .print-header-row:last-child { border-bottom: none; }
    .print-label { font-weight: 700; color: #64748b; text-transform: uppercase; font-size: 0.8rem; }
    .print-value { font-weight: 600; color: #0f172a; font-size: 1rem; }
    .print-title { font-size: 1.5rem; font-weight: 800; color: #0f172a; text-transform: uppercase; text-align: center; margin-bottom: 20px; }
    .results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .card { background: #fff; border: 1px solid #cbd5e1; box-shadow: none; color: #000; margin-bottom: 0; page-break-inside: avoid; border-radius: 8px; padding: 15px; }
    .card-label { color: #0f172a; border-bottom: 2px solid #0f172a; }
    .card-value { color: #0f172a; }
    .detail-row { border-bottom: 1px solid #e2e8f0; }
    .card-price { border: 3px solid #0f172a; background: #fff; }
}

/* --- TUILES SÉJOUR --- */
.sejour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-top: 15px; padding: 10px 0; }
.day-tile { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-glass); border-radius: 8px; padding: 12px; transition: 0.2s; border-left: 3px solid var(--text-muted); }
.day-tile:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.2); }
.day-tile.mode-excursion { border-left-color: var(--gold); background: rgba(255, 195, 0, 0.05); }
.day-tile.mode-repos { border-left-color: var(--success); }
.tile-header { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; color: var(--text-main); margin-bottom: 10px; padding-bottom: 5px; border-bottom: 1px dashed var(--border-glass); }
.tile-options { display: flex; gap: 10px; margin-bottom: 10px; }
.tile-option-btn { flex: 1; padding: 6px; font-size: 0.75rem; background: rgba(0,0,0,0.2); border: 1px solid var(--border-glass); color: var(--text-muted); border-radius: 4px; cursor: pointer; text-align: center; transition: 0.2s; }
.tile-option-btn.active { font-weight: bold; color: #000; }
.tile-option-btn[data-val="repos"].active { background: var(--success); border-color: var(--success); }
.tile-option-btn[data-val="excursion"].active { background: var(--gold); border-color: var(--gold); }
.tile-km-input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border-glass); color: var(--gold); padding: 5px 8px; border-radius: 4px; font-size: 0.85rem; text-align: right; }
.tile-km-wrapper { display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }