/* ============================================================
   Voiture Partagée – Styles principaux
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --vp-primary:     #2c7be5;
    --vp-primary-dk:  #1a5cbf;
    --vp-success:     #28a745;
    --vp-warning:     #fd7e14;
    --vp-danger:      #dc3545;
    --vp-bg:          #f8f9fa;
    --vp-border:      #dee2e6;
    --vp-text:        #212529;
    --vp-text-light:  #6c757d;
    --vp-white:       #ffffff;
    --vp-radius:      6px;
    --vp-shadow:      0 2px 8px rgba(0,0,0,.12);
    --vp-cell-h:      40px;   /* hauteur d'une cellule = 1 heure */
}

/* ── Container principal ────────────────────────────────── */
#vp-app {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--vp-text);
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Navigation ─────────────────────────────────────────── */
.vp-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.vp-nav-selects {
    display: flex;
    gap: 6px;
}

.vp-nav-selects select {
    padding: 6px 10px;
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    background: var(--vp-white);
    font-size: 14px;
}

.vp-btn-nav {
    width: 36px;
    height: 36px;
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    background: var(--vp-white);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background .15s;
}
.vp-btn-nav:hover { background: var(--vp-bg); }

.vp-btn-reserver {
    margin-left: auto;
    padding: 8px 20px;
    background: var(--vp-primary);
    color: var(--vp-white);
    border: none;
    border-radius: var(--vp-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.vp-btn-reserver:hover { background: var(--vp-primary-dk); }

/* ── Grille calendrier ──────────────────────────────────── */
.vp-calendar-wrapper {
    overflow-x: auto;
}

.vp-calendar {
    min-width: 700px;
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    background: var(--vp-white);
}

.vp-cal-header,
.vp-cal-row {
    display: grid;
    grid-template-columns: 40px repeat(7, 1fr);
}

.vp-cal-header {
    background: var(--vp-bg);
    border-bottom: 2px solid var(--vp-border);
    font-weight: 600;
}

.vp-col-time {
    padding: 6px 4px;
    font-size: 11px;
    color: var(--vp-text-light);
    text-align: right;
    border-right: 1px solid var(--vp-border);
}

.vp-col-day {
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    border-right: 1px solid var(--vp-border);
}
.vp-col-day:last-child { border-right: none; }

.vp-cal-row {
    height: var(--vp-cell-h);
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}
.vp-cal-row:last-child { border-bottom: none; }

.vp-col-cell {
    position: relative;
    border-right: 1px solid #f0f0f0;
}
.vp-col-cell:last-child { border-right: none; }

/* ── Événements ─────────────────────────────────────────── */
.vp-event {
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    background: var(--vp-primary);
    color: var(--vp-white);
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 11px;
    overflow: hidden;
    cursor: pointer;
    z-index: 10;
    transition: opacity .15s;
}
.vp-event:hover { opacity: .85; }

.vp-event-name  { display: block; font-weight: 600; }
.vp-event-dest  { display: block; opacity: .85; }

/* ── Modales ────────────────────────────────────────────── */
.vp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
}

.vp-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1010;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.vp-modal-content {
    background: var(--vp-white);
    border-radius: var(--vp-radius);
    box-shadow: var(--vp-shadow);
    padding: 28px 32px;
    position: relative;
}

.vp-modal-content h2 {
    margin: 0 0 20px;
    font-size: 18px;
}

.vp-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: var(--vp-text-light);
}
.vp-modal-close:hover { color: var(--vp-text); }

/* ── Popup détail ───────────────────────────────────────── */
.vp-detail-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 12px;
    margin: 0;
}
.vp-detail-list dt { font-weight: 600; color: var(--vp-text-light); }
.vp-detail-list dd { margin: 0; }

/* ── Formulaire de réservation ──────────────────────────── */
.vp-field {
    margin-bottom: 14px;
}

.vp-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
}

.vp-required { color: var(--vp-danger); }

.vp-field input[type="text"],
.vp-field input[type="date"],
.vp-field input[type="time"],
.vp-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .15s;
}

.vp-field input:focus,
.vp-field textarea:focus {
    outline: none;
    border-color: var(--vp-primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,.15);
}

.vp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Résultat de vérification ───────────────────────────── */
.vp-result {
    padding: 10px 14px;
    border-radius: var(--vp-radius);
    white-space: pre-wrap;
    font-size: 13px;
    margin-bottom: 14px;
}

.vp-result-ok      { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.vp-result-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.vp-result-alerte  { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ── Pied de formulaire ─────────────────────────────────── */
.vp-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.vp-tarif {
    font-size: 16px;
    font-weight: 700;
    color: var(--vp-primary);
}

.vp-btn-primary {
    padding: 10px 28px;
    background: var(--vp-primary);
    color: var(--vp-white);
    border: none;
    border-radius: var(--vp-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.vp-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.vp-btn-primary:not(:disabled):hover { background: var(--vp-primary-dk); }

/* ── Notices et états ───────────────────────────────────── */
.vp-notice   { color: var(--vp-text-light); font-style: italic; }
.vp-error    { color: var(--vp-danger); }
.vp-loading  { padding: 20px; text-align: center; color: var(--vp-text-light); }

/* ── Scroll lock quand modale ouverte ───────────────────── */
body.vp-modal-open { overflow: hidden; }

/* ── Responsive ─────────────────────────────────────────── */
@media ( max-width: 640px ) {
    .vp-field-row { grid-template-columns: 1fr; }
    .vp-modal-content { padding: 20px 16px; }
    .vp-form-footer { flex-direction: column; align-items: stretch; }
}
