/* =========================================================
   AluminiumGlass
   File: /public_html/assets/css/search.css

   Purpose:
   Global Search UI
   Home Search
   Location + Business Search
   Search Results
   Suggestions
   Filters
   Pagination
   Mobile Responsive Search

   IMPORTANT:
   - Single search bar layout
   - No duplicate/wrapped search bar on mobile
   - Works on small Android phones
   - Works on tablets and desktop
   ========================================================= */


/* =========================================================
   SEARCH VARIABLES
   ========================================================= */

:root {
    --search-bg: #ffffff;
    --search-border: #d9dee7;
    --search-border-focus: #2563eb;

    --search-text: #111827;
    --search-muted: #6b7280;

    --search-primary: #2563eb;
    --search-primary-hover: #1d4ed8;

    --search-success: #16a34a;
    --search-danger: #dc2626;
    --search-warning: #d97706;

    --search-radius: 12px;

    --search-shadow:
        0 8px 30px rgba(15, 23, 42, 0.08);

    --search-mobile-gap: 8px;
}


/* =========================================================
   SEARCH CONTAINER
   ========================================================= */

.search-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.search-section {
    width: 100%;
}

.search-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}


/* =========================================================
   MAIN SEARCH FORM
   ========================================================= */

.main-search-form {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* =========================================================
   MAIN SEARCH BOX
   ========================================================= */

/*
   Desktop:

   [ What are you looking for ] [ Location ] [ Search ]

   Mobile:

   [ 🔍 What are you looking for ]
   [ 📍 Location                 ]
   [        Search               ]

   BUT:
   This is still ONE search component/form.
*/

.search-box {
    display: grid;

    grid-template-columns:
        minmax(0, 1.45fr)
        minmax(150px, 0.85fr)
        auto;

    align-items: stretch;

    width: 100%;
    min-height: 58px;

    margin: 0;
    padding: 5px;

    box-sizing: border-box;

    background: var(--search-bg);

    border: 1px solid var(--search-border);
    border-radius: var(--search-radius);

    box-shadow: var(--search-shadow);

    overflow: visible;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--search-border-focus);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12),
        var(--search-shadow);
}


/* =========================================================
   SEARCH FIELD
   ========================================================= */

.search-field {
    position: relative;

    display: flex;
    align-items: center;

    min-width: 0;
    min-height: 48px;

    box-sizing: border-box;

    background: transparent;
}

.search-field + .search-field {
    border-left: 1px solid #e5e7eb;
}


/* =========================================================
   SEARCH FIELD LABEL
   ========================================================= */

.search-field label {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}


/* =========================================================
   SEARCH ICON
   ========================================================= */

.search-icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 48px;

    width: 48px;
    min-width: 48px;
    height: 48px;

    color: var(--search-muted);

    font-size: 20px;

    box-sizing: border-box;
}

.search-icon svg {
    width: 20px;
    height: 20px;

    fill: currentColor;
}

.search-field .search-icon {
    margin-left: 2px;
}


/* =========================================================
   SEARCH INPUT
   ========================================================= */

.search-input {
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;

    height: 48px;

    margin: 0;
    padding: 0 12px;

    box-sizing: border-box;

    border: 0;
    outline: none;

    background: transparent;

    color: var(--search-text);

    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;

    appearance: none;
}

.search-input::placeholder {
    color: var(--search-muted);
    opacity: 1;
}

.search-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}


/* =========================================================
   LOCATION INPUT
   ========================================================= */

#search-location {
    flex: 1 1 auto;

    min-width: 0;
}


/* =========================================================
   LOCATION ICON / PREFIX
   ========================================================= */

.location-icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 44px;

    width: 44px;
    min-width: 44px;
    height: 48px;

    color: var(--search-muted);

    font-size: 19px;
}

.location-icon svg {
    width: 19px;
    height: 19px;

    fill: currentColor;
}


/* =========================================================
   SEARCH BUTTON
   ========================================================= */

