/* Task #810: "new search" bar on the golf product/package detail page.
   Self-contained copy of the landing-page search-form styles so the
   shared partial (templates/_golf_search_form.html, gsf_mode='bar')
   renders and behaves the same here without touching the landing CSS.
   Loaded only on the product page. */

.golf-search-bar.search-section {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px auto 0;
    max-width: 1200px;
}

.search-section {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.search-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 4px;
}

.search-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(170px, 1.2fr) minmax(120px, 1fr) minmax(150px, auto);
    gap: 12px;
    align-items: end;
}
.search-form #nationality {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.search-form #roomsSelectorBtn {
    min-width: 0;
}
.search-form #roomsSummary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.search-form .btn-search-submit {
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .search-form {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .search-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

.search-summary-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    color: var(--primary-dark, var(--dark-blue));
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    gap: 10px;
    border: 2px solid var(--primary-orange);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.search-summary-bar .summary-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-summary-bar .summary-text i {
    margin-right: 8px;
    color: var(--primary-orange);
}
.search-summary-bar .summary-edit {
    flex-shrink: 0;
    background: var(--primary-orange);
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 768px) {
    .search-section.collapsed .search-title,
    .search-section.collapsed .search-subtitle,
    .search-section.collapsed .search-form {
        display: none;
    }
    .search-section.collapsed .search-summary-bar {
        display: flex;
    }
    .search-section.collapsed {
        padding: 12px 16px;
    }
    .golf-search-bar .gsf-bar-collapse {
        display: flex;
    }
}

.gsf-bar-collapse {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--primary-dark, var(--dark-blue));
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    z-index: 5;
}
.golf-search-bar .search-form {
    position: relative;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(246, 166, 35, 0.2);
}

.city-input-wrapper {
    position: relative;
}

.city-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.city-suggestions.active {
    display: block;
}

