/* =========================================================
   Hypnotherapeute Search — Split View Layout
   Map styles in common/assets/css/gas-member-map.css
   Design tokens from gas-design-tokens.css
   ========================================================= */

/* ---- Page layout ---- */

.search-page-wrapper {
    max-width: var(--gas-site-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px); /* Adjust 80px to your site header height */
    min-height: 600px;
    font-family: var(--gas-font-family);
}

/* ---- Header (non-sticky, scrolls away) ---- */

.search-header {
    text-align: center;
    padding: var(--gas-space-l) var(--gas-space-m) var(--gas-space-m);
    flex-shrink: 0;
}

.search-header h1 {
    color: var(--gas-primary);
    font-size: var(--gas-text-2xl);
    font-weight: var(--gas-weight-bold);
    margin: 0 0 var(--gas-space-xs);
    line-height: var(--gas-leading-tight);
}

.search-description {
    color: var(--gas-neutral-700);
    font-size: var(--gas-text-l);
    margin: 0 0 var(--gas-space-s);
}

.search-professional-info {
    font-weight: var(--gas-weight-semi);
    color: var(--gas-neutral-800);
    margin: 0;
}

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

/* ---- Sticky search bar ---- */

.search-bar-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gas-bg-surface);
    border-bottom: var(--gas-border-width) solid var(--gas-neutral-200);
    box-shadow: var(--gas-shadow-s);
    padding: var(--gas-space-s) var(--gas-space-m);
    flex-shrink: 0;
}

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

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

/* Input groups */
.search-input-container {
    position: relative;
    flex: 2;
    min-width: 0;
}

.location-group {
    flex: 2;
    display: flex;
    align-items: center;
    gap: var(--gas-space-s);
    min-width: 0;
}

.action-group {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--gas-space-xs);
}

/* Inputs */
.search-input,
.location-input {
    width: 100%;
    height: 38px;
    border: var(--gas-border-width) solid var(--gas-input-border);
    border-radius: var(--gas-input-radius);
    padding: var(--gas-input-padding);
    font-size: var(--gas-text-s);
    color: var(--gas-input-color);
    background: var(--gas-input-bg);
    transition: border-color var(--gas-transition-fast), box-shadow var(--gas-transition-fast);
}

.search-input:focus,
.location-input:focus {
    outline: none;
    border-color: var(--gas-input-focus-border);
    box-shadow: var(--gas-input-focus-shadow);
}

.search-input::placeholder,
.location-input::placeholder {
    color: var(--gas-input-placeholder);
}

.radius-select {
    height: 38px;
    min-width: 90px;
    border: var(--gas-border-width) solid var(--gas-input-border);
    border-radius: var(--gas-input-radius);
    padding: 0 var(--gas-space-s);
    font-size: var(--gas-text-s);
    color: var(--gas-input-color);
    background: var(--gas-input-bg);
    cursor: pointer;
}

/* Buttons */
.search-button {
    height: 38px;
    padding: 0 var(--gas-space-m);
    background: var(--gas-accent);
    color: var(--gas-white);
    border: none;
    border-radius: var(--gas-button-radius);
    font-size: var(--gas-button-font-size);
    font-weight: var(--gas-button-font-weight);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--gas-button-transition);
}

.search-button:hover {
    background: var(--gas-accent-dark);
}

.toggle-advanced-button {
    height: 38px;
    width: 38px;
    padding: 0;
    background: var(--gas-neutral-200);
    color: var(--gas-neutral-700);
    border: var(--gas-border-width) solid var(--gas-neutral-300);
    border-radius: var(--gas-button-radius);
    font-size: 18px;
    font-weight: var(--gas-weight-bold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gas-button-transition);
}

.toggle-advanced-button:hover {
    background: var(--gas-neutral-300);
    color: var(--gas-neutral-900);
}

.toggle-advanced-button.active {
    background: var(--gas-primary);
    color: var(--gas-white);
    border-color: var(--gas-primary);
}

.reset-button {
    height: 38px;
    width: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gas-neutral-100);
    color: var(--gas-neutral-600);
    border: var(--gas-border-width) solid var(--gas-neutral-300);
    border-radius: var(--gas-button-radius);
    font-size: var(--gas-text-s);
    cursor: pointer;
    transition: all var(--gas-button-transition);
}

.reset-button:hover {
    background: var(--gas-danger-light);
    color: var(--gas-danger);
    border-color: var(--gas-danger-border);
}

