/**
 * home-search.css - استایل باکس جست‌وجوی صفحه اصلی «لیست من»
 *
 * این فایل با صفحه اصلی سایت (`/index.php`) بارگذاری می‌شود:
 *   $pageStyles = ['assets/css/home-search.css'];
 *
 * بخش‌ها:
 *   ۱) نوار/هرون جست‌وجو زیر هدر (.home-search، .home-search-field، .home-search-input…)
 *   ۲) پیشنهاد زنده زیر باکس (.home-search-suggest و سطرهای .home-search-row)
 *      — سطرها با قالب‌های <template> صفحه اصلی ساخته می‌شوند و JS فقط مقدار می‌گذارد
 *   ۳) نتیجه‌های کامل صفحه (?q=) در شبکه کارت‌ها (.home-search-grid، .home-search-card)
 *
 * رنگ‌ها فقط از متغیرهای مشترک هدر سایت می‌آیند (--green-*، --red-*، --gray-*، --radius،
 * --shadow) تا پالت سبز/قرمز پروژه حفظ شود. همه بخش‌ها از موبایل (۳۲۰px) تا دسکتاپ
 * کاملاً واکنش‌گرا هستند.
 *
 * نکته: برچسب «آخرین آپدیت قیمت» با همان کلاس صفحه اختصاصی
 * (.mypersonalpage-seller-updated) رندر می‌شود تا ظاهر یکسان باشد؛ چون صفحه اصلی
 * فایل mypersonalpage.css را بارگذاری نمی‌کند، همان استایل اینجا هم تکرار شده است.
 */

/* ---------- نوار جست‌وجو (زیر هدر، اولین بخش <main>) ---------- */
.home-search {
    position: relative;
    margin: 0 0 26px;
    padding: 26px 0 30px;
    background: radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .16), transparent 46%), radial-gradient(circle at 8% 92%, rgba(255, 255, 255, .12), transparent 42%), linear-gradient(135deg, #0172c1 0%, #0b5187 58%, #031f35 100%);
    color: var(--white);
}

#main > section > div > div > form > div > button.btn.btn-green.home-search-submit{
    background: red;
}
.home-search-hero {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.home-search-title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

.home-search-subtitle {
    margin: 0 0 18px;
    font-size: .92rem;
    color: rgba(240, 253, 244, .92);
    line-height: 1.9;
}

/* ---------- فرم و باکس جست‌وجو ---------- */
.home-search-form { position: relative; }

.home-search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 6px;
    background: var(--white);
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 999px;
    box-shadow: 0 18px 38px rgba(8, 47, 26, .28);
    transition: box-shadow .2s ease, transform .2s ease;
}

/* دکمه پاک‌کردن پیش‌فرض مرورگر پنهان می‌شود (دکمه پاک‌کردن خودمان را داریم) */
.home-search-input::-webkit-search-cancel-button,
.home-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.home-search-field:focus-within {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .35), 0 18px 38px rgba(8, 47, 26, .30);
}

.home-search-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-inline-start: 4px;
    border-radius: 50%;
    background: var(--green-050);
    color: var(--green-700);
}

.home-search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 4px;
    border: 0;
    background: transparent;
    color: var(--gray-900);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.8;
}

