:root {
    --primary: #ff6b00;
    --primary-dark: #0089e5;
    --secondary: #08cf72;
    --accent: #ff3b5c;
    --dark: #1a1d29;
    --light: #ffffff;
    --gray: #f8f9fa;
    --gray-dark: #e0e0e0;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 50px rgba(0, 0, 0, 0.15);
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-fast: all 0.2s ease;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: #f5f5f5;
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Bande d'actualités */
.news-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    padding: 8px 15px;
    z-index: 2000;
    font-size: 0.85rem;
    overflow: hidden;
}

.news-content {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: scroll-news 15s linear infinite;
}

.news-label {
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 15px;
    font-weight: 600;
    font-size: 0.75rem;
}

@keyframes scroll-news {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Header */
.header {
    position: fixed;
    top: 35px;
    left: 0;
    right: 0;
    z-index: 1500;
    padding: 12px 20px;
    background: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.logo-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin-right: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.logo:hover {
    transform: rotate(5deg) scale(1.1);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--dark);
}

.search-container {
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
    position: relative;
    z-index: 1501;
}

.search-box {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 1px solid rgba(224, 224, 224, 0.5);
    border-radius: 24px;
    background: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.search-box:focus {
    outline: none;
    box-shadow: 0 6px 25px rgba(255, 107, 0, 0.3);
    border-color: var(--primary);
    transform: translateY(-2px);
    background: none;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #000000;
}

.search-box:focus + .search-icon {
    color: var(--primary);
}

/* Suggestions de recherche */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    border: 1px solid #e0e0e0;
    margin-top: 5px;
}

.search-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid #f5f5f5;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.search-suggestion-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-content i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.suggestion-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.suggestion-subtitle {
    font-size: 0.8rem;
    color: #666;
}

/* Bande de filtres */
.category-filters-bar {
    position: fixed;
    top: 95px;
    left: 0;
    right: 0;
    z-index: 1000;
    background: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 12px 20px;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: none !important;
    border-bottom: none !important;
    -webkit-overflow-scrolling: touch;
}

.category-filters-bar::-webkit-scrollbar {
    display: none;
}

