/* ============================================================
   PAV Remontées — Styles front-end
   Mobile-first, complète Bootstrap 5
   ============================================================ */

/* ---- Conteneur global ---- */
.pav-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
    font-family: inherit;
}

/* ---- Cards ---- */
.pav-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.pav-card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    font-weight: 600;
    font-size: .9rem;
    color: #374151;
}
.pav-card-body {
    padding: 16px;
}

/* ---- Robustesse responsive (fiches détail) ----
   Le thème du site peut imposer ses propres largeurs/marges ; ces règles
   évitent tout débordement horizontal sur mobile quel que soit le thème. */
.pav-wrap, .pav-wrap * { box-sizing: border-box; }
.pav-wrap img, .pav-wrap video, .pav-wrap iframe { max-width: 100%; height: auto; }
.pav-card-header { overflow-wrap: anywhere; }
.pav-desc-text, .pav-card-body table td, .pav-card-body table th { overflow-wrap: anywhere; }
.pav-card-body table { width: 100%; }

@media (max-width: 480px) {
    .pav-wrap { padding: 10px; }
    .pav-card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .pav-card-header .badge, .pav-card-header .pav-status {
        font-size: .7rem;
        padding: 3px 7px;
    }
}

/* ---- Formulaire : photo upload ---- */
.pav-photo-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 16px;
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    text-align: center;
    transition: border-color .2s, background .2s;
}
.pav-photo-label:hover {
    border-color: #22c55e;
    background: #f0fdf4;
}

.pav-photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pav-photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}
.pav-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pav-photo-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ---- Géolocalisation ---- */
.pav-geo-status { margin-bottom: 0; }
#pav-mini-map,
#pav-addr-mini-map { height: 220px; border-radius: 8px; overflow: hidden; z-index: 1; }
/* Carte plus haute sur mobile pour faciliter le positionnement du repère */
@media (max-width: 575px) {
    #pav-mini-map,
    #pav-addr-mini-map { height: 340px; }
}