.home-search-input:focus { outline: none; }
.home-search-input::placeholder { color: #9aa5b1; }

/* دکمه پاک‌کردن: تا وقتی چیزی تایپ نشده پنهان است (JS آن را نشان می‌دهد) */
.home-search-clear {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f5f2;
    color: var(--gray-600);
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}

.home-search-clear:hover { background: #e4ece6; color: var(--red-700); }
.home-search-clear:focus-visible { outline: 3px solid var(--green-500); outline-offset: 2px; }

.home-search-submit { flex: 0 0 auto; padding: 10px 22px; border-radius: 999px; }

.home-search-hint {
    margin: 12px 0 0;
    font-size: .8rem;
    color: rgba(240, 253, 244, .88);
}

/* ---------- پیام وضعیت (در حال جست‌وجو، خطا، …) ---------- */
.home-search-status {
    margin: 10px 0 0;
    font-size: .82rem;
    color: rgba(240, 253, 244, .95);
}

.home-search-status[hidden] { display: none !important; }
.home-search-status.is-error { color: #ffe4e6; font-weight: 700; }

/* ---------- پیشنهاد زنده (کشوی نتایج زیر باکس) ---------- */
.home-search-suggest {
    position: absolute;
    z-index: 40;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid rgba(20, 83, 45, .12);
    border-radius: 18px;
    background: var(--white);
    box-shadow: 0 24px 50px rgba(8, 47, 26, .28);
    text-align: start;
}

.home-search-suggest[hidden] { display: none !important; }

.home-search-suggest-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #eef3ef;
    background: var(--green-050);
    font-size: .78rem;
    color: var(--gray-600);
}

.home-search-suggest-count { font-weight: 700; color: var(--green-700); }

.home-search-suggest-list {
    margin: 0;
    padding: 6px;
    max-height: min(56vh, 460px);
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}

.home-search-suggest-foot {
    padding: 10px 14px;
    border-top: 1px solid #eef3ef;
    background: #fafcfb;
    font-size: .76rem;
    color: var(--gray-600);
}

.home-search-suggest-empty {
    margin: 0;
    padding: 22px 16px;
    background: var(--white);
    color: var(--gray-600);
    font-size: .86rem;
    text-align: center;
    line-height: 1.9;
}

.home-search-suggest-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-inline-end: 6px;
    border: 2px solid rgba(22, 163, 74, .25);
    border-top-color: var(--green-600);
    border-radius: 50%;
    vertical-align: -2px;
    animation: home-search-spin .7s linear infinite;
}

@keyframes home-search-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .home-search-suggest-spinner { animation-duration: 2s; }
}

/* برجسته‌سازی کلمه جست‌وجو در نتیجه‌ها (هم در کشوی پیشنهاد و هم در کارت‌ها) */
.home-search-mark {
    padding: 0 2px;
    border-radius: 4px;
    background: rgba(250, 204, 21, .38);
    color: inherit;
    font-weight: 700;
}

/* ---------- سطرهای نتیجه در کشوی پیشنهاد ---------- */
.home-search-suggest-item { margin: 0; }

.home-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.home-search-suggest-item + .home-search-suggest-item > .home-search-row {
    border-top: 1px solid #f3f7f4;
}

.home-search-row:hover { background: var(--green-050); }

/* سطر فعال با کلیدهای بالا/پایین (سمت راست، هم‌سو با RTL) */
.home-search-row.is-active {
    background: var(--green-050);
    box-shadow: inset -3px 0 0 0 var(--green-600);
}

.home-search-row:focus-visible { outline: 3px solid var(--green-500); outline-offset: -2px; }

.home-search-row-media {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border: 1px solid #dcf0e2;
    border-radius: 12px;
    background: var(--green-050);
}

.home-search-row-initial {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-700);
}

.home-search-row-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-search-row-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.home-search-row-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.home-search-row-title {
    overflow: hidden;
    font-size: .93rem;
    font-weight: 700;
    color: var(--gray-900);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-search-row-badge {
    flex: 0 0 auto;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--green-050);
    color: var(--green-700);
    font-size: .68rem;
    font-weight: 700;
}

.home-search-row[data-type="product"] .home-search-row-badge {
    background: #fef2f2;
    color: var(--red-700);
}

.home-search-row[data-type="product"] .home-search-row-media { border-color: #f6dedd; }

.home-search-row-sub,
.home-search-row-price {
    overflow: hidden;
    font-size: .78rem;
    color: var(--gray-600);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-search-row-meta {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.home-search-row-price { font-weight: 700; color: var(--green-700); }

.home-search-row-arrow {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f4f8f5;
    color: var(--green-700);
}

/* ---------- برچسب «آخرین آپدیت قیمت» (هم‌شکل صفحه اختصاصی من) ---------- */
.mypersonalpage-seller-updated {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 10px;
    border: 1px solid #d7e9dc;
    border-radius: 999px;
    background: var(--green-050);
    font-size: .74rem;
    color: var(--gray-600);
    line-height: 1.8;
}

.mypersonalpage-seller-updated-label { font-weight: 700; color: var(--green-700); }
.mypersonalpage-seller-updated strong { font-weight: 700; color: var(--gray-900); }

/* آپدیت کمتر از ۲۴ ساعت: نقطه سبز چشمک‌زن تا «تازه‌ترین» فروشنده‌ها به چشم بیایند */
.home-search-row-updated.is-fresh::before,
.home-search-card-updated.is-fresh::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green-500);
    animation: home-search-pulse 1.6s ease-in-out infinite;
}

@keyframes home-search-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .45; transform: scale(.8); }
}

