/**
 * Styles frontend pour Babychoumap
 *
 * @package Babychoumap
 * @since 1.0.0
 */

/* Typographie globale du plugin */
.babychoumap-locator,
.babychoumap-finder,
.babychoumap-minimap,
.babychoumap-map-container {
    --bcm-font-title: "Bricolage Grotesque", system-ui, sans-serif;
    --bcm-font-body: Roboto, system-ui, sans-serif;
    --bcm-title-size: 35px;
    --bcm-title-weight: 800;
    --bcm-title-line-height: 40.25px;
    --bcm-title-color: rgb(35, 85, 102);
    /* Couleurs fonctionnelles — orange marque Babychou */
    --bcm-orange: #E46A00;
    --bcm-orange-rgb: 228, 106, 0;
    --bcm-orange-hover: #C95D00;
    --bcm-orange-cta-from: #E46A00;
    --bcm-orange-cta-to: #C95D00;
    --bcm-blue: #5cbce4;
    --bcm-blue-text: #186B8A;
    font-family: var(--bcm-font-body);
}

.babychoumap-locator__header h2,
.babychoumap-finder__title,
.babychoumap-finder__modal-header h3,
.babychoumap-minimap__title {
    font-family: var(--bcm-font-title) !important;
    font-size: var(--bcm-title-size) !important;
    font-weight: var(--bcm-title-weight) !important;
    line-height: var(--bcm-title-line-height) !important;
    color: var(--bcm-title-color) !important;
}

.babychoumap-locator__item-title,
.babychoumap-locator__popover-body h3,
.babychoumap-popup-title,
.babychoumap-locator-popup strong {
    font-family: var(--bcm-font-title) !important;
    font-weight: var(--bcm-title-weight) !important;
    color: var(--bcm-title-color) !important;
}

/* Conteneur de carte */
.babychoumap-map-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Carte */
.babychoumap-map {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

/* Ratios d'aspect */
.babychoumap-aspect-16-9 {
    aspect-ratio: 16/9;
}

.babychoumap-aspect-4-3 {
    aspect-ratio: 4/3;
}

.babychoumap-aspect-1-1 {
    aspect-ratio: 1/1;
}

.babychoumap-aspect-3-4 {
    aspect-ratio: 3/4;
}

.babychoumap-aspect-7-5 {
    aspect-ratio: 7/5;
}

/* Popup personnalisée */
.babychoumap-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
    background: #ffffff;
}

.babychoumap-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.babychoumap-popup-content {
    padding: 15px;
    max-width: 320px; /* largeur plus contenue par défaut */
    background: #ffffff; /* fond blanc explicite */
}

.babychoumap-popup-image {
    margin-bottom: 10px;
    text-align: center;
}

.babychoumap-popup-image img {
    border-radius: 4px;
    max-width: 100%;
    height: auto;
}

/* Titre */
.babychoumap-popup-layout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.babychoumap-popup-img {
    flex: 0 0 110px;
}

.babychoumap-popup-img img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
}

.babychoumap-popup-details {
    flex: 1 1 auto;
    min-width: 0;
}

.babychoumap-popup-title {
    margin: 0 0 8px 0;
    font-family: var(--bcm-font-title, "Bricolage Grotesque", system-ui, sans-serif);
    font-size: 16px;
    font-weight: 800;
    color: var(--bcm-title-color, rgb(35, 85, 102));
    line-height: 1.3;
}

/* Adresse */
.babychoumap-popup-address {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Contact */
.babychoumap-popup-contact {
    margin: 10px 0;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.babychoumap-popup-contact p {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.4;
}

.babychoumap-popup-contact strong {
    color: #333;
    font-weight: 600;
}

.babychoumap-popup-contact a {
    color: #0073aa;
    text-decoration: none;
}

.babychoumap-popup-contact a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Actions */
.babychoumap-popup-actions {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.babychoumap-popup-button {
    display: inline-block;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.babychoumap-popup-button:hover {
    background: #005177;
    color: #fff;
    text-decoration: none;
}

/* Modern popover design */
.babychoumap-modern .leaflet-popup-content-wrapper {
    border: 1px solid #eef2f7;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14);
}

.babychoumap-modern .leaflet-popup-tip {
    display: none; /* look de carte flottante */
}

.babychoumap-modern-card {
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.babychoumap-modern-header {
    position: relative;
    width: 100%;
    height: 140px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.babychoumap-modern-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.00) 25%, rgba(0,0,0,0.45) 100%);
}

.babychoumap-modern-chip {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: #3388ff;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 1;
}

.babychoumap-modern-body {
    padding: 12px 14px 14px 14px;
}

.babychoumap-modern-title {
    margin: 0 0 6px 0;
    font-size: 19px!important;
    font-weight: 700;
    color: #101828;
    line-height: 1.3;
}

.babychoumap-modern-address {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #475467;
    line-height: 1.4;
}

.babychoumap-modern-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 8px 0 4px 0;
}

.babychoumap-modern-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #344054;
}

.babychoumap-modern-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #667085;
}

.babychoumap-modern-button {
    display: inline-flex;
    text-decoration: none!important;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    background: #0ea5e9;
    color: #fff!important;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    transition: background-color 0.2s ease, transform 0.05s ease;
}

.babychoumap-modern-button:hover {
    background: #0284c7;
    text-decoration: none;
}

.babychoumap-modern-button:active {
    transform: translateY(1px);
}

/* Marqueurs personnalisés */
.babychoumap-marker {
    cursor: pointer;
}