.category-filters-bar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-filters-bar .category-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    margin-right: 8px;
    background: none !important;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 25px;
    color: var(--dark);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.category-filters-bar .category-filter:hover {
    background: rgba(255, 255, 255, 0);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.category-filters-bar .category-filter.active {
    background: var(--primary);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
    transform: translateY(-2px);
}

.category-filters-bar .category-filter i {
    font-size: 0.9rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    z-index: 2000;
    box-shadow: 5px 0 30px rgba(0,0,0,0.15);
    transition: var(--transition);
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-title-container {
    flex: 1;
}

.sidebar-title {
    text-align: center;
    font-size: 2.3rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-subtitle {
    text-align: center;
    color: #000000;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #000000;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.close-btn:hover {
    background: #f5f5f5;
    color: var(--primary);
    transform: rotate(90deg);
}

/* Onglets */
.sidebar-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-tab {
    flex: 1;
    font-size: 1.2rem;
    color: #000000;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.sidebar-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Barre de recherche dans le sidebar */
.sidebar-search-container {
    position: relative;
    margin-bottom: 20px;
}

.sidebar-search-box {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #f8f9fa;
    font-size: 1rem;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.sidebar-search-box:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.2);
}

.sidebar-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #000000;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.stats:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.stat-item {
    flex: 1;
    transition: var(--transition);
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

/* Sections de contenu */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.commerce-list, .artisan-list {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.commerce-item, .artisan-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 8px;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.commerce-item:hover, .artisan-item:hover {
    background: #f5f5f5;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.commerce-item.active {
    background: rgba(255, 107, 0, 0.1);
    border-left: 3px solid var(--primary);
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.2);
}

.commerce-name, .artisan-name {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.commerce-name i, .artisan-name i {
    margin-right: 10px;
    color: var(--primary);
}

.commerce-category, .artisan-category {
    color: var(--primary);
    font-size: 0.8rem;
    margin-bottom: 8px;
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 107, 0, 0.1);
    border-radius: 12px;
    font-weight: 500;
}

.commerce-address, .commerce-phone, .artisan-phone {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.commerce-address i, .commerce-phone i, .artisan-phone i {
    margin-right: 8px;
    width: 14px;
    text-align: center;
    color: var(--secondary);
}

.artisan-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.artisan-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

/* Map container */
.map-container {
    position: fixed;
    top: 35px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

#map {
    height: 100%;
    width: 100%;
}

/* View selector */
.view-selector {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: none !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    overflow: hidden;
}

.view-selector-btn {
    width: 44px;
    height: 44px;
    background: none !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--dark);
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.view-selector-btn:hover {
    background: none !important;
    color: var(--primary);
}

.view-selector-btn.active {
    background: rgb(0, 0, 0);
    color: var(--primary);
}

.view-selector-btn:not(:last-child) {
    border-bottom: none !important;
}

/* Floating buttons */
.floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: none !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    font-size: 1.3rem;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 1000;
    transition: var(--transition);
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.floating-btn:hover {
    box-shadow: none !important;
    transform: translateY(-5px) scale(1.1);
}

.floating-btn.primary {
    background: none !important;
    color: rgb(0, 0, 0);
}

.floating-btn.secondary {
    bottom: 85px;
}

.floating-btn.follow {
    bottom: 150px;
    background: none;
    color: rgb(0, 0, 0);
    display: none;
}

.floating-btn.follow.active {
    background: #e74c3c;
    animation: pulse 2s infinite;
    display: flex;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Popups Leaflet corrigées */
.leaflet-popup {
    z-index: 1000 !important;
    position: absolute !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
    background: white !important;
    border: none !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.leaflet-popup-tip {
    background: white !important;
    box-shadow: none !important;
}

.leaflet-popup-close-button {
    background: none !important;
    border: none !important;
    font-size: 1.2rem !important;
    color: #666 !important;
    transition: var(--transition) !important;
    padding: 5px !important;
    border-radius: 50% !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1001 !important;
}

.leaflet-popup-close-button:hover {
    background: #f5f5f5 !important;
    color: var(--primary) !important;
}

.leaflet-popup {
    margin-bottom: 0 !important;
}

/* Info window */
.info-window {
    padding: 15px;
    min-width: 250px;
}

.info-window h3 {
    margin-bottom: 10px;
    color: var(--dark);
    font-weight: 600;
}

.info-window p {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    color: #555;
    font-size: 0.9rem;
}

.info-window i {
    margin-right: 8px;
    color: var(--primary);
    width: 14px;
    text-align: center;
}

.info-window-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.info-window-btn {
    flex: 1;
    padding: 8px 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.info-window-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.info-window-btn.primary {
    background: var(--primary);
    color: white;
}

.info-window-btn.primary:hover {
    background: #e55a00;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

/* Villa number marker */
.villa-number {
    color: #000000;
    font-size: 11px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    background: none;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Search results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
    border-top: none;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid #f0f0f0;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.search-result-item:hover {
    background: #f5f5f5;
    transform: translateX(5px);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    display: none;
}

.overlay.active {
    display: block;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 250px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tooltip.active {
    opacity: 1;
}

.tooltip h4 {
    margin-bottom: 5px;
    color: var(--primary);
    font-weight: 600;
}

.tooltip p {
    margin-bottom: 3px;
    color: #666;
    display: flex;
    align-items: center;
}

.tooltip i {
    margin-right: 5px;
    width: 12px;
    text-align: center;
    color: var(--primary);
}

/* Route style */
.route-line {
    stroke: #ff6b00;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: none;
}

.route-shadow {
    stroke: #000000;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    opacity: 0.2;
    stroke-dasharray: none;
}

/* Loading indicator */
.route-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.route-loading.active {
    display: flex;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        top: 35px;
        padding: 12px 15px;
    }
    
    .search-container {
        display: block;
        margin: 0 15px;
    }
    
    .logo-text {
        display: block;
    }
    
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .category-filters-bar {
        top: 95px;
        padding: 10px 15px;
        background: none !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    .category-filters-bar .category-filter {
        padding: 8px 14px;
        font-size: 0.8rem;
        margin-right: 6px;
        background: none;
    }
    
    .map-container {
        top: 35px;
    }
    
    .commerce-item, .artisan-item {
        padding: 12px;
    }
    
    .floating-btn {
        width: 54px;
        height: 54px;
    }
    
    .view-selector-btn {
        width: 48px;
        height: 48px;
    }
    
    .info-window {
        min-width: 280px;
        max-width: 85vw;
    }

    .tooltip {
        display: none;
    }

    .leaflet-popup-content {
        margin: 15px;
        line-height: 1.4;
    }

    .info-window-actions {
        flex-direction: column;
        gap: 8px;
    }

    .info-window-btn {
        padding: 12px;
        font-size: 0.9rem;
    }

    .commerce-marker, .villa-marker {
        touch-action: manipulation;
    }

    .commerce-marker div {
        width: 24px !important;
        height: 24px !important;
    }

    .villa-marker div {
        font-size: 10px !important;
        font-weight: 700 !important;
    }
    
    .map-container {
        bottom: 0 !important;
    }
    
    .leaflet-popup-content-wrapper {
        max-width: 280px !important;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 12px;
    }
    
    .search-container {
        margin: 0 10px;
    }
    
    .logo {
        width: 36px;
        height: 36px;
        margin-right: 10px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .search-box {
        padding: 10px 15px 10px 40px;
        font-size: 0.9rem;
    }
    
    .sidebar {
        padding: 15px;
    }
    
    .category-filters-bar {
        padding: 8px 12px;
        background: none !important;
    }
    
    .category-filters-bar .category-filter {
        padding: 6px 12px;
        font-size: 0.75rem;
        margin-right: 4px;
        background: none;
    }
    
    .category-filters-bar .category-filter i {
        font-size: 0.8rem;
    }
    
    .stats {
        padding: 12px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }

    .info-window {
        min-width: 250px;
        max-width: 90vw;
    }
    
    .leaflet-popup-content-wrapper {
        max-width: 260px !important;
    }
}

/* Améliorations de compatibilité */
.search-box::placeholder {
    color: rgba(0, 0, 0, 0.6);
}

.sidebar-search-box::placeholder {
    color: #666;
}

/* Amélioration de la visibilité des éléments interactifs */
.floating-btn:active,
.view-selector-btn:active,
.category-filter:active {
    transform: scale(0.95);
}

/* Animation de chargement */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Correction pour iOS */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

/* Empêcher le zoom sur iOS */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Correction pour le scroll sur iOS */
.scroll-fix {
    -webkit-overflow-scrolling: touch;
}