.search-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    min-width: 112px;
    height: 46px;

    margin: 1px;

    padding: 0 20px;

    box-sizing: border-box;

    border: 0;
    border-radius: 9px;

    background: var(--search-primary);
    color: #ffffff;

    font-family: inherit;
    font-size: 15px;
    font-weight: 600;

    white-space: nowrap;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

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

.search-button:active {
    transform: translateY(1px);
}

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


/* =========================================================
   SEARCH CLEAR BUTTON
   ========================================================= */

.search-clear {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 38px;

    width: 38px;
    height: 38px;

    margin-right: 4px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;

    color: var(--search-muted);

    font-size: 18px;

    cursor: pointer;
}

.search-clear:hover {
    background: #f3f4f6;
    color: var(--search-text);
}


/* =========================================================
   SEARCH SUGGESTIONS
   ========================================================= */

.search-suggestions {
    position: absolute;

    z-index: 1000;

    top: calc(100% + 8px);
    left: 0;
    right: 0;

    display: none;

    max-height: 420px;

    overflow-x: hidden;
    overflow-y: auto;

    box-sizing: border-box;

    background: #ffffff;

    border: 1px solid var(--search-border);
    border-radius: 12px;

    box-shadow:
        0 15px 40px rgba(15, 23, 42, 0.12);
}

.search-wrapper.is-active .search-suggestions {
    display: block;
}


/* =========================================================
   SUGGESTION ITEM
   ========================================================= */

.search-suggestion {
    display: flex;

    align-items: center;

    gap: 12px;

    width: 100%;
    min-height: 52px;

    padding: 10px 16px;

    box-sizing: border-box;

    border: 0;
    border-bottom: 1px solid #f1f5f9;

    background: #ffffff;

    color: var(--search-text);

    text-align: left;

    cursor: pointer;

    transition:
        background 0.15s ease;
}

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

.search-suggestion:hover,
.search-suggestion.is-active {
    background: #f8fafc;
}


/* =========================================================
   SUGGESTION ICON
   ========================================================= */

.search-suggestion-icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 34px;

    width: 34px;
    height: 34px;

    border-radius: 8px;

    background: #eff6ff;

    color: var(--search-primary);
}


/* =========================================================
   SUGGESTION CONTENT
   ========================================================= */

.search-suggestion-content {
    flex: 1;

    min-width: 0;
}

.search-suggestion-title {
    display: block;

    overflow: hidden;

    color: var(--search-text);

    font-size: 14px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion-meta {
    display: block;

    margin-top: 3px;

    color: var(--search-muted);

    font-size: 12px;
}


/* =========================================================
   SEARCH HISTORY
   ========================================================= */

.search-history {
    padding: 8px 0;
}

.search-history-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding: 10px 16px;
}

.search-history-title {
    color: var(--search-text);

    font-size: 13px;
    font-weight: 700;
}

.search-history-clear {
    padding: 4px 6px;

    border: 0;

    background: transparent;

    color: var(--search-primary);

    font-size: 12px;

    cursor: pointer;
}


/* =========================================================
   SEARCH FILTERS
   ========================================================= */

.search-filters {
    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: 10px;

    width: 100%;

    margin-top: 16px;
}

.search-filter {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    min-height: 38px;

    padding: 0 13px;

    box-sizing: border-box;

    border: 1px solid var(--search-border);
    border-radius: 8px;

    background: #ffffff;

    color: var(--search-text);

    font-size: 13px;

    cursor: pointer;
}

.search-filter:hover {
    border-color: #b8c0cc;
}

.search-filter.is-active {
    border-color: var(--search-primary);

    background: #eff6ff;

    color: var(--search-primary);
}


/* =========================================================
   SEARCH RESULTS
   ========================================================= */

.search-results {
    width: 100%;

    margin-top: 24px;
}

.search-results-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 18px;
}

.search-results-title {
    margin: 0;

    color: var(--search-text);

    font-size: 20px;
    font-weight: 700;
}