/* S'assurer que tous les éléments de marqueur sont cliquables */
.leaflet-marker-icon {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.leaflet-marker-icon * {
    pointer-events: auto !important;
}

/* Assurer l'empilement correct des calques Leaflet et la cliquabilité */
.babychoumap-map .leaflet-pane.leaflet-overlay-pane {
    z-index: 400 !important;
}

.babychoumap-map .leaflet-pane.leaflet-shadow-pane {
    z-index: 500 !important;
}

.babychoumap-map .leaflet-pane.leaflet-marker-pane {
    z-index: 600 !important;
    pointer-events: auto !important;
}

.babychoumap-map .leaflet-pane.leaflet-popup-pane {
    z-index: 700 !important;
    pointer-events: auto !important;
}

/* Marqueurs colorés */
.babychoumap-colored-marker {
    background: transparent !important;
    border: none !important;
}

.babychoumap-marker-container {
    position: relative;
    display: inline-block;
}

.babychoumap-marker-background {
    position: relative;
    transition: all 0.2s ease;
}

.babychoumap-marker-background:hover {
    transform: rotate(-45deg) scale(1.1);
}

.babychoumap-marker-icon {
    user-select: none;
    pointer-events: auto;
}

/* Marqueur par défaut quand l'icône est introuvable */
.babychoumap-default-marker {
    background: transparent !important;
    border: none !important;
}

.babychoumap-marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    position: relative;
}

.babychoumap-marker-text {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    transform: rotate(45deg);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

/* Animation pour les marqueurs par défaut */
.babychoumap-marker-pin {
    animation: babychoumap-marker-bounce 0.6s ease-out;
}

@keyframes babychoumap-marker-bounce {
    0% {
        transform: rotate(-45deg) scale(0);
        opacity: 0;
    }
    50% {
        transform: rotate(-45deg) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: rotate(-45deg) scale(1);
        opacity: 1;
    }
}

/* Hover effect pour les marqueurs par défaut */
.babychoumap-marker-pin:hover {
    transform: rotate(-45deg) scale(1.1);
    transition: transform 0.2s ease;
}

/* Contrôles de carte */
.babychoumap-map .leaflet-control-zoom {
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.babychoumap-map .leaflet-control-scale {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 11px;
    line-height: 1.2;
}

/* Attribution */
.babychoumap-map .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.2;
}

/* Contrôle de filtres Babychoumap */
.babychoumap-filter-control {
    background: rgba(255, 255, 255, 0.97)!important;
    border-radius: 6px!important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.12)!important;
    padding: 4px 8px 6px!important;
    min-width: 140px!important;
    border: 1px solid rgba(0,0,0,0.06)!important;
}

.babychoumap-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 24px;
    padding: 2px 4px 2px 6px;
    margin: 0 0 4px 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.babychoumap-filter-toggle:hover {
    background: rgba(0,0,0,0.05);
    color: #111;
}

.babychoumap-filter-title {
    font-size: 11px;
    font-weight: 600;
    color: inherit;
    letter-spacing: 0.02em;
}

.babychoumap-filter-toggle-icon {
    font-size: 8px;
    opacity: 0.75;
    margin-left: 4px;
    line-height: 1;
}

.babychoumap-filter-control .babychoumap-filter-list-wrap {
    margin-top: 2px;
}

.babychoumap-filter-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow: auto;
    padding-right: 2px;
}

.babychoumap-filter-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.25;
    color: #444;
    padding: 2px 0;
}

.babychoumap-filter-item:hover {
    color: #111;
}

.babychoumap-filter-item input[type="checkbox"] {
    cursor: pointer;
    width: 12px;
    height: 12px;
    margin: 0;
    flex-shrink: 0;
}

.babychoumap-filter-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.babychoumap-filter-name {
    line-height: 1.25;
}

/* Responsive */
@media (max-width: 768px) {
    .babychoumap-map-container {
        margin: 15px 0;
        border-radius: 4px;
    }
    
    .babychoumap-popup-content {
        max-width: 280px;
        min-width: 240px;
    }
    
    
    .babychoumap-popup-title {
        font-size: 15px;
    }
    
    .babychoumap-popup-address {
        font-size: 13px;
    }
    
    .babychoumap-popup-contact p {
        font-size: 12px;
    }
    
    .babychoumap-popup-button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .babychoumap-map-container {
        margin: 10px 0;
    }
    
    .babychoumap-popup-content {
        max-width: 220px;
        min-width: 200px;
    }
    
    .babychoumap-popup-layout {
        padding: 10px;
        gap: 8px;
    }
    
    .babychoumap-popup-img {
        height: 70px;
        max-width: 150px;
    }
    
    .babychoumap-popup-title {
        font-size: 14px;
    }
    
    .babychoumap-popup-address {
        font-size: 12px;
    }
    
    .babychoumap-popup-contact p {
        font-size: 11px;
    }
    
    .babychoumap-popup-button {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* États de chargement */
.babychoumap-loading {
    position: relative;
}

.babychoumap-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: babychoumap-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes babychoumap-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Erreurs */
.babychoumap-error {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
    margin: 20px 0;
}

.babychoumap-error h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.babychoumap-error p {
    margin: 0;
    font-size: 14px;
}

/* Améliorations d'accessibilité */
.babychoumap-map:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.babychoumap-popup-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Support des thèmes sombres */
@media (prefers-color-scheme: dark) {
    .babychoumap-popup-content {
        background: transparent;
        color: #2d3748;
    }
    
    .babychoumap-popup-title {
        color: #f7fafc;
    }
    
    .babychoumap-popup-address {
        color: #a0aec0;
    }
    
    .babychoumap-popup-contact {
        border-top-color: #4a5568;
    }
    
    .babychoumap-popup-contact strong {
        color: #f7fafc;
    }
    
    .babychoumap-popup-actions {
        border-top-color: #4a5568;
    }
}