/* Search around me */
.search-around-me-button {
    height: 38px;
    background: var(--gas-info-light);
    color: var(--gas-info-dark);
    border: var(--gas-border-width) solid var(--gas-info-lighter);
    padding: 0 var(--gas-space-s);
    border-radius: var(--gas-button-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--gas-space-xs);
    font-size: var(--gas-text-xs);
    font-weight: var(--gas-weight-medium);
    white-space: nowrap;
    transition: all var(--gas-button-transition);
}

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

.search-around-me-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Search help text */
.search-help {
    font-size: var(--gas-help-font-size);
    color: var(--gas-help-color);
    margin: var(--gas-space-xs) 0 0;
    font-style: italic;
    line-height: var(--gas-leading-normal);
}

/* ---- Advanced search panel (slides under sticky bar) ---- */

.advanced-search {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gas-space-m);
    padding: var(--gas-space-m);
    background: var(--gas-bg-surface-alt);
    border-bottom: var(--gas-border-width) solid var(--gas-neutral-200);
}

.advanced-search--stacked {
    flex-direction: column;
}

.advanced-section {
    flex: 1 1 280px;
    min-width: 0;
}

.advanced-search--stacked .advanced-section {
    flex: 1 1 auto;
}

.advanced-section h4 {
    font-size: var(--gas-text-s);
    font-weight: var(--gas-weight-semi);
    color: var(--gas-neutral-800);
    margin: 0 0 var(--gas-space-xs);
}

.selection-info {
    font-size: var(--gas-help-font-size);
    color: var(--gas-help-color);
    margin: 0 0 var(--gas-space-s);
}

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

.option-item {
    padding: var(--gas-space-xs) var(--gas-space-s);
    border-radius: var(--gas-radius-full);
    cursor: pointer;
    font-size: var(--gas-text-xs);
    font-weight: var(--gas-weight-medium);
    transition: all var(--gas-transition-fast);
    background: var(--gas-neutral-100);
    color: var(--gas-neutral-700);
    border: var(--gas-border-width) solid var(--gas-neutral-200);
    user-select: none;
}

.option-item:hover {
    background: var(--gas-neutral-200);
    border-color: var(--gas-neutral-400);
}

.option-item.selected {
    background: var(--gas-primary);
    color: var(--gas-white);
    border-color: var(--gas-primary);
}

/* ---- Search status ---- */

.search-status {
    padding: var(--gas-space-xs) var(--gas-space-m);
    transition: all var(--gas-transition-normal);
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.search-status-icon {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.status-spinner,
.status-check {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all var(--gas-transition-normal);
}

.status-spinner {
    border: 2px solid var(--gas-neutral-200);
    border-top-color: var(--gas-primary);
    border-radius: var(--gas-radius-full);
    animation: gas-spin 1s linear infinite;
}

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

.search-status-text {
    font-size: var(--gas-text-xs);
    color: var(--gas-neutral-600);
}

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

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

.search-status.error .search-status-text {
    color: var(--gas-danger);
}

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

/* ---- Split view: map + results side by side ---- */

.search-split-view {
    flex: 1;
    display: flex;
    gap: 0;
    min-height: 0; /* critical for flex child to scroll */
    overflow: hidden;
}

/* Map panel — left side, ~70% */
.search-map-panel {
    flex: 4;
    min-width: 0;
    min-height: 0;
    position: relative;
}

/* Vanilla version: #map is direct child */
.search-map-panel > .gas-map-container,
.search-map-panel > #map {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Vue version: wrapper uses position:absolute from vue-member-map.css
   Only override border-radius on the inner map container */
.search-map-panel .gas-vue-map-wrapper .gas-map-container {
    border-radius: 0;
}

/* Results panel — right side, ~30%, scrollable */
.search-results-panel {
    flex: 1.5;
    min-width: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--gas-bg-surface-alt);
    border-left: var(--gas-border-width) solid var(--gas-neutral-200);
}

.search-results-panel-inner {
    padding: var(--gas-space-m);
}

/* Results title inside panel */
.results-title {
    font-size: var(--gas-text-s);
    font-weight: var(--gas-weight-semi);
    color: var(--gas-neutral-700);
    margin: 0 0 var(--gas-space-m);
    padding-bottom: var(--gas-space-s);
    border-bottom: var(--gas-border-width) solid var(--gas-neutral-200);
}

/* Results grid — single column in split view */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: var(--gas-space-s);
}

/* Result card */
.result-item {
    display: flex;
    gap: var(--gas-space-m);
    background: var(--gas-card-bg);
    border-radius: var(--gas-card-radius);
    padding: var(--gas-space-m);
    border: var(--gas-border-width) solid var(--gas-neutral-200);
    transition: box-shadow var(--gas-transition-fast), border-color var(--gas-transition-fast);
    cursor: pointer;
}