.search-results-count {
    color: var(--search-muted);

    font-size: 14px;
}


/* =========================================================
   RESULT SORT
   ========================================================= */

.search-sort {
    display: flex;

    align-items: center;

    gap: 8px;
}

.search-sort label {
    color: var(--search-muted);

    font-size: 13px;
}

.search-sort select {
    min-height: 38px;

    padding: 0 32px 0 10px;

    border: 1px solid var(--search-border);
    border-radius: 8px;

    background: #ffffff;

    color: var(--search-text);

    font-family: inherit;
    font-size: 13px;

    outline: none;
}

.search-sort select:focus {
    border-color: var(--search-primary);
}


/* =========================================================
   RESULT LIST
   ========================================================= */

.search-result-list {
    display: grid;

    grid-template-columns: 1fr;

    gap: 16px;

    width: 100%;
}

.search-result-item {
    width: 100%;

    padding: 18px;

    box-sizing: border-box;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: #ffffff;

    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.search-result-item:hover {
    border-color: #d1d5db;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.08);

    transform: translateY(-1px);
}


/* =========================================================
   RESULT CONTENT
   ========================================================= */

.search-result-main {
    display: flex;

    gap: 16px;

    min-width: 0;
}

.search-result-image {
    flex: 0 0 100px;

    width: 100px;
    height: 100px;

    overflow: hidden;

    border-radius: 10px;

    background: #f3f4f6;
}

.search-result-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.search-result-content {
    flex: 1;

    min-width: 0;
}

.search-result-title {
    margin: 0 0 5px;

    color: var(--search-text);

    font-size: 17px;
    font-weight: 700;

    line-height: 1.35;
}

.search-result-title a {
    color: inherit;

    text-decoration: none;
}

.search-result-title a:hover {
    color: var(--search-primary);
}

.search-result-category {
    margin-bottom: 6px;

    color: var(--search-primary);

    font-size: 13px;
    font-weight: 600;
}

.search-result-location {
    display: flex;

    align-items: flex-start;

    gap: 5px;

    margin-bottom: 8px;

    color: var(--search-muted);

    font-size: 13px;

    line-height: 1.4;
}

.search-result-description {
    margin: 0;

    color: #4b5563;

    font-size: 14px;

    line-height: 1.6;
}


/* =========================================================
   RATING
   ========================================================= */

.search-rating {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    margin-top: 8px;
}

.search-rating-stars {
    color: #f59e0b;

    letter-spacing: 1px;
}

.search-rating-value {
    color: var(--search-text);

    font-size: 13px;
    font-weight: 600;
}

.search-rating-count {
    color: var(--search-muted);

    font-size: 12px;
}


/* =========================================================
   RESULT ACTIONS
   ========================================================= */

.search-result-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 15px;
    padding-top: 14px;

    border-top: 1px solid #f1f5f9;
}

.search-result-action {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 36px;

    padding: 0 12px;

    box-sizing: border-box;

    border: 1px solid var(--search-border);
    border-radius: 7px;

    background: #ffffff;

    color: var(--search-text);

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;
}

.search-result-action:hover {
    border-color: var(--search-primary);

    color: var(--search-primary);
}

.search-result-action.primary {
    border-color: var(--search-primary);

    background: var(--search-primary);

    color: #ffffff;
}

.search-result-action.primary:hover {
    background: var(--search-primary-hover);
}


/* =========================================================
   VERIFIED BADGE
   ========================================================= */

.search-verified {
    display: inline-flex;

    align-items: center;

    gap: 4px;

    margin-left: 6px;

    padding: 3px 7px;

    border-radius: 999px;

    background: #ecfdf5;

    color: var(--search-success);

    font-size: 11px;
    font-weight: 700;

    vertical-align: middle;
}


/* =========================================================
   FEATURED RESULT
   ========================================================= */