/* ---- Danger imminent switch ---- */
.pav-danger-switch { padding-left: 2.5em; }
.pav-danger-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.pav-danger-switch .form-check-input:checked { background-color: #dc3545; border-color: #dc3545; }
.pav-danger-switch .form-check-label { font-weight: 500; }

/* ---- Bouton submit ---- */
.pav-submit-btn { padding: 14px; font-size: 1.1rem; }

/* ---- Carte + liste ---- */
#pav-leaflet-map {
    height: 380px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
@media (max-width: 767px) {
    #pav-leaflet-map { height: 300px; }
}

.pav-map-list-wrap { position: relative; }

/* ---- Items de liste ---- */
.pav-list-items { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pav-list-item {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s;
}
.pav-list-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.pav-list-item-color { width: 5px; flex-shrink: 0; }
.pav-list-item-body { flex: 1; padding: 10px 12px; }
.pav-list-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.pav-list-item-top strong { font-size: .9rem; }
.pav-list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
    font-size: .78rem;
    color: #6b7280;
}
.pav-list-item-action {
    display: flex;
    align-items: center;
    padding: 0 12px;
}

/* ---- Badges ---- */
.pav-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.pav-badge-high  { background: #fee2e2; color: #991b1b; }
.pav-badge-low   { background: #f1f5f9; color: #475569; }

.pav-status { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.bg-primary  { background: #0d6efd; color: #fff; }
.bg-warning  { background: #ffc107; }
.bg-info     { background: #0dcaf0; }
.bg-success  { background: #198754; color: #fff; }
.bg-danger   { background: #dc3545; color: #fff; }
.bg-secondary{ background: #6c757d; color: #fff; }

/* ---- Popup Leaflet ---- */
.pav-popup { max-width: 260px; }
.pav-popup-thumb { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; display: block; }
.pav-popup-body { font-size: .85rem; }
.pav-popup-desc { font-size: .8rem; color: #6b7280; margin-top: 4px; margin-bottom: 0; }
.pav-badge-inline { font-size: .72rem; }

/* ---- Auth forms ---- */
.pav-auth-wrap { display: flex; justify-content: center; padding: 20px 16px; }
.pav-auth-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 16px rgba(0,0,0,.07);
}
.pav-auth-logo { text-align: center; color: #22c55e; margin-bottom: 12px; }
.pav-auth-title { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.pav-auth-subtitle { text-align: center; color: #6b7280; font-size: .9rem; margin-bottom: 20px; }
.pav-auth-form .input-group-text { background: #f8fafc; border-right: none; }
.pav-auth-form .form-control { border-left: none; }
.pav-auth-form .form-control:focus { border-color: #22c55e; box-shadow: 0 0 0 .2rem rgba(34,197,94,.15); }
.pav-auth-footer { text-align: center; margin-top: 20px; font-size: .88rem; color: #6b7280; }
.pav-auth-footer a { color: #16a34a; font-weight: 600; text-decoration: none; }
.pav-auth-footer a:hover { text-decoration: underline; }

/* ---- Detail ---- */
.pav-detail-wrap { max-width: 800px; }
.pav-desc-text { white-space: pre-wrap; color: #374151; font-size: .92rem; line-height: 1.6; }
.pav-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pav-photo-item { border-radius: 8px; overflow: hidden; display: block; aspect-ratio: 1; }
.pav-photo-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.pav-photo-item:hover img { opacity: .85; }
.pav-cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

/* ---- Notice (shortcode hors contexte) ---- */
.pav-notice { padding: 12px 16px; background: #f8fafc; border-left: 4px solid #22c55e; border-radius: 4px; }

/* ---- Vide ---- */
.pav-empty { text-align: center; padding: 40px 20px; color: #9ca3af; }
.pav-loading { text-align: center; padding: 24px; color: #9ca3af; }

/* ---- Admin (back-office) ---- */
.pav-badge-low  { background: #d1fae5; color: #065f46; border-radius: 4px; padding: 2px 8px; font-size: .8rem; }
.pav-badge-mid  { background: #fef3c7; color: #78350f; border-radius: 4px; padding: 2px 8px; font-size: .8rem; }
.pav-badge-high { background: #fee2e2; color: #7f1d1d; border-radius: 4px; padding: 2px 8px; font-size: .8rem; }

/* ---- Responsive ajustements ---- */
@media (max-width: 480px) {
    .pav-auth-card { padding: 20px 16px; }
}

/* Desktop : carte + liste côte à côte (optionnel via media query) */
@media (min-width: 768px) {
    .pav-map-list-wrap {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        align-items: start;
    }
    /* Annuler les onglets sur desktop */
    #pav-tabs { display: none !important; }
    #pav-map-panel,
    #pav-list-panel { display: block !important; opacity: 1 !important; }
    #pav-leaflet-map { height: 520px; }
}

/* ---- Carte globale : marqueurs avec icône Font Awesome ---- */
.pav-cg-divicon { background: transparent !important; border: none !important; }
.pav-cg-mk {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px;
    box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.4);
}

/* ---- Réactions +/- ---- */
.pav-reactions { display: flex; gap: 8px; }
.pav-react-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px;
    border: 1px solid #e2e8f0; background: #fff;
    color: #475569; font-size: .85rem; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.pav-react-btn:hover { background: #f8fafc; }
.pav-react-up.active   { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.pav-react-down.active { background: #fee2e2; border-color: #dc3545; color: #991b1b; }

/* ---- Bouton partager ---- */
.pav-share-btn { white-space: nowrap; }

/* ---- Fil de questions/commentaires (class-pav-messages.php) ----
   Utilisé à la fois côté front (Bootstrap présent) et côté admin (absent) :
   volontairement autonome, sans classe Bootstrap. */
.pav-messages { margin-top: 8px; }
.pav-messages-title { font-size: .95rem; font-weight: 600; color: #374151; margin: 0 0 10px; }
.pav-messages-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 360px; overflow-y: auto; }
.pav-messages-empty { color: #9ca3af; font-size: .85rem; font-style: italic; margin: 0; }
.pav-msg { display: flex; }
.pav-msg-bubble {
    max-width: 80%; padding: 8px 12px; border-radius: 12px;
    background: #f1f5f9; font-size: .88rem; line-height: 1.4;
}
.pav-msg-staff { justify-content: flex-start; }
.pav-msg-staff .pav-msg-bubble { background: #dcfce7; border-bottom-left-radius: 2px; }
.pav-msg-remonteur { justify-content: flex-end; }
.pav-msg-remonteur .pav-msg-bubble { background: #e0f2fe; border-bottom-right-radius: 2px; }
.pav-msg-meta { font-size: .72rem; color: #6b7280; margin-bottom: 3px; }
.pav-msg-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.pav-messages-form { display: flex; flex-direction: column; gap: 8px; }
.pav-messages-input { resize: vertical; min-height: 60px; }
.pav-messages-feedback { color: #dc3545; font-size: .8rem; }

/* ---- Commentaires publics (class-pav-public-comments.php) ---- */
.pav-public-comments { margin-top: 8px; }
.pav-comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; max-height: 400px; overflow-y: auto; }
.pav-comments-empty { color: #9ca3af; font-size: .85rem; font-style: italic; margin: 0; }
.pav-comment { padding: 8px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.pav-comment-meta { font-size: .72rem; color: #6b7280; margin-bottom: 3px; }
.pav-comment-text { font-size: .88rem; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.pav-comments-form { display: flex; flex-direction: column; gap: 8px; }
.pav-comment-message { resize: vertical; min-height: 60px; }
.pav-comments-feedback { color: #dc3545; font-size: .8rem; }
/* Champ honeypot : invisible pour les humains, souvent rempli par les bots. */
.pav-hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- Fiche d'admin sur-mesure (class-pav-remontee-view.php) ----
   Volontairement indépendant de Bootstrap (non chargé dans wp-admin, pour
   ne pas perturber l'apparence de la barre d'outils/menu WordPress). */
.pav-admin-view { max-width: 1100px; }
.pav-admin-view a { text-decoration: none; }
.pav-admin-view, .pav-admin-view * { box-sizing: border-box; }
.pav-admin-view img, .pav-admin-view video { max-width: 100%; height: auto; }
@media (max-width: 480px) {
    .pav-view-header-row { flex-direction: column; align-items: flex-start; }
}
.pav-view-header-row {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px;
}
.pav-back-link { color: #374151; margin-right: 8px; }
.pav-public-link { margin-left: 8px; font-size: .8rem; color: #16a34a; font-weight: 600; }
.pav-text-muted { color: #9ca3af; }
.pav-view-notice {
    background: #dcfce7; color: #15803d; padding: 8px 12px;
    border-radius: 6px; margin-bottom: 16px; font-size: .9rem;
}
.pav-view-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px;
}
@media (max-width: 782px) {
    .pav-view-grid { grid-template-columns: 1fr; }
}
.pav-view-col { display: flex; flex-direction: column; }
.pav-field-label {
    display: block; font-weight: 600; font-size: .8rem; color: #374151;
    margin: 14px 0 4px;
}
.pav-input {
    width: 100%; padding: 7px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: .9rem; background: #fff;
}
.pav-input:focus { outline: none; border-color: #22c55e; box-shadow: 0 0 0 .15rem rgba(34,197,94,.15); }
.pav-readonly { font-size: .9rem; color: #374151; }
.pav-view-actions { margin-top: 20px; }

/* Interrupteur (toggle) CSS pur, sans dépendance Bootstrap */
.pav-toggle-row {
    display: flex; align-items: center; gap: 10px; margin: 12px 0;
    font-weight: 500; font-size: .9rem; cursor: pointer; width: fit-content;
}
.pav-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.pav-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.pav-toggle-slider {
    position: absolute; inset: 0; background: #cbd5e1;
    transition: background .2s; border-radius: 22px;
}
.pav-toggle-slider::before {
    content: ""; position: absolute; height: 16px; width: 16px;
    left: 3px; top: 3px; background: #fff; border-radius: 50%;
    transition: transform .2s;
}
.pav-toggle input:checked + .pav-toggle-slider { background: #22c55e; }
.pav-toggle input:checked + .pav-toggle-slider::before { transform: translateX(18px); }
.pav-toggle-row--danger .pav-toggle input:checked + .pav-toggle-slider { background: #dc3545; }

/* Boutons (équivalent léger de .btn Bootstrap, sans la dépendance) */
.pav-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px; border: 1px solid #d1d5db;
    background: #fff; color: #374151; font-size: .875rem; font-weight: 600;
    cursor: pointer;
}
.pav-btn:hover { background: #f8fafc; }
.pav-btn:disabled { opacity: .6; cursor: not-allowed; }
.pav-btn-primary { background: #16a34a; border-color: #16a34a; color: #fff; }
.pav-btn-primary:hover { background: #15803d; }
.pav-transmit-block { margin-top: 12px; max-width: 420px; }