.city-suggestion {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

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

.city-suggestion:hover {
    background: var(--light-gray);
}

.golf-dest-picker {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    display: none;
    min-width: 320px;
    width: max(100%, 560px);
    max-width: 92vw;
    overflow: hidden;
}
.golf-dest-picker.active { display: block; }
.gdp-search { padding: 10px; border-bottom: 1px solid #eee; background: #fafafa; }
.gdp-search input {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.gdp-tabs { display: flex; border-bottom: 1px solid #eee; background: #fff; }
.gdp-tab {
    flex: 1; background: none; border: none; padding: 12px 8px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: #666; border-bottom: 3px solid transparent;
}
.gdp-tab.active { color: var(--golf-green, #2d8a4e); border-bottom-color: var(--golf-green, #2d8a4e); }
.gdp-tab:hover { background: #f8f8f8; }
.gdp-body { max-height: 420px; overflow: hidden; display: flex; flex-direction: column; }
.gdp-tab-pane { display: none; flex: 1; overflow: hidden; }
.gdp-tab-pane.active { display: flex; }
.gdp-split { display: flex; flex: 1; min-height: 0; }
.gdp-left { width: 45%; border-right: 1px solid #eee; overflow-y: auto; max-height: 420px; }
.gdp-right { flex: 1; overflow-y: auto; max-height: 420px; padding: 6px 0; }
.gdp-country-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 8px; }
.gdp-country {
    padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.gdp-country:hover { background: #f3f4f6; }
.gdp-country.active { background: #e6f4ec; color: var(--golf-green, #2d8a4e); font-weight: 600; }
.gdp-country.inactive { color: #bbb; cursor: not-allowed; opacity: 0.6; }
.gdp-country.inactive:hover { background: transparent; }
.gdp-country .gdp-country-count { font-size: 11px; color: #999; }
.gdp-region { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f4f4f4; font-size: 13px; }
.gdp-region:hover { background: #f8f8f8; }
.gdp-region.active { background: #e6f4ec; color: var(--golf-green, #2d8a4e); font-weight: 600; }
.gdp-dest {
    padding: 8px 14px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #fafafa;
}
.gdp-dest:hover { background: #f3f4f6; }
.gdp-dest .gdp-dest-name { flex: 1; }
.gdp-dest .gdp-dest-badge {
    font-size: 11px; color: #888; background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
}
.gdp-dest .gdp-dest-badge.golf { color: #065f46; background: #ecfdf5; }
.gdp-dest .gdp-dest-badge.nearby { color: #6b7280; background: #f3f4f6; }
.gdp-empty { padding: 24px 16px; text-align: center; color: #888; font-size: 13px; }
.gdp-section-title { padding: 8px 12px 4px; font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.gdp-popular { padding: 8px; max-height: 420px; overflow-y: auto; }
.gdp-search-results { max-height: 420px; overflow-y: auto; flex: 1; }

.gdp-mobile-close { display: none; }

@media (max-width: 600px) {
    .golf-dest-picker { width: 100%; min-width: 0; }
    .gdp-split { flex-direction: column; }
    .gdp-left { width: 100%; max-height: 200px; border-right: none; border-bottom: 1px solid #eee; }
    .gdp-country-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    body.gdp-mobile-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        left: 0;
        right: 0;
    }
    body.gdp-mobile-open .city-input-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        z-index: 10000;
        background: #fff;
        display: flex;
        flex-direction: column;
        padding: 12px 0 0 0;
        box-sizing: border-box;
        overscroll-behavior: contain;
    }
    body.gdp-mobile-open #cityInput {
        position: relative;
        margin: 0 60px 12px 16px;
        padding: 12px 14px;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-size: 16px;
        flex-shrink: 0;
        width: auto;
        box-sizing: border-box;
    }
    body.gdp-mobile-open .gdp-mobile-close {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: #f3f4f6;
        color: #333;
        border: none;
        border-radius: 8px;
        font-size: 18px;
        cursor: pointer;
        z-index: 1;
        padding: 0;
    }
    body.gdp-mobile-open .gdp-mobile-close:active {
        background: #e5e7eb;
    }
    body.gdp-mobile-open #citySuggestions {
        display: none !important;
    }
    body.gdp-mobile-open .golf-dest-picker.active {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        flex: 1;
        min-height: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    body.gdp-mobile-open .gdp-tabs {
        flex-shrink: 0;
    }
    body.gdp-mobile-open .gdp-body {
        max-height: none;
        flex: 1;
        min-height: 0;
    }
    body.gdp-mobile-open .gdp-tab-pane.active {
        height: 100%;
    }
    body.gdp-mobile-open .gdp-left,
    body.gdp-mobile-open .gdp-right,
    body.gdp-mobile-open .gdp-popular,
    body.gdp-mobile-open .gdp-search-results {
        max-height: none;
    }
    body.gdp-mobile-open .gdp-left {
        max-height: 35vh;
    }
}

.rooms-selector-wrapper {
    position: relative;
}

.rooms-selector-btn {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rooms-selector-btn:hover {
    border-color: var(--primary-orange);
}

.rooms-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 320px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 200;
    padding: 16px;
}

.rooms-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 12px;
    font-weight: 600;
}

.rooms-counter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.counter-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.counter-btn:hover:not(:disabled) {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.counter-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.room-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.room-card-header {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-blue);
    margin-bottom: 12px;
}

.guest-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.guest-row label,
.guest-row .guest-row-label {
    font-size: 13px;
    color: var(--text-dark);
}

.guest-row label small,
.guest-row .guest-row-label small {
    color: var(--text-muted);
}

.children-ages {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.age-selects {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.age-select {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.age-select label {
    font-size: 11px;
    color: var(--text-muted);
}

.age-select select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 70px;
}

.rooms-dropdown-footer {
    padding-top: 12px;
    border-top: 1px solid #eee;
    margin-top: 12px;
}

.btn-apply {
    width: 100%;
    padding: 10px;
    background: var(--primary-orange);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-apply:hover {
    background: #e09000;
}

.btn-search-submit {
    padding: 12px 24px;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
