/* Base Layout */
.search-container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-m);
}

.search-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

/* Header Styles */
.search-header {
    text-align: center;
    margin-bottom: var(--space-l);
}

.search-header h1 {
    color: var(--primary);
    font-size: var(--text-xl);
    margin-bottom: var(--space-xs);
}

.search-description {
    color: var(--primary-dark);
    font-size: var(--text-l);
}

.gas-info-recherche-membre-aph {
    margin-top: var(--space-s);
    font-size: var(--text-s);
    color: var(--white);
    background-color: var(--primary);
    padding: var(--space-s);
    border-radius: var(--radius);
}

/* Search Container */
.aph-form-container-user-data {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: var(--space-s);
}

/* Basic Search Layout */
.basic-search {
    width: 100%;
    padding: var(--space-s);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-main-row {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

/* Input Groups */
.search-input-container {
    position: relative;
    flex: 2;
}

.location-group {
    flex: 3;
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.action-group {
    flex: 2;
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.button-group {
    display: flex;
    gap: var(--space-xs);
}

/* Input Styles */
.search-input,
.location-input,
.radius-select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 0 var(--space-s);
}

.location-input {
    flex: 1;
}

.radius-select {
    min-width: 120px;
}

/* Button Styles */
.search-button,
.toggle-advanced-button,
.reset-button {
    height: 40px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.search-button {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 var(--space-m);
    background: var(--accent);
    color: white;
}

.toggle-advanced-button {
    width: 40px;
    padding: 0;
    background: var(--secondary);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: bold;
}

.reset-button {
    background-color: var(--secondary-semi-light);
    color: var(--primary-dark);
    padding: 10px 15px;
    font-size: var(--text-s);
    transition: background-color 0.3s ease;
}

.reset-button:hover {
    background-color: var(--secondary);
    color: var(--white);
}

.toggle-advanced-button:hover {
    background: var(--secondary-dark);
}

/* Search Around Me */

.search-around-me-button {
    background-color: var(--primary-light);
    color: var(--black);
    border: none;
    padding: var(--space-xs) var(--space-s);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-s);
    transition: background-color 0.3s ease;
}

.search-around-me-button:hover {
    background-color: var(--primary);
}

.search-around-me-button i {
    font-size: var(--text-m);
}

/* Help Text */
.search-help {
    font-size: var(--text-s);
    color: var(--primary-dark);
    margin-top: var(--space-xs);
    font-style: italic;
}

/* Search Suggestions */
.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 400px;
    width: 150%;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 4px;
}

.suggestion-item {
    padding: var(--space-s);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-s);
    border-bottom: 1px solid var(--primary-ultra-light);
    transition: all 0.2s ease;
}

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

.suggestion-item:hover {
    background-color: var(--primary-ultra-light);
}

.suggestion-type {
    font-size: var(--text-s);
    padding: 2px 8px;
    border-radius: var(--radius);
    background: var(--primary-semi-light);
    color: var(--primary-ultra-light);
    white-space: nowrap;
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-weight: bold;
    color: var(--primary);
}

.suggestion-details {
    font-size: var(--text-s);
    color: var(--primary-dark);
}

/* Advanced Search */
.advanced-search {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
    padding: var(--space-m);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.advanced-section {
    width: 100%;
    margin-bottom: var(--space-m);
}

.available-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-s);
}

.option-item {
    padding: 4px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--text-s);
    transition: all 0.2s ease;
    background: var(--primary-light);
    color: var(--black);
}

.option-item:hover {
    background: var(--primary-semi-light);
}

.option-item.selected {
    background: var(--secondary);
    color: var(--white);
}

/* Results Section */
.search-results-container {
    margin-top: var(--space-l);
    width: 100%;
}

.map-container {
    height: 600px;
    width: 100%;
    margin: var(--space-m) 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px var(--neutral-light);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-m);
    padding: var(--space-m);
}

.result-item {
    display: flex;
    gap: var(--space-m);
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-m);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-image {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    position: relative;
    overflow: hidden;
}

.result-image img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--primary-light);
    display: block;
}

.result-details {
    flex: 1;
    color: var(--primary-dark);
}

.result-details h3 {
    color: var(--primary);
    margin: 0 0 var(--space-xs);
    font-size: var(--text-m);
    font-weight: 600;
}

.result-name {
    color: var(--primary-dark);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.result-address {
    color: var(--primary-dark);
    font-size: var(--text-s);
}

/* Notifications */
.loading-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285F4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #333;
    font-size: 14px;
}

/* Map Styles */
.marker-container {
    cursor: pointer;
    user-select: none;
}

