/**
 * Fonio Map - Frontend CSS
 */

:root {
    --fm-primary: #B8860B;
    --fm-primary-dark: #8B6914;
    --fm-primary-light: #D4A84B;
    --fm-secondary: #2D8A36;
    --fm-text: #2D3436;
    --fm-text-light: #636E72;
    --fm-bg: #FFFFFF;
    --fm-bg-light: #F8F9FA;
    --fm-border: #E9ECEF;
    --fm-radius: 12px;
    --fm-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --fm-transition: 0.2s ease;
}

/* Container principal */
.fm-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
}

/* Barre de recherche */
.fm-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--fm-bg);
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow);
}

.fm-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.fm-search-icon {
    position: absolute;
    left: 16px;
    font-size: 16px;
    color: var(--fm-text-light);
}

.fm-search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    border: 2px solid var(--fm-border);
    border-radius: 50px;
    font-size: 15px;
    transition: border-color var(--fm-transition);
}

.fm-search-input:focus {
    outline: none;
    border-color: var(--fm-primary);
}

.fm-search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--fm-text-light);
    padding: 4px;
}

.fm-geoloc-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--fm-primary);
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--fm-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fm-geoloc-btn:hover {
    background: var(--fm-primary-dark);
    transform: scale(1.05);
}

/* Layout */
.fm-layout {
    display: flex;
    gap: 24px;
}

/* Sidebar filtres */
.fm-sidebar {
    flex: 0 0 280px;
}

.fm-filters {
    background: var(--fm-bg);
    border-radius: var(--fm-radius);
    padding: 20px;
    box-shadow: var(--fm-shadow);
    position: sticky;
    top: 100px;
}

.fm-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--fm-primary);
}

.fm-filters-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.fm-filters-reset {
    background: none;
    border: none;
    color: var(--fm-primary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.fm-filters-reset:hover {
    text-decoration: underline;
}

.fm-filter-group {
    margin-bottom: 20px;
}

.fm-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--fm-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.fm-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fm-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.fm-checkbox input {
    accent-color: var(--fm-primary);
    width: 16px;
    height: 16px;
}

.fm-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--fm-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--fm-bg);
    cursor: pointer;
}

.fm-select:focus {
    outline: none;
    border-color: var(--fm-primary);
}

.fm-select--small {
    width: auto;
    padding: 6px 10px;
    font-size: 13px;
}

.fm-filter-hint {
    font-size: 12px;
    color: var(--fm-text-light);
    margin: 8px 0 0;
    font-style: italic;
}

/* Zone principale */
.fm-main {
    flex: 1;
    min-width: 0;
}

/* Carte */
.fm-map-wrapper {
    position: relative;
    border-radius: var(--fm-radius);
    overflow: hidden;
    box-shadow: var(--fm-shadow);
}

.fm-map {
    width: 100%;
    min-height: 400px;
    background: var(--fm-bg-light);
    z-index: 1;
}

.fm-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    font-size: 14px;
    color: var(--fm-text-light);
}

.fm-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--fm-border);
    border-top-color: var(--fm-primary);
    border-radius: 50%;
    animation: fm-spin 1s linear infinite;
}

@keyframes fm-spin {
    to { transform: rotate(360deg); }
}

/* Résultats header */
.fm-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-top: 16px;
    border-bottom: 1px solid var(--fm-border);
}

.fm-results-count {
    font-size: 14px;
    color: var(--fm-text-light);
}

.fm-results-count strong {
    color: var(--fm-primary);
    font-size: 18px;
}

.fm-results-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Liste des résultats */
.fm-results-list {
    margin-top: 16px;
}

.fm-results-empty {
    text-align: center;
    padding: 40px;
    color: var(--fm-text-light);
}

.fm-results-empty p:first-child {
    font-size: 18px;
    margin-bottom: 8px;
}

/* Carte point de vente */
.fm-pv-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--fm-bg);
    border-radius: var(--fm-radius);
    border: 1px solid var(--fm-border);
    margin-bottom: 12px;
    transition: all var(--fm-transition);
    cursor: pointer;
}

.fm-pv-card:hover {
    border-color: var(--fm-primary);
    box-shadow: var(--fm-shadow);
}

.fm-pv-card--active {
    border-color: var(--fm-primary);
    background: #FFFBF0;
}

.fm-pv-card__image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--fm-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fm-pv-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fm-pv-card__image-placeholder {
    font-size: 32px;
    opacity: 0.4;
}

.fm-pv-card__content {
    flex: 1;
    min-width: 0;
}

.fm-pv-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.fm-pv-card__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--fm-text);
    margin: 0;
}

.fm-pv-card__type {
    font-size: 11px;
    background: var(--fm-bg-light);
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.fm-pv-card__address {
    font-size: 13px;
    color: var(--fm-text-light);
    margin: 0 0 8px 0;
}

.fm-pv-card__product {
    font-size: 13px;
    color: var(--fm-primary);
    font-weight: 600;
}

.fm-pv-card__distance {
    font-size: 12px;
    color: var(--fm-text-light);
    margin-top: 4px;
}

.fm-pv-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.fm-pv-card__btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--fm-transition);
}

.fm-pv-card__btn--primary {
    background: var(--fm-primary);
    color: white;
    border: none;
}

.fm-pv-card__btn--primary:hover {
    background: var(--fm-primary-dark);
    color: white;
}

.fm-pv-card__btn--secondary {
    background: var(--fm-bg-light);
    color: var(--fm-text);
    border: 1px solid var(--fm-border);
}

.fm-pv-card__btn--secondary:hover {
    border-color: var(--fm-primary);
    color: var(--fm-primary);
}

/* Popup Leaflet */
.fm-popup {
    min-width: 250px;
}

.fm-popup__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.fm-popup__icon {
    font-size: 24px;
}

.fm-popup__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.fm-popup__type {
    font-size: 12px;
    color: var(--fm-text-light);
}

.fm-popup__address {
    font-size: 13px;
    color: var(--fm-text-light);
    margin-bottom: 10px;
}

.fm-popup__product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--fm-bg-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.fm-popup__product-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
}

.fm-popup__product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--fm-primary);
}

.fm-popup__product-price {
    font-size: 12px;
    color: var(--fm-text-light);
}

.fm-popup__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fm-popup__btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all var(--fm-transition);
}

.fm-popup__btn--primary {
    background: var(--fm-primary);
    color: white !important;
}

.fm-popup__btn--primary:hover {
    background: var(--fm-primary-dark);
}

.fm-popup__btn--secondary {
    background: var(--fm-bg-light);
    color: var(--fm-text) !important;
    border: 1px solid var(--fm-border);
}

/* Cluster markers */
.marker-cluster {
    background: rgba(184, 134, 11, 0.3);
}

.marker-cluster div {
    background: var(--fm-primary);
    color: white;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 992px) {
    .fm-layout {
        flex-direction: column;
    }
    
    .fm-sidebar {
        flex: none;
        width: 100%;
    }
    
    .fm-filters {
        position: static;
    }
}

@media (max-width: 768px) {
    .fm-search-bar {
        padding: 12px;
    }
    
    .fm-pv-card {
        flex-direction: column;
    }
    
    .fm-pv-card__image {
        width: 100%;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .fm-results-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .fm-pv-card__actions {
        flex-direction: column;
    }
}
