/* =========================
   SEARCH BUTTON
========================= */

.search-bar {
    gap: 8px;
}

.search-bar button {
    padding: 12px 20px;

    border: 1px solid #c79b27;
    border-radius: 22px;

    background: #d8ad35;
    color: white;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        transform 0.2s,
        background-color 0.2s;
}

.search-bar button:hover {
    transform: translateY(-2px);
    background: #c69d2d;
}

/* =========================
   SEARCH PAGE BAR
========================= */

.search-page-bar {
    max-width: 720px;
    margin: 24px auto 0;
    padding: 0 20px;

    box-sizing: border-box;
}

.search-page-bar .search-autocomplete-wrapper {
    flex: 1;
}

.search-page-bar input[type="search"] {
    width: 100%;
    min-width: 0;
    height: 46px;

    padding: 0 18px;

    border: 1px solid rgba(90, 70, 20, 0.22);
    border-radius: 999px;

    background: rgba(255, 253, 245, 0.96);

    color: #3f351d;

    font-family: inherit;
    font-size: 14px;

    box-shadow:
        0 3px 12px rgba(80, 60, 20, 0.06);

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.search-page-bar input[type="search"]:focus {
    outline: none;

    border-color: rgba(180, 137, 32, 0.65);

    background: #fffdf5;

    box-shadow:
        0 0 0 3px rgba(216, 173, 53, 0.13),
        0 4px 14px rgba(80, 60, 20, 0.08);
}

.search-page-bar button {
    min-height: 46px;
    padding: 0 21px;

    border-radius: 999px;

    font-weight: 700;

    box-shadow:
        0 3px 10px rgba(80, 60, 20, 0.08);
}

/* =========================
   SEARCH PAGE
========================= */

.search-page {
    max-width: 1080px;
    margin: 0 auto 75px;
    padding: 0 20px;
    box-sizing: border-box;
}

.search-page > h1 {
    margin: 18px 0 8px;

    color: #3f351d;

    font-size: clamp(30px, 4vw, 38px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;

    text-align: center;
}

.search-summary {
    max-width: 650px;

    margin: 0 auto 32px;

    color: #746746;

    font-size: 14px;
    line-height: 1.5;

    text-align: center;
}

.search-summary strong {
    color: #4f401c;
    font-weight: 750;
}

/* =========================
   SECTIONS
========================= */

.search-section {
    margin-bottom: 40px;
}

.search-section > h2 {
    margin: 0 0 15px;

    color: #4a3b16;
    font-size: 22px;
}


/* =========================
   HOBBIES
========================= */

.search-hobbies {
    display: flex;
    flex-wrap: wrap;

    gap: 9px;
}

.search-hobby {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;
    padding: 7px 15px;

    box-sizing: border-box;

    border: 1px solid rgba(90, 70, 20, 0.14);
    border-radius: 999px;

    background: rgba(255, 250, 224, 0.76);

    color: #5f4e24;

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;

    box-shadow:
        0 2px 7px rgba(80, 60, 20, 0.035);

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.search-hobby:hover {
    transform: translateY(-2px);

    border-color: rgba(90, 70, 20, 0.24);

    background: rgba(255, 232, 145, 0.72);

    box-shadow:
        0 5px 12px rgba(80, 60, 20, 0.07);
}

/* =========================
   PROJECTS
========================= */

.search-projects {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}

.search-project {
    display: flex;

    min-width: 0;
    overflow: hidden;

    border: 1px solid rgba(90, 70, 20, 0.14);
    border-radius: 16px;

    background: rgba(255, 252, 235, 0.88);

    box-shadow:
        0 3px 12px rgba(80, 60, 20, 0.055);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-project:hover {
    transform: translateY(-3px);

    border-color: rgba(90, 70, 20, 0.22);

    box-shadow:
        0 9px 24px rgba(80, 60, 20, 0.1);
}


/* IMAGE */

.search-project-image {
    width: 150px;
    min-height: 190px;
    flex: 0 0 150px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background:
        rgba(255, 225, 120, 0.35);

    color: inherit;
    text-decoration: none;
}

.search-project-image img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    transition:
        transform 0.3s ease;
}

.search-project:hover
.search-project-image img {
    transform: scale(1.035);
}

.search-project-image span {
    font-size: 42px;

    transition:
        transform 0.2s ease;
}

.search-project:hover
.search-project-image span {
    transform: scale(1.08);
}


/* CONTENT */

.search-project-content {
    min-width: 0;
    flex: 1;

    padding: 17px 18px;

    box-sizing: border-box;
}

.search-project-hobby {
    display: inline-flex;
    align-items: center;

    color: #8a712c;

    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.025em;

    text-decoration: none;
}

.search-project-hobby:hover {
    color: #66521c;
    text-decoration: underline;
}

.search-project-content h3 {
    margin: 6px 0 8px;

    font-size: 17px;
    line-height: 1.3;
}

.search-project-content h3 a {
    display: -webkit-box;

    overflow: hidden;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    color: #3f351d;

    text-decoration: none;

    transition:
        color 0.18s ease;
}

.search-project-content h3 a:hover {
    color: #765f20;
}

/* =========================
   USERS
========================= */

.search-users {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 14px;
}

.search-user {
    display: flex;
    align-items: center;

    gap: 14px;

    min-width: 0;
    padding: 16px;

    border: 1px solid rgba(90, 70, 20, 0.14);
    border-radius: 16px;

    background: rgba(255, 252, 235, 0.88);

    color: #3f351d;
    text-decoration: none;

    box-shadow:
        0 3px 10px rgba(80, 60, 20, 0.045);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-user:hover {
    transform: translateY(-2px);

    border-color: rgba(90, 70, 20, 0.22);

    box-shadow:
        0 7px 18px rgba(80, 60, 20, 0.085);
}


/* AVATAR */

.search-user-avatar {
    width: 58px;
    height: 58px;

    flex: 0 0 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border: 1px solid rgba(90, 70, 20, 0.1);
    border-radius: 50%;

    background: rgba(255, 225, 120, 0.42);

    font-size: 27px;

    transition:
        transform 0.2s ease;
}

.search-user:hover
.search-user-avatar {
    transform: scale(1.035);
}

.search-user-avatar img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* USER TEXT */

.search-user > div:last-child {
    min-width: 0;
}

.search-user h3 {
    margin: 0 0 5px;

    overflow: hidden;

    color: #40361e;

    font-size: 15px;
    font-weight: 750;
    line-height: 1.3;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-user p {
    display: -webkit-box;

    margin: 0;

    overflow: hidden;

    color: #756a4e;

    font-size: 12.5px;
    line-height: 1.45;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* =========================
   EMPTY SEARCH
========================= */

.search-empty {
    max-width: 620px;

    margin: 32px auto 45px;
    padding: 38px 30px;

    box-sizing: border-box;

    border: 1px dashed rgba(90, 70, 20, 0.2);
    border-radius: 18px;

    background: rgba(255, 252, 235, 0.7);

    color: #716548;

    text-align: center;

    box-shadow:
        0 3px 12px rgba(80, 60, 20, 0.035);
}

.search-empty h2,
.search-empty h3 {
    margin: 0 0 8px;

    color: #493d20;

    font-size: 20px;
    font-weight: 750;
    line-height: 1.3;
}

.search-empty p {
    max-width: 470px;

    margin: 0 auto;

    color: #766b50;

    font-size: 13px;
    line-height: 1.6;
}

.search-empty a {
    color: #725c1d;

    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.search-empty a:hover {
    color: #4c3d17;
}

@media (max-width: 520px) {

    .search-empty {
        margin-top: 24px;
        padding: 30px 20px;
    }

    .search-empty h2,
    .search-empty h3 {
        font-size: 18px;
    }
}


/* =========================
   SEARCH TABS
========================= */

.search-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 7px;

    max-width: 720px;
    margin: 22px auto 30px;
}

.search-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;
    padding: 7px 14px;

    box-sizing: border-box;

    border: 1px solid rgba(90, 70, 20, 0.16);
    border-radius: 999px;

    background: rgba(255, 250, 224, 0.72);

    color: #66552d;

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.search-tabs a:hover {
    transform: translateY(-1px);

    background: rgba(255, 239, 172, 0.8);

    border-color: rgba(90, 70, 20, 0.24);
}

.search-tabs a.active {
    background: rgba(255, 221, 103, 0.82);

    border-color: rgba(90, 70, 20, 0.28);

    color: #493a14;

    box-shadow:
        0 2px 8px rgba(80, 60, 20, 0.07);
}

.search-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 20px;
    height: 20px;

    margin-left: 6px;
    padding: 0 6px;

    box-sizing: border-box;

    border-radius: 999px;

    background: rgba(90, 70, 20, 0.08);

    color: #74643a;

    font-size: 10px;
    font-weight: 750;
}

.search-tabs a.active .search-tab-count {
    background: rgba(255, 255, 255, 0.52);
    color: #493a14;
}

@media (max-width: 520px) {

    .search-tabs {
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 7px;

        margin-top: 18px;
        margin-bottom: 26px;
    }

    .search-tabs a {
        width: 100%;
    }
}

/* =========================
   SEARCH FILTERS
========================= */

.search-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;

    gap: 12px;

    margin: 0 0 34px;
    padding: 18px;

    border: 1px solid rgba(90, 70, 20, 0.14);
    border-radius: 16px;

    background: rgba(255, 250, 224, 0.72);

    box-shadow:
        0 3px 12px rgba(80, 60, 20, 0.045);
}

.search-filters label {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;

    gap: 7px;
}

.search-filters label span {
    color: #66552d;

    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.search-filters select {
    width: 100%;
    min-height: 42px;

    padding: 8px 34px 8px 12px;

    border: 1px solid rgba(90, 70, 20, 0.2);
    border-radius: 10px;

    background-color: #fffdf5;

    color: #4d4227;

    font-family: inherit;
    font-size: 13px;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.search-filters select:hover {
    border-color: rgba(90, 70, 20, 0.32);
}

.search-filters select:focus {
    outline: none;

    border-color: rgba(180, 137, 32, 0.65);

    background-color: #fff;

    box-shadow:
        0 0 0 3px rgba(216, 173, 53, 0.12);
}

.search-filters button {
    min-height: 42px;
    padding: 8px 17px;

    border: 1px solid rgba(90, 70, 20, 0.22);
    border-radius: 999px;

    background: rgba(255, 221, 103, 0.88);

    color: #4d4227;

    font-family: inherit;
    font-size: 12px;
    font-weight: 750;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.search-filters button:hover {
    transform: translateY(-1px);

    background: rgba(255, 210, 90, 0.95);

    box-shadow:
        0 3px 9px rgba(80, 60, 20, 0.07);
}

.search-filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 7px;

    color: #746643;

    font-size: 12px;
    font-weight: 650;

    text-decoration: none;
}

.search-filter-reset:hover {
    color: #4d4227;
    text-decoration: underline;
}

@media (max-width: 600px) {

    .search-filters {
        align-items: stretch;

        padding: 15px;
    }

    .search-filters label {
        flex-basis: 100%;
    }

    .search-filters button,
    .search-filter-reset {
        width: 100%;
    }
}

/* =========================
   PROJECT RESULT DETAILS
========================= */

.search-project-description {
    display: -webkit-box;

    overflow: hidden;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    margin: 0 0 13px;

    color: #746a4f;

    font-size: 12.5px;
    line-height: 1.5;
}

/* =========================
   PROJECT META
========================= */

.search-project-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 6px;

    margin: 11px 0 13px;
}

.search-project-meta span {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 24px;
    padding: 4px 9px;

    box-sizing: border-box;

    border: 1px solid rgba(90, 70, 20, 0.1);
    border-radius: 999px;

    background: rgba(255, 232, 145, 0.34);

    color: #675936;

    font-size: 10.5px;
    font-weight: 650;
    line-height: 1;

    white-space: nowrap;
}

/* =========================
   PROJECT CREATOR
========================= */

.search-project-user {
    display: inline-flex;
    align-items: center;

    max-width: 100%;

    color: #746846;

    font-size: 11.5px;
    font-weight: 650;

    text-decoration: none;

    transition:
        color 0.18s ease;
}

.search-project-user:hover {
    color: #4f411f;
    text-decoration: underline;
}

/* =========================
   SEARCH PAGINATION
========================= */

.search-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    gap: 15px;

    margin-top: 34px;
    padding-top: 22px;

    border-top: 1px solid rgba(90, 70, 20, 0.1);
}

.search-pagination-side {
    display: flex;
}

.search-pagination-next {
    justify-content: flex-end;
}

.search-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;
    padding: 7px 15px;

    box-sizing: border-box;

    border: 1px solid rgba(90, 70, 20, 0.16);
    border-radius: 999px;

    background: rgba(255, 250, 224, 0.78);

    color: #5d4b20;

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;

    box-shadow:
        0 2px 7px rgba(80, 60, 20, 0.035);

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.search-page-button:hover {
    transform: translateY(-1px);

    border-color: rgba(90, 70, 20, 0.24);

    background: rgba(255, 232, 145, 0.72);

    box-shadow:
        0 4px 10px rgba(80, 60, 20, 0.065);
}

.search-page-status {
    color: #75694c;

    font-size: 11.5px;
    font-weight: 650;

    text-align: center;
    white-space: nowrap;
}

@media (max-width: 520px) {

    .search-pagination {
        grid-template-columns: 1fr 1fr;

        gap: 9px;

        margin-top: 28px;
        padding-top: 18px;
    }

    .search-page-button {
        width: 100%;
    }

    .search-page-status {
        grid-column: 1 / -1;
        grid-row: 2;

        margin-top: 4px;
    }

    .search-pagination-next {
        justify-content: flex-end;
    }
}


/* =========================
   SEARCH HIGHLIGHT
========================= */

.search-highlight {
    padding: 1px 2px;

    border-radius: 3px;

    background: rgba(255, 215, 80, 0.55);

    color: inherit;

    font-weight: inherit;
}

/* =========================
   LIVE SEARCH AUTOCOMPLETE
========================= */

.search-autocomplete-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-autocomplete-wrapper > input {
    width: 100%;
}

.search-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;

    z-index: 1000;

    max-height: 520px;
    overflow-y: auto;

    background: #fff;

    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 14px;

    box-shadow:
        0 12px 35px
        rgba(0, 0, 0, 0.14);

    text-align: left;
}

.search-autocomplete[hidden] {
    display: none;
}

.autocomplete-heading {
    padding: 11px 14px 6px;

    font-size: 0.78rem;
    font-weight: 700;

    color: #777;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 10px 14px;

    color: inherit;
    text-decoration: none;

    transition:
        background 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background:
        rgba(0, 0, 0, 0.055);
}

.autocomplete-icon,
.autocomplete-image,
.autocomplete-avatar {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #f2f2f2;
}

.autocomplete-icon,
.autocomplete-image {
    border-radius: 8px;
}

.autocomplete-avatar {
    border-radius: 50%;
}

.autocomplete-image img,
.autocomplete-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autocomplete-content {
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 2px;
}

.autocomplete-content strong {
    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-content small {
    color: #777;
}

.autocomplete-search-all {
    margin-top: 5px;

    border-top:
        1px solid rgba(0, 0, 0, 0.08);

    font-weight: 600;
}

.autocomplete-loading,
.autocomplete-empty {
    padding: 16px;

    color: #777;

    text-align: center;
}


/* MOBILE */

@media (max-width: 600px) {

    .search-autocomplete {
        max-height: 65vh;
    }

    .autocomplete-item {
        padding:
            10px 12px;
    }
}

/* =========================
   AUTOCOMPLETE OVERLAY FIX
========================= */

.home-search {
    position: relative;
    z-index: 50;
}

.home-search .search-autocomplete-wrapper {
    position: relative;
    z-index: 100;
}

.home-search .search-autocomplete {
    position: absolute;

    top: calc(100% + 8px);
    left: 0;
    right: 0;

    z-index: 9999;

    max-height: min(520px, 60vh);
    overflow-y: auto;

    overscroll-behavior: contain;
}


/* =========================
   SEARCH PAGE — FINAL MOBILE PASS
========================= */

@media (max-width: 600px) {

    .search-page {
        margin-bottom: 55px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .search-page > h1 {
        margin-top: 14px;

        font-size: 29px;
    }

    .search-summary {
        margin-bottom: 25px;

        font-size: 13px;
    }


    /* Main search field */

    .search-page-bar {
        width: 100%;

        margin-top: 18px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .search-page-bar input[type="search"] {
        height: 44px;
    }

    .search-page-bar button {
        min-height: 44px;
    }


    /* Sections */

    .search-section {
        margin-bottom: 34px;
    }

    .search-section > h2 {
        margin-bottom: 13px;

        font-size: 19px;
    }


    /* Project cards */

    .search-projects,
    .search-users {
        grid-template-columns: 1fr;
    }

    .search-project {
        flex-direction: row;
    }

    .search-project-image {
        width: 120px;
        min-height: 170px;
        flex-basis: 120px;
    }

    .search-project-content {
        padding: 14px;
    }

    .search-project-content h3 {
        font-size: 16px;
    }


    /* User cards */

    .search-user {
        padding: 14px;
    }

    .search-user-avatar {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }
}


@media (max-width: 420px) {

    .search-project {
        flex-direction: column;
    }

    .search-project-image {
        width: 100%;
        height: 190px;
        min-height: 0;
        flex-basis: auto;
    }

    .search-project-content {
        padding: 15px;
    }
}

/* =========================
   SEARCH PAGE — ACCESSIBILITY
========================= */

.search-tabs a:focus-visible,
.search-hobby:focus-visible,
.search-project-image:focus-visible,
.search-project-content h3 a:focus-visible,
.search-project-hobby:focus-visible,
.search-project-user:focus-visible,
.search-user:focus-visible,
.search-page-button:focus-visible,
.search-filter-reset:focus-visible,
.autocomplete-item:focus-visible {
    outline: 3px solid rgba(180, 137, 32, 0.48);
    outline-offset: 3px;
}

.search-filters button:focus-visible,
.search-page-bar button:focus-visible {
    outline: 3px solid rgba(180, 137, 32, 0.48);
    outline-offset: 2px;
}

.search-filters select:focus-visible {
    outline: 3px solid rgba(180, 137, 32, 0.35);
    outline-offset: 2px;
}


/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {

    .search-tabs a,
    .search-hobby,
    .search-project,
    .search-project-image img,
    .search-project-image span,
    .search-project-content h3 a,
    .search-user,
    .search-user-avatar,
    .search-page-button,
    .search-filters button {
        transition: none;
    }

    .search-tabs a:hover,
    .search-hobby:hover,
    .search-project:hover,
    .search-user:hover,
    .search-page-button:hover,
    .search-filters button:hover {
        transform: none;
    }

    .search-project:hover .search-project-image img,
    .search-project:hover .search-project-image span,
    .search-user:hover .search-user-avatar {
        transform: none;
    }
}