.marker-label {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    margin-top: 2px;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.marker-text {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}

.marker-icon-only {
    transform: translate(-50%, -100%);
}

/* Animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
    .search-container {
        margin: 0 auto;
        width: 100%;
        padding: 0;
    }

    .aph-form-container-user-data {
        background: var(--white);
        border-radius: var(--radius);
        box-shadow: none;
        padding: 0;
    }

    .search-main-row {
        flex-direction: column;
        gap: var(--space-s);
    }

    .search-input-container,
    .location-input {
        width: 100%;
    }

    .location-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: var(--space-s);
    }

    .location-input {
        grid-column: 1;
    }

    .search-around-me,
    .radius-select {
        min-width: auto;
    }

    .action-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-s);
    }

    .radius-select,
    .search-around-me {
        grid-column: span 1;
    }

    .button-group {
        grid-column: span 2;
        justify-content: center;
    }

    .search-suggestions {
        width: 100%;
    }

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

/* Tablet Styles */
@media screen and (min-width: 769px) and (max-width: 1200px) {
    .search-main-row {
        flex-wrap: wrap;
    }

    .search-input-container {
        flex: 1 1 100%;
    }

    .location-group {
        flex: 1 1 60%;
    }

    .action-group {
        flex: 1 1 35%;
    }
}


.marker-pin-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-pin {
    margin-bottom: 2px;
}

.marker-label {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: var(--radius);
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: var(--primary-dark);
    z-index: 1;
    text-align: center;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marker-container {
    transform: translate(-50%, -100%);
}

/* Styles pour les avatars personnalisés sur les marqueurs */
.custom-avatar-marker {
    border: 2px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    width: 40px !important;
    height: 40px !important;
    object-fit: cover;
}

/* Style pour les labels des cabinets positionnés sous les marqueurs */
.marker-cabinet-label {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary-dark) !important;
    padding: 3px 8px !important;
    border-radius: var(--radius) !important;
    font-size: 11px !important;
    font-weight: bold !important;
    text-align: center !important;
    border: 1px solid var(--primary-light) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    max-width: 140px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
    margin-top: 5px !important;
}

/* Cible le conteneur du cluster, pas un enfant arbitraire */
/* ⚠️ Laisser MarkerClusterer gérer dimensions & background-image */
.gm-style .cluster,
.gm-style .gm-cluster {
  display: inline-block;
  text-align: center;
}

/* Normalise un éventuel wrapper interne utilisé par la lib */
/* ⚠️ Ne pas écraser la taille/position internes pour préserver l'icône sur Firefox */
.gm-style .cluster > div,
.gm-style .gm-cluster > div { /* intentionally left blank to avoid overriding cluster background on Firefox */ }


/* Forcer le positionnement des labels Google Maps */
/*
.gm-style>div>div>div>div>div>div>div[style*="position: absolute"] {
    transform: translateY(25px) !important;
}
*/

/* Style pour les clusters personnalisés - cacher les fonds par défaut */
/*
.gm-style .cluster {
    background: none !important;
    border: none !important;
}
*/
/* Améliorer l'affichage des clusters */
/*
.gm-cluster {
    background: none !important;
    border: none !important;
}
*/

/* Supprimer le fond blanc du texte des clusters */
/*
.gm-style div[style*="position: absolute"] div[style*="font"] {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}
    */

/* Forcer le style du texte des clusters */
/* Laisser MarkerClusterer gérer l'image; on se limite à un centrage doux du texte */
.gm-style .gm-cluster div {
    text-align: center;
    line-height: normal;
}

/* Assurer la visibilité du texte dans tous les cas */
.gm-style div[style*="font"] {
    color: #111111 !important;
    font-weight: bold !important;
    font-size: 14px !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
}


/* Amélioration du style des labels Google Maps génériques */
.gm-style-iw .marker-label {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2px 6px;
    border-radius: var(--radius);
    border: 1px solid var(--primary-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-dark);
}

/* Styles spécifiques pour les labels de Google Maps */
.gm-style .gm-style-iw-c .gm-style-iw-d {
    overflow: visible !important;
}

/* Style pour les conteneurs de labels de marqueurs personnalisés */
/*
.gm-style div[style*="position: absolute"] div[style*="font"] {
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    border: 1px solid var(--primary-light) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}
*/

.search-status {
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-s);
    margin-top: var(--space-s);
    border: 1px solid var(--primary-ultra-light);
    transition: all 0.3s ease;
    overflow: hidden;
}

.search-status.hidden {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.search-status-content {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.search-status-icon {
    position: relative;
    width: 24px;
    height: 24px;
}

.status-spinner,
.status-check {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
}

.status-spinner {
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.status-check {
    color: var(--accent);
    opacity: 0;
    transform: scale(0.5);
}

.search-status-text {
    font-size: var(--text-m);
    color: var(--primary-dark);
}

.search-status.success .status-spinner {
    opacity: 0;
    transform: scale(1.5);
}

.search-status.success .status-check {
    opacity: 1;
    transform: scale(1);
}

.search-status.complete .status-spinner {
    opacity: 0;
    transform: scale(1.5);
}

.search-status.complete .status-check {
    opacity: 1;
    transform: scale(1);
}

@keyframes statusFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}