@media (prefers-reduced-motion: reduce) {
    .home-search-row-updated.is-fresh::before,
    .home-search-card-updated.is-fresh::before { animation: none; }
}

.home-search-row-updated { margin: 4px 0 0; }

/* ---------- بخش نتیجه‌های کامل صفحه اصلی (?q=…) ---------- */
.home-search-results { margin: 0 0 26px; }

.home-search-results-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
}

.home-search-results-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.1rem;
    color: var(--green-900);
}

.home-search-count {
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--green-050);
    color: var(--green-700);
    font-size: .76rem;
    font-weight: 700;
}

/* نوار فیلتر نوع نتیجه (همه / فروشندگان / محصول‌ها) — لینک ساده، بدون جاوااسکریپت */
.home-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-search-filter {
    padding: 5px 14px;
    border: 1px solid #d7e9dc;
    border-radius: 999px;
    background: var(--white);
    color: var(--gray-600);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.home-search-filter:hover { background: var(--green-050); color: var(--green-700); }

.home-search-filter.is-active {
    border-color: var(--green-600);
    background: var(--green-600);
    color: var(--white);
}

/* ---------- شبکه کارت‌های نتیجه ---------- */
.home-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.home-search-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(20, 83, 45, .10);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 8px 22px rgba(20, 83, 45, .10);
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.home-search-card:hover {
    transform: translateY(-3px);
    border-color: rgba(22, 163, 74, .45);
    box-shadow: 0 16px 34px rgba(20, 83, 45, .16);
}

.home-search-card:focus-visible { outline: 3px solid var(--green-500); outline-offset: 2px; }

.home-search-card-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--green-050) 0%, #e6f6ec 100%);
}

.home-search-card[data-type="product"] .home-search-card-media {
    background: linear-gradient(135deg, #fef2f2 0%, #fde8e8 100%);
}

.home-search-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.home-search-card-placeholder {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green-700);
}

.home-search-card[data-type="product"] .home-search-card-placeholder { color: var(--red-700); }

.home-search-card-badge {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    padding: 2px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--green-700);
    font-size: .7rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(20, 83, 45, .14);
}

.home-search-card[data-type="product"] .home-search-card-badge { color: var(--red-700); }

.home-search-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
}

.home-search-card-title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .95rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.9;
}

.home-search-card-sub { margin: 0; font-size: .8rem; color: var(--gray-600); }

.home-search-card-price {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--green-700);
}

.home-search-card[data-type="product"] .home-search-card-price { color: var(--red-700); }

.home-search-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed rgba(20, 83, 45, .16);
    font-size: .8rem;
    font-weight: 700;
    color: var(--green-700);
}

/* ---------- حالت‌های خالی و راهنما ---------- */
.home-search-empty {
    margin: 0;
    padding: 26px 18px;
    border: 1px dashed #d7e9dc;
    border-radius: var(--radius);
    background: var(--green-050);
    color: var(--gray-600);
    font-size: .9rem;
    text-align: center;
    line-height: 2;
}

.home-search-note {
    margin: 14px 0 0;
    font-size: .8rem;
    color: var(--gray-600);
}

.home-search-note a { color: var(--green-700); font-weight: 700; }

/* عناصر پنهان‌شده با hidden حتی اگر display سفارشی داشته باشند پنهان می‌مانند */
.home-search [hidden],
.home-search-suggest [hidden] { display: none !important; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 900px) {
    .home-search-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

@media (max-width: 640px) {
    .home-search { padding: 20px 0 24px; }
    .home-search-title { font-size: 1.25rem; }
    .home-search-subtitle { font-size: .86rem; }
    .home-search-field { flex-wrap: wrap; border-radius: 22px; padding: 10px; }
    .home-search-icon { width: 34px; height: 34px; margin-inline-start: 0; }
    .home-search-input { padding: 8px 4px; font-size: .95rem; }
    .home-search-submit { width: 100%; }
    .home-search-row { gap: 10px; padding: 10px; }
    .home-search-row-media { width: 44px; height: 44px; }
    .home-search-row-arrow { display: none; }
    .home-search-grid { grid-template-columns: 1fr; }
    .home-search-results-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
    .home-search-row-title { white-space: normal; }
    .home-search-row-meta { align-items: flex-end; }
    .home-search-suggest-list { max-height: 62vh; }
}
.site-main {
    flex: 1 1 auto;
    padding: 11px 0 32px 0;
}