.result-item:hover {
    box-shadow: var(--gas-shadow-m);
    border-color: var(--gas-primary-light);
}

.result-image {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
}

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

.result-details {
    flex: 1;
    min-width: 0;
}

.result-details h3 {
    color: var(--gas-primary);
    margin: 0 0 2px;
    font-size: var(--gas-text-s);
    font-weight: var(--gas-weight-semi);
    line-height: var(--gas-leading-tight);
}

.result-details h3 a {
    color: inherit;
    text-decoration: none;
}

.result-details h3 a:hover {
    text-decoration: underline;
}

.result-name {
    color: var(--gas-neutral-700);
    font-weight: var(--gas-weight-medium);
    font-size: var(--gas-text-xs);
    margin: 0 0 2px;
}

.result-name a {
    color: inherit;
    text-decoration: none;
}

.result-address {
    color: var(--gas-neutral-500);
    font-size: var(--gas-text-xs);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-address-city {
    font-weight: var(--gas-weight-medium);
    color: var(--gas-neutral-600);
}

.result-item:hover {
    box-shadow: var(--gas-shadow-m);
    border-color: var(--gas-primary);
    background: var(--gas-primary-ultra-light, #f0f4ff);
}

/* No results */
.no-results {
    text-align: center;
    padding: var(--gas-space-xl) var(--gas-space-m);
    color: var(--gas-neutral-500);
    font-style: italic;
    font-size: var(--gas-text-s);
}

/* Empty state in results panel */
.search-results-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--gas-space-xl);
    text-align: center;
    color: var(--gas-neutral-500);
}

.search-results-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: var(--gas-space-m);
    opacity: 0.4;
}

.search-results-empty-state p {
    font-size: var(--gas-text-s);
    margin: 0 0 var(--gas-space-xs);
    max-width: 280px;
}

.search-results-empty-state .empty-hint {
    font-size: var(--gas-text-xs);
    font-style: italic;
}

/* ---- Suggestions dropdown ---- */

.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: var(--gas-bg-surface);
    border: var(--gas-border-width) solid var(--gas-neutral-300);
    border-radius: var(--gas-radius-m);
    box-shadow: var(--gas-shadow-l);
    z-index: 200;
    margin-top: 4px;
}

/* Vue version: controlled by v-if, always display:block when present */
.search-suggestions[style*="display: block"],
.search-suggestions[style*="display:block"] {
    display: block;
}

.suggestion-item {
    padding: var(--gas-space-s) var(--gas-space-m);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--gas-space-s);
    border-bottom: var(--gas-border-width) solid var(--gas-neutral-100);
    transition: background var(--gas-transition-fast);
}

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

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

.suggestion-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: var(--gas-radius-full);
    background: var(--gas-neutral-100);
    color: var(--gas-neutral-600);
    font-weight: var(--gas-weight-semi);
    white-space: nowrap;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: var(--gas-weight-semi);
    color: var(--gas-neutral-900);
    font-size: var(--gas-text-s);
}

.suggestion-details {
    font-size: var(--gas-text-xs);
    color: var(--gas-neutral-500);
}

.no-suggestions {
    padding: var(--gas-space-m);
    text-align: center;
    color: var(--gas-neutral-500);
    font-size: var(--gas-text-s);
}

.no-suggestions p {
    margin: 0 0 var(--gas-space-xs);
}

/* ---- Mobile: stacked layout ---- */

@media screen and (max-width: 900px) {
    .search-page-wrapper {
        height: auto;
        min-height: auto;
    }

    /* Sticky bar stays */
    .search-main-row {
        flex-wrap: wrap;
    }

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

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

    .action-group {
        flex: 1 1 100%;
        justify-content: center;
    }

    /* Split view becomes stacked */
    .search-split-view {
        flex-direction: column;
        overflow: visible;
    }

    .search-map-panel {
        height: 400px;
        flex: none;
    }

    .search-results-panel {
        border-left: none;
        border-top: var(--gas-border-width) solid var(--gas-neutral-200);
        max-height: none;
        overflow-y: visible;
    }

    .result-image {
        flex: 0 0 56px;
        width: 56px;
        height: 56px;
    }

    /* Advanced sections stack */
    .advanced-search {
        flex-direction: column;
    }

    .advanced-section {
        flex: 1 1 100%;
    }
}

/* ---- Tablet tweaks ---- */

@media screen and (min-width: 901px) and (max-width: 1100px) {
    .search-map-panel {
        flex: 3;
    }

    .search-results-panel {
        flex: 2;
    }
}