/* مسیر فایل: assets/css/vira-search-public.css */

/* اعمال فونت سراسری برای محیط جستجو */
.vira-search-modal, .vira-search-inline-container {
    font-family: 'IRANYekanX', sans-serif !important;
}

/* کلاس جلوگیری از اسکرول صفحه هنگام باز بودن پاپ‌آپ */
body.vira-search-no-scroll {
    overflow: hidden !important;
}

/* پس‌زمینه پاپ‌آپ (فقط برای دکمه آیکون) */
.vira-search-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
}

/* بدنه اصلی پاپ‌آپ */
.vira-search-modal-content {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5); 
    margin: 10vh auto;
    padding: 30px 25px;
    border-radius: 24px;
    width: 90%;
    max-width: 700px;
    position: relative;
    direction: rtl;
}

/* ----- تغییرات جراحی شده برای حالت اینلاین (بدون پریدن به وسط صفحه و رفع مشکل عرض المنتور) ----- */
.vira-search-inline-wrapper {
    transition: z-index 0s;
    position: relative; /* برای حفظ جریان داکیومنت */
    width: 100%; /* اصلاح شد: حذف !important برای تعامل با المنتور */
    min-width: 250px; /* اضافه شد: جلوگیری از مچاله شدن در حالت عرض پیش‌فرض المنتور */
    display: block; /* اصلاح شد: حذف !important */
}

.vira-search-inline-wrapper.is-active {
    z-index: 999999 !important;
}

.vira-search-inline-container {
    position: relative; 
    width: 100%; /* اصلاح شد: حذف !important */
    transition: all 0.3s ease; 
}

/* وقتی فرم اینلاین فعال میشه: سر جای خودش می‌ماند و فقط رو می‌آید */
.vira-search-inline-container.is-active {
    position: relative !important;
    width: 100%; /* اصلاح شد: حذف !important */
    max-width: 100% !important;
    z-index: 999999 !important;
}

/* کلاس کمکی */
.vira-escape-overflow {
    overflow: visible !important;
    z-index: 999999 !important;
}

.vira-search-inline-container .vira-search-modal-content {
    margin: 0; 
    width: 100%;
    box-shadow: none;
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    position: relative;
    /* اصلاح جراحی‌شده: تغییر z-index از 999999 به 9 برای جلوگیری از افتادن روی پاپ‌آپ‌های دیگر در حالت غیرفعال */
    z-index: 9 !important; 
    padding: 0;
    display: block !important;
}

/* اصلاح جراحی‌شده جدید: برگرداندن z-index بالا فقط در زمان فعال بودن (فوکوس روی سرچ) تا زیر اورلی خودش نرود */
.vira-search-inline-container.is-active .vira-search-modal-content {
    z-index: 999999 !important;
}

.vira-search-inline-container .vira-search-close {
    display: none !important;
}

/* دراپ‌داون دیجی‌کالایی برای حالت اینلاین - تغییر به حالت گلس‌مورفیسم مشابه پاپ‌آپ */
.vira-search-inline-container .vira-search-results-area {
    position: absolute;
    top: calc(100% + 8px); 
    right: 0;
    width: 100%;
    z-index: 9999999;
    display: none;
    background: rgba(255, 255, 255, 0.75); 
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.9); 
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5); 
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
}

/* لایه اورلی تیره دیجی‌کالایی برای پشت دراپ‌داون */
.vira-search-inline-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999998; 
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* فرم و فیلد جستجو */
.vira-search-form {
    position: relative;
    width: 100%; /* اصلاح شد: حذف !important برای ارث‌بری صحیح عرض از المنتور */
}

.vira-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px; 
    width: 100%; /* اصلاح شد: حذف !important */
}

/* فیلد جستجوی اصلی (پاپ‌آپ) */
.vira-search-input {
    flex-grow: 1; 
    /* تغییر جراحی شده: کاهش ارتفاع از طریق کم کردن پدینگ بالا و پایین (7px به جای 12px) */
    padding: 7px 25px !important; 
    font-size: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important; 
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 50px !important; 
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    color: #333 !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.04), inset 0 2px 4px rgba(255, 255, 255, 0.8) !important;
    font-family: inherit !important;
}

.vira-search-input:focus {
    outline: none !important;
    background: #ffffff !important;
    border-color: rgba(255, 90, 0, 0.4) !important;
    box-shadow: 0 0 0 4px rgba(255, 90, 0, 0.1), 0 8px 25px rgba(0, 0, 0, 0.06) !important;
}

