/* Cash & Smile - Moteur de recherche d'établissements */

.cashandsmile-moteur {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Barre de recherche */
.cas-search-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    z-index: 1000;
}

.cas-search-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.cas-filter-select {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 130px;
    transition: border-color 0.2s;
}

.cas-filter-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.cas-search-input {
    width: 100%;
    padding: 10px 44px 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cas-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cas-search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #6366f1;
    border: none;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cas-search-btn:hover {
    background: #4f46e5;
}

/* Autocomplétion */
.cas-autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 4px 0;
    max-height: 320px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.cas-autocomplete-list.active {
    display: block;
}

.cas-autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cas-autocomplete-item:hover,
.cas-autocomplete-item.highlighted {
    background: #f3f4f6;
}

.cas-autocomplete-item .cas-ac-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.cas-ac-type.hotel { background: #dbeafe; color: #1d4ed8; }
.cas-ac-type.restaurant { background: #fef3c7; color: #b45309; }
.cas-ac-type.commerce { background: #d1fae5; color: #065f46; }
.cas-ac-type.ville { background: #ede9fe; color: #6d28d9; }

/* Carte */
.cas-map-wrapper {
    position: relative;
}

#cas-map {
    width: 100%;
    z-index: 1;
}

.cas-map-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 999;
    display: flex;
    gap: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 4px;
}

.cas-map-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #4b5563;
    transition: all 0.2s;
}

.cas-map-btn:hover {
    background: #f3f4f6;
}

.cas-map-btn-active {
    background: #6366f1 !important;
    color: #fff !important;
}

/* Géolocalisation */
.cas-geolocation-prompt {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
}

.cas-geolocation-prompt p {
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}

.cas-geolocation-btn {
    padding: 8px 16px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.cas-geolocation-btn:hover {
    background: #4f46e5;
}

/* Liste des résultats */
.cas-results-list {
    padding: 20px 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.cas-results-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.cas-results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.cas-result-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.cas-result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.cas-result-card h4 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #1f2937;
}

.cas-result-card .cas-result-type {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.cas-result-card .cas-result-address {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.cas-result-card .cas-result-distance {
    font-size: 12px;
    color: #9ca3af;
}

/* Modal détail */
.cas-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cas-modal-overlay.active {
    display: flex;
}

.cas-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 24px;
}

.cas-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.cas-modal-close:hover {
    color: #1f2937;
}

.cas-modal-content h2 {
    margin-top: 0;
    font-size: 20px;
    color: #1f2937;
}

.cas-modal-content .cas-detail-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.cas-modal-content .cas-detail-label {
    font-weight: 600;
    color: #6b7280;
    min-width: 100px;
}

.cas-modal-content .cas-detail-value {
    color: #1f2937;
}

/* Footer debug */
.cas-debug-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(31, 41, 55, 0.95);
    color: #d1d5db;
    padding: 6px 16px;
    font-size: 12px;
    z-index: 9999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cas-debug-footer span {
    margin-right: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .cas-search-bar {
        padding: 10px 12px;
    }

    .cas-search-container {
        flex-wrap: wrap;
    }

    .cas-filter-select {
        width: 100%;
        min-width: 0;
    }

    .cas-search-input-wrap {
        width: 100%;
    }

    .cas-map-controls {
        top: 8px;
        right: 8px;
    }

    .cas-geolocation-prompt {
        bottom: 12px;
        left: 12px;
        right: 12px;
        flex-direction: column;
        text-align: center;
    }

    .cas-results-container {
        grid-template-columns: 1fr;
    }

    .cas-debug-footer {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        font-size: 11px;
    }
}

/* Leaflet custom markers */
.cas-marker-hotel { background-color: #3b82f6; }
.cas-marker-restaurant { background-color: #f59e0b; }
.cas-marker-commerce { background-color: #10b981; }

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    font-size: 13px;
    line-height: 1.5;
}

.leaflet-popup-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

/* Animations */
@keyframes cas-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cas-result-card {
    animation: cas-fadeIn 0.3s ease-out forwards;
}

/* Loading spinner */
.cas-loading {
    text-align: center;
    padding: 24px;
    color: #6b7280;
}

.cas-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: cas-spin 0.8s linear infinite;
}

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