/* =====================================================
   IQRANIX — EXPLORE & SEARCH
   Updated to use community-nav.css
===================================================== */

:root {
    --green: #087653;
    --dark: #171717;
    --muted: #888888;
    --border: #eeeeee;
    --soft: #f2f2f2;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    background: var(--white);
}

body {
    font-family: "DM Sans", Arial, sans-serif;
    color: var(--dark);
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

/* =====================================================
   MAIN PAGE
===================================================== */

.search-page {
    width: 100%;
    max-width: 900px;
    min-height: 100vh;
    margin: 0 auto;
}

/* =====================================================
   HEADER
===================================================== */

.search-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 19px 30px 26px;
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
}

.search-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 43px;
    margin-bottom: 22px;
}

.search-title-row h1 {
    font-size: 29px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.8px;
}

.back-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #111111;
}

.back-button svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-header.searching .back-button {
    display: flex;
}

.search-header.searching .search-title-row h1 {
    display: none;
}

/* =====================================================
   SEARCH BAR
===================================================== */

.search-input-wrapper {
    width: 100%;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 17px;
    background: #f1f1f1;
    border: 1px solid transparent;
    border-radius: 17px;
}

.search-input-wrapper:focus-within {
    border-color: #d4e9df;
    background: #f5f5f5;
}

.search-icon {
    width: 27px;
    height: 27px;
    flex-shrink: 0;
    fill: none;
    stroke: #777777;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-input-wrapper input {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #222222;
    font-size: 16px;
}

.search-input-wrapper input::placeholder {
    color: #999999;
}

.search-input-wrapper input::-webkit-search-cancel-button {
    display: none;
}

#clearSearch {
    display: none;
    flex-shrink: 0;
    padding: 0 3px;
    border: none;
    background: transparent;
    color: #777777;
    font-size: 25px;
}

#clearSearch.visible {
    display: block;
}

/* =====================================================
   EXPLORE HEADING
===================================================== */

.explore-heading {
    padding: 23px 15px 17px;
}

.explore-heading h2 {
    font-size: 20px;
    font-weight: 700;
}

.explore-heading p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

/* =====================================================
   EXPLORE GRID
===================================================== */

.explore-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    align-items: start;
}

.explore-grid > * {
    min-width: 0;
}

.explore-post {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
}

.explore-post img,
.explore-post video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.explore-post-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 9px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.5),
        transparent 55%
    );
    color: #ffffff;
}

.explore-post-overlay span {
    font-size: 11px;
    font-weight: 600;
}

.explore-post-video-icon {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.text-post-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #eaf4ee;
    text-align: center;
}

.text-post-placeholder p {
    color: #24553d;
    font-size: 11px;
    line-height: 1.5;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* =====================================================
   SECTION HEADINGS
===================================================== */

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 19px 16px 13px;
}

.section-heading h2 {
    font-size: 15px;
    font-weight: 700;
}

#clearRecentSearches {
    border: none;
    background: transparent;
    color: var(--green);
    font-size: 13px;
    font-weight: 600;
}

.suggested-heading {
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

/* =====================================================
   RECENT SEARCHES
===================================================== */

.recent-searches {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.recent-search-item {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 16px;
}

.recent-search-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f3f3;
    color: #777777;
}

.recent-search-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.recent-search-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: #333333;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-recent {
    padding: 5px;
    border: none;
    background: transparent;
    color: #888888;
    font-size: 21px;
}

.no-recent {
    padding: 10px 16px;
    color: var(--muted);
    font-size: 13px;
}

/* =====================================================
   PEOPLE RESULTS
===================================================== */

.people-results {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 15px 12px;
}

.person-result {
    width: 100%;
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.person-result-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    display: block;
    object-fit: cover;
    border-radius: 50%;
    background: #eeeeee;
    border: 1px solid var(--border);
}

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

.person-result-info h3 {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-result-info p {
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.loading-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 15px;
    color: var(--muted);
    font-size: 13px;
}

.loader {
    width: 25px;
    height: 25px;
    border: 2px solid #e9e9e9;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: searchSpin 0.8s linear infinite;
}

@keyframes searchSpin {
    to {
        transform: rotate(360deg);
    }
}

.small-loading {
    padding: 12px 16px;
    color: var(--muted);
    font-size: 12px;
}

/* =====================================================
   EMPTY STATES
===================================================== */

.empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 55px 20px;
    text-align: center;
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border: 1.5px solid #222222;
    border-radius: 50%;
    color: var(--green);
    font-size: 27px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 700;
}

.empty-state p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

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

@media (max-width: 380px) {

    .search-header {
        padding-left: 18px;
        padding-right: 18px;
    }

    .search-title-row h1 {
        font-size: 26px;
    }

    .search-input-wrapper {
        height: 53px;
    }

}

/* =====================================================
   TABLET AND DESKTOP
===================================================== */

@media (min-width: 700px) {

    .search-header {
        padding: 22px 25px;
    }

    .search-input-wrapper {
        max-width: 650px;
    }

    .explore-grid {
        gap: 4px;
    }

}
