/**
 * WP Maps - Styles Frontend
 */

.wpmaps-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Fix Leaflet dans certains thèmes */
.wpmaps-container .leaflet-container {
    height: 100%;
    width: 100%;
    font-family: inherit;
}

.wpmaps-container .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.wpmaps-container .leaflet-popup-content {
    margin: 0;
    min-width: 200px;
    max-width: 280px;
}

/* Bouton fermer du popup - blanc sur fond coloré */
.wpmaps-container .leaflet-popup-close-button {
    color: #fff !important;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Marqueurs emoji */
.wpmaps-emoji-marker {
    background: none !important;
    border: none !important;
    text-align: center;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Marqueurs SVG personnalisés */
.wpmaps-custom-marker {
    background: none !important;
    border: none !important;
}

/* Popup POI */
.wpmaps-popup {
    text-align: center;
}

.wpmaps-popup-header {
    padding: 10px 15px;
    border-radius: 12px 12px 0 0;
}

.wpmaps-popup-title {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.wpmaps-popup-body {
    padding: 12px 15px;
}

.wpmaps-popup-address {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    font-style: italic;
}

.wpmaps-popup-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.wpmaps-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.wpmaps-popup-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
}

.wpmaps-popup-rating svg {
    width: 16px;
    height: 16px;
}

.wpmaps-popup-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpmaps-popup-fiche,
.wpmaps-popup-gmaps {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    transition: background 0.2s;
    text-decoration: none;
}

.wpmaps-popup-fiche:hover,
.wpmaps-popup-gmaps:hover {
    background: #e0e0e0;
}

.wpmaps-popup-fiche svg,
.wpmaps-popup-gmaps svg {
    width: 18px;
    height: 18px;
}

.wpmaps-popup-fiche:hover svg {
    fill: #0073aa;
}

/* Filtres par catégorie */
.wpmaps-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.wpmaps-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.wpmaps-filter-btn:hover {
    border-color: #999;
    opacity: 0.8;
}

.wpmaps-filter-btn.active {
    border-color: var(--cat-color, #3b82f6);
    background: #fff;
    color: #333;
    opacity: 1;
}

.wpmaps-filter-btn.wpmaps-filter-all {
    background: #e9ecef;
    border-color: #ccc;
}

.wpmaps-filter-btn.wpmaps-filter-all.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.wpmaps-filter-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Responsive filtres */
@media (max-width: 480px) {
    .wpmaps-filters {
        gap: 6px;
        padding: 8px;
    }

    .wpmaps-filter-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ========================================
   WRAPPER CARTE + LISTE (même style que prix/météo)
   ======================================== */
.wpmaps-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    width: 100%;
    margin: 20px 0;
}

/* Titre H2 de la carte */
.wpmaps-title {
    margin: 0 0 0.75rem 0;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

/* Header avec intro à gauche + toggle à droite */
.wpmaps-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.wpmaps-intro {
    flex: 1;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #64748b;
}

/* Toggle Carte/Liste (copié de wpprice) */
.wpmaps-view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 8px;
}

.wpmaps-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border: none !important;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b !important;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.wpmaps-toggle-btn:hover {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

.wpmaps-toggle-btn--active,
.wpmaps-toggle-btn--active:hover {
    background: white !important;
    color: #3b82f6 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Vues */
.wpmaps-view {
    display: none;
}

.wpmaps-view--active {
    display: block;
}

/* ========================================
   LISTE DES POI (style accordéon comme prix)
   ======================================== */
.wpmaps-poi-list {
    border: 1px solid #e2e8f0;
}

/* Actions globales */
.wpmaps-list-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

/* Section téléchargement */
.wpmaps-download-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wpmaps-download-label {
    font-size: 0.9em;
    color: #475569;
    font-weight: 500;
}

.wpmaps-download-buttons {
    display: flex;
    gap: 8px;
}

/* Boutons d'action (style unifié) */
.wpmaps-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
    font-family: inherit;
    background: var(--thim-body-primary-color, #ffb606);
    color: #fff !important;
}

.wpmaps-action-btn:hover {
    opacity: 0.85;
    color: #fff !important;
}

.wpmaps-action-btn--small {
    padding: 8px 14px;
    font-size: 0.85em;
}

.wpmaps-action-btn--tiny {
    padding: 6px 12px;
    font-size: 0.8em;
}

.wpmaps-action-btn--micro {
    padding: 4px 10px;
    font-size: 0.75em;
}

/* Actions par POI */
.wpmaps-poi-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wpmaps-poi-downloads {
    display: flex;
    gap: 4px;
}

/* Sections par catégorie (style accordéon) */
.wpmaps-category-section {
    border-bottom: 1px solid #e2e8f0;
}

.wpmaps-category-section:last-child {
    border-bottom: none;
}

.wpmaps-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
}

.wpmaps-category-header:hover {
    background: #f1f5f9;
}

.wpmaps-category-emoji {
    font-size: 1.1em;
}

.wpmaps-category-name {
    flex: 1;
    font-size: 0.95em;
    font-weight: 600;
    color: #334155;
}

.wpmaps-category-count {
    background: #e2e8f0;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 500;
}

.wpmaps-category-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Tableau des POI (style comme wpprice-compare-table) */
.wpmaps-poi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    background: #fff;
}

.wpmaps-poi-table thead {
    background: #f8fafc;
}

.wpmaps-poi-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.85em;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
}

.wpmaps-poi-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #475569;
}

.wpmaps-poi-table tbody tr:nth-child(odd) {
    background: #fafbfc;
}

.wpmaps-poi-table tbody tr:hover {
    background: #f1f5f9;
}

.wpmaps-col-name {
    width: 45%;
    font-weight: 500;
    color: #1e293b;
}

.wpmaps-col-address {
    width: 40%;
    font-size: 0.85em;
    color: #64748b;
}

.wpmaps-col-actions {
    width: 15%;
    text-align: center;
}

.wpmaps-poi-rating {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.8em;
    color: #f59e0b;
    font-weight: 500;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .wpmaps-title {
        font-size: 1.3rem;
    }

    .wpmaps-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .wpmaps-intro {
        font-size: 0.9rem;
    }

    .wpmaps-view-toggle {
        width: 100%;
        align-self: flex-end;
    }

    .wpmaps-toggle-btn {
        flex: 1;
        text-align: center;
    }

    .wpmaps-poi-table {
        font-size: 0.85em;
    }

    .wpmaps-poi-table th,
    .wpmaps-poi-table td {
        padding: 8px 10px;
    }

    .wpmaps-col-name {
        width: 50%;
    }

    .wpmaps-col-address {
        width: 30%;
    }

    .wpmaps-col-actions {
        width: 20%;
    }

    .wpmaps-list-actions {
        flex-direction: column;
        gap: 8px;
    }

    .wpmaps-category-header {
        flex-wrap: wrap;
    }

    .wpmaps-category-actions {
        width: 100%;
        margin-top: 8px;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .wpmaps-title {
        font-size: 1.2em;
    }

    /* Section téléchargement mobile */
    .wpmaps-download-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .wpmaps-download-buttons {
        width: 100%;
    }

    .wpmaps-download-buttons .wpmaps-action-btn--small {
        flex: 1;
    }

    /* Transformer le tableau en cartes empilées */
    .wpmaps-poi-table thead {
        display: none;
    }

    .wpmaps-poi-table,
    .wpmaps-poi-table tbody {
        display: block;
        width: 100%;
    }

    .wpmaps-poi-table tbody tr {
        display: flex;
        flex-direction: column;
        padding: 15px;
        margin-bottom: 0;
        border-bottom: 1px solid #e2e8f0;
        background: #fff;
    }

    .wpmaps-poi-table tbody tr:nth-child(odd) {
        background: #fafbfc;
    }

    .wpmaps-poi-table td {
        display: block;
        width: 100% !important;
        padding: 0;
        border: none;
    }

    .wpmaps-col-name {
        font-size: 1em;
        font-weight: 600;
        margin-bottom: 6px;
        color: #1e293b;
    }

    .wpmaps-col-address {
        font-size: 0.85em;
        color: #64748b;
        margin-bottom: 12px;
        font-style: italic;
    }

    .wpmaps-col-actions {
        text-align: left;
    }

    /* Actions POI en mobile : tout en ligne horizontale */
    .wpmaps-poi-actions {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .wpmaps-poi-downloads {
        gap: 6px;
    }

    /* Boutons plus compacts en mobile */
    .wpmaps-action-btn--tiny {
        padding: 8px 12px;
        font-size: 0.8em;
    }

    .wpmaps-action-btn--micro {
        padding: 6px 10px;
        font-size: 0.75em;
    }

    /* Header catégorie mobile */
    .wpmaps-category-header {
        flex-wrap: nowrap;
    }

    .wpmaps-category-actions {
        width: auto;
        margin-top: 0;
    }
}