.search-result-item.featured {
    border-color: #bfdbfe;

    background:
        linear-gradient(
            180deg,
            #f8fbff 0%,
            #ffffff 100%
        );
}

.search-featured-badge {
    display: inline-flex;

    align-items: center;

    margin-bottom: 8px;

    padding: 4px 8px;

    border-radius: 6px;

    background: #eff6ff;

    color: var(--search-primary);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.search-empty {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    min-height: 300px;

    padding: 40px 20px;

    box-sizing: border-box;

    border: 1px dashed #d1d5db;
    border-radius: 12px;

    background: #ffffff;

    text-align: center;
}

.search-empty-icon {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 64px;
    height: 64px;

    margin-bottom: 16px;

    border-radius: 50%;

    background: #f3f4f6;

    color: var(--search-muted);

    font-size: 26px;
}

.search-empty-title {
    margin: 0 0 8px;

    color: var(--search-text);

    font-size: 18px;
    font-weight: 700;
}

.search-empty-text {
    max-width: 500px;

    margin: 0;

    color: var(--search-muted);

    font-size: 14px;

    line-height: 1.6;
}


/* =========================================================
   LOADING
   ========================================================= */

.search-loading {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 180px;

    color: var(--search-muted);
}

.search-spinner {
    width: 28px;
    height: 28px;

    margin-right: 10px;

    border: 3px solid #e5e7eb;
    border-top-color: var(--search-primary);

    border-radius: 50%;

    animation: search-spin 0.8s linear infinite;
}

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


/* =========================================================
   ERROR
   ========================================================= */

.search-error {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 14px 16px;

    border: 1px solid #fecaca;
    border-radius: 9px;

    background: #fef2f2;

    color: var(--search-danger);

    font-size: 14px;

    line-height: 1.5;
}


/* =========================================================
   PAGINATION
   ========================================================= */

.search-pagination {
    display: flex;

    flex-wrap: wrap;

    align-items: center;
    justify-content: center;

    gap: 6px;

    margin-top: 28px;
}

.search-page {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 38px;
    height: 38px;

    padding: 0 10px;

    box-sizing: border-box;

    border: 1px solid var(--search-border);
    border-radius: 7px;

    background: #ffffff;

    color: var(--search-text);

    font-size: 13px;

    text-decoration: none;

    cursor: pointer;
}

.search-page:hover {
    border-color: var(--search-primary);

    color: var(--search-primary);
}

.search-page.active {
    border-color: var(--search-primary);

    background: var(--search-primary);

    color: #ffffff;
}

.search-page.disabled {
    opacity: 0.5;

    pointer-events: none;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .search-container {
        padding: 16px;
    }

    .search-box {
        grid-template-columns:
            minmax(0, 1.2fr)
            minmax(140px, 0.8fr)
            auto;
    }

    .search-button {
        min-width: 100px;

        padding-left: 16px;
        padding-right: 16px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    /*
       IMPORTANT:

       Search stays as ONE component.

       Desktop:
       What | Location | Search

       Mobile:
       What
       Location
       Search

       No flex-wrap is used.
       No second search bar is created.
    */

    .search-container {
        width: 100%;

        padding: 12px;

        box-sizing: border-box;
    }

    .search-wrapper {
        width: 100%;

        min-width: 0;
    }

    .main-search-form {
        width: 100%;

        min-width: 0;
    }

    .search-box {
        display: grid;

        grid-template-columns: minmax(0, 1fr);

        width: 100%;

        min-height: auto;

        padding: 5px;

        gap: 0;

        box-sizing: border-box;

        border-radius: 12px;

        overflow: visible;
    }

    .search-field {
        width: 100%;

        min-width: 0;
        min-height: 48px;
    }

    .search-field + .search-field {
        border-left: 0;

        border-top: 1px solid #e5e7eb;
    }

    .search-icon {
        flex-basis: 42px;

        width: 42px;
        min-width: 42px;

        height: 48px;

        font-size: 18px;
    }

    .location-icon {
        flex-basis: 42px;

        width: 42px;
        min-width: 42px;

        height: 48px;
    }

    .search-input {
        width: 100%;
        min-width: 0;

        height: 48px;

        padding: 0 10px;

        font-size: 15px;
    }

    .search-button {
        width: 100%;
        min-width: 0;

        height: 46px;

        margin: 5px 0 0;

        border-radius: 9px;

        font-size: 14px;
    }

    .search-suggestions {
        top: calc(100% + 6px);

        max-height: 60vh;
    }

    .search-results-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 10px;
    }

    .search-sort {
        width: 100%;
    }

    .search-sort select {
        flex: 1;

        min-width: 0;
    }

    .search-result-main {
        gap: 12px;
    }

    .search-result-image {
        flex-basis: 80px;

        width: 80px;
        height: 80px;
    }

    .search-result-title {
        font-size: 15px;
    }

    .search-result-description {
        font-size: 13px;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

    .search-container {
        padding: 10px;
    }

    .search-box {
        width: 100%;

        padding: 4px;

        border-radius: 11px;
    }

    .search-field {
        min-height: 46px;
    }

    .search-input {
        height: 46px;

        font-size: 14px;
    }

    .search-icon,
    .location-icon {
        height: 46px;

        flex-basis: 40px;

        width: 40px;
        min-width: 40px;
    }

    .search-button {
        height: 44px;

        margin-top: 4px;

        font-size: 14px;
    }

    .search-suggestion {
        min-height: 48px;

        padding: 9px 12px;
    }

    .search-result-item {
        padding: 14px;
    }

    .search-result-main {
        flex-direction: column;
    }

    .search-result-image {
        width: 100%;
        height: 160px;

        flex-basis: auto;
    }

    .search-result-actions {
        flex-direction: column;
    }

    .search-result-action {
        width: 100%;
    }

    .search-filters {
        gap: 6px;
    }

    .search-filter {
        font-size: 12px;
    }

    .search-results-title {
        font-size: 18px;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 360px) {

    .search-container {
        padding: 8px;
    }

    .search-box {
        padding: 3px;
    }

    .search-input {
        font-size: 14px;
    }

    .search-button {
        height: 43px;

        font-size: 13px;
    }

    .search-result-item {
        padding: 12px;
    }

}


/* =========================================================
   LANDSCAPE MOBILE
   ========================================================= */

@media (max-width: 768px) and (orientation: landscape) {

    .search-box {
        grid-template-columns:
            minmax(0, 1.3fr)
            minmax(150px, 0.8fr)
            auto;
    }

    .search-field + .search-field {
        border-top: 0;

        border-left: 1px solid #e5e7eb;
    }

    .search-button {
        width: auto;

        min-width: 95px;

        margin: 1px;
    }

}


/* =========================================================
   TOUCH DEVICES
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    .search-button {
        min-height: 44px;
    }

    .search-clear {
        min-width: 40px;
        min-height: 40px;
    }

    .search-filter {
        min-height: 42px;
    }

    .search-page {
        min-width: 42px;
        height: 42px;
    }

}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.search-input:focus-visible,
.search-button:focus-visible,
.search-clear:focus-visible,
.search-filter:focus-visible,
.search-result-action:focus-visible,
.search-page:focus-visible,
.search-suggestion:focus-visible,
.search-history-clear:focus-visible,
.search-sort select:focus-visible {

    outline: 3px solid rgba(37, 99, 235, 0.25);

    outline-offset: 2px;
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .search-box,
    .search-button,
    .search-result-item,
    .search-suggestion {

        transition: none;
    }

    .search-spinner {
        animation: none;
    }

}


/* =========================================================
   PRINT
   ========================================================= */

@media print {

    .search-button,
    .search-clear,
    .search-filters,
    .search-sort,
    .search-result-actions,
    .search-pagination {

        display: none !important;
    }

    .search-result-item {

        break-inside: avoid;

        box-shadow: none;
    }

}