/* ----- استایل اینپوت دیجی‌کالایی مخصوص حالت اینلاین ----- */
.vira-search-inline-container .vira-search-input {
    background-color: #f1f2f4 !important; 
    /* اضافه کردن آیکون جستجو با SVG به صورت پس‌زمینه */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a3a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 18px center !important; /* قرارگیری دقیق آیکون در سمت راست */
    background-size: 20px !important;
    /* تغییر جراحی شده: تنظیم پدینگ سمت راست روی 50px برای جلوگیری از روی هم افتادن آیکون و نوشته در حالت RTL */
    padding: 7px 50px 7px 20px !important; 
    border: 1px solid transparent !important; 
    box-shadow: none !important; 
    border-radius: 50px !important; 
    width: 100% !important; 
}

/* حفظ آیکون در حالت فوکوس */
.vira-search-inline-container .vira-search-input:focus {
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a3a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
    padding: 7px 50px 7px 20px !important;
    border-color: #ff5a00 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}
/* ------------------------------------------------------------------ */

/* دکمه بستن (برای پاپ آپ اصلی) */
.vira-search-close {
    position: relative; 
    left: auto;
    top: auto;
    transform: none;
    color: #666;
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.02);
    border-radius: 50%;
    width: 48px; 
    height: 48px;
    flex-shrink: 0; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.vira-search-close:hover { 
    color: #fff;
    background: #ff5a00; 
    border-color: #ff5a00;
    box-shadow: 0 6px 15px rgba(255, 90, 0, 0.3);
    transform: translateY(-2px); 
}

/* ----- استایل‌های بخش پیش‌فرض (کپسول‌ها و بنر) ----- */
.vira-search-default-view {
    margin-top: 25px;
    animation: fadeIn 0.4s ease;
}

.vira-search-inline-container .vira-search-default-view {
    margin-top: 0;
}

.vira-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #444;
    font-size: 14px;
    font-weight: 600;
}

.vira-search-header svg {
    margin-left: 8px;
    color: #ff5a00;
}

/* تغییر جراحی شده: تبدیل دکمه پاک کردن به کپسول سازمانی */
.vira-clear-recent-searches {
    background: rgba(255, 90, 0, 0.08) !important; 
    border: 1px solid rgba(255, 90, 0, 0.2) !important; 
    padding: 6px 14px !important; 
    margin: 0 !important; 
    box-shadow: none !important; 
    outline: none !important; 
    border-radius: 30px !important; 
    color: #ff5a00 !important;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: normal !important;
}

.vira-clear-recent-searches:hover {
    background: #ff5a00 !important;
    color: #ffffff !important;
    border-color: #ff5a00 !important;
    box-shadow: 0 4px 10px rgba(255, 90, 0, 0.2) !important;
}

.vira-capsule-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.vira-capsule {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 30px;
    color: #333;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.vira-capsule:hover {
    background: #ffffff;
    border-color: #ff5a00;
    color: #ff5a00;
    box-shadow: 0 4px 10px rgba(255, 90, 0, 0.1);
    transform: translateY(-1px);
}

.vira-search-banner-wrapper {
    margin-top: 20px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.vira-search-banner-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.vira-search-banner-wrapper:hover .vira-search-banner-img {
    transform: scale(1.02);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.vira-search-loader {
    text-align: center;
    margin-top: 20px;
    color: #ff5a00;
    font-size: 14px;
    font-weight: 500;
}

.vira-search-results {
    margin-top: 20px;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,90,0,0.4) transparent;
    padding-left: 5px;
    animation: fadeIn 0.4s ease;
}

.vira-search-inline-container .vira-search-results {
    max-height: 350px;
}

.vira-search-results::-webkit-scrollbar {
    width: 6px;
}
.vira-search-results::-webkit-scrollbar-thumb {
    background: rgba(255,90,0,0.4);
    border-radius: 10px;
}

.vira-search-result-item {
    display: flex;
    align-items: center;
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.vira-search-result-item:hover { 
    background: rgba(255, 255, 255, 1);
    transform: scale(1.01) translateY(-2px); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    border-color: rgba(255, 90, 0, 0.3); 
}

.vira-search-result-image {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    margin-left: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.vira-search-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.vira-search-result-type {
    font-size: 11px;
    color: #555;
    margin-top: 6px;
    background: rgba(255, 90, 0, 0.1);
    color: #ff5a00;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
}
