/*
Theme Name: OceanWP Child
Theme URI: https://oceanwp.org/
Description: چایلد تم سفارشی برای قالب OceanWP
Author: فناوری اطلاعات طوبی
Author URI: https://www.toobasoft.com/
Template: oceanwp
Version: 1.0.0
*/

/* ========================================= */
/* استایل های صفحه نتایج جستجو - OceanWP */
/* ========================================= */

/* هدر نتایج (هم‌تراز کردن تیتر و دکمه‌ها در یک خط) */
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    margin: 40px 0 25px 0;
    padding-bottom: 12px;
}
.search-section-title {
    font-size: 24px;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* کنترلرهای تغییر چیدمان با آیکن */
.search-view-controllers {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-view-controllers button {
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-view-controllers button:hover,
.search-view-controllers button.active {
    background: #13aff0; /* رنگ سازمانی شما */
    color: #fff;
    border-color: #13aff0;
}

/* ساختار گرید (شبکه ای) */
.search-items-wrapper {
    display: grid;
    gap: 20px;
}

/* حالت 4 ستونه (پیش فرض) */
#custom-search-results.view-grid-4 .search-items-wrapper { grid-template-columns: repeat(4, 1fr); }
/* حالت 3 ستونه */
#custom-search-results.view-grid-3 .search-items-wrapper { grid-template-columns: repeat(3, 1fr); }

/* ========================================= */
/* استایل کارت ها و افکت هاور جذاب */
/* ========================================= */
.search-item {
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s ease; /* انیمیشن نرم */
    display: flex;
    flex-direction: column;
}
/* افکت بالا پریدن و سایه هنگام رفتن ماوس روی کارت */
.search-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
    border-color: #13aff0;
}

/* استایل عکس محصولات - نمایش کامل و کوچکتر */
.item-thumbnail {
    padding: 20px; /* ایجاد فاصله از لبه‌ها برای کوچک شدن عکس */
    background: #fff;
}
.item-thumbnail img {
    width: 100%;
    height: 180px; /* ارتفاع ثابت */
    object-fit: contain; /* عکس را کامل نمایش میدهد و برش نمیزند */
    margin: 0 auto;
    transition: transform 0.4s ease;
}
.search-item:hover .item-thumbnail img {
    transform: scale(1.05); /* زوم ملایم عکس در هاور */
}
.post-item .item-thumbnail img {
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    padding: 0; /* عکس مقالات تمام عرض باشد بهتر است */
}

/* جزئیات کارت */
.item-details {
    padding: 0 15px 15px 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: center;
}
.item-title {
    font-size: 15px;
    margin: 0 0 12px 0;
    line-height: 1.5;
}
.item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}
.search-item:hover .item-title a {
    color: #13aff0;
}
.item-price {
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 18px;
    font-size: 16px;
}
.item-excerpt {
    font-size: 13px;
    color: #777;
    margin-bottom: 15px;
    line-height: 1.6;
    text-align: right;
}

/* دکمه پایین کارت */
.item-button {
    margin-top: auto;
    display: block;
    background: #13aff0;
    color: #fff;
    text-align: center;
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s;
}
.item-button:hover {
    background: #0e8cbf;
    color: #fff;
}

/* ========================================= */
/* حالت لیستی */
/* ========================================= */
#custom-search-results.view-list .search-items-wrapper {
    grid-template-columns: 1fr;
}
#custom-search-results.view-list .search-item {
    flex-direction: row;
    align-items: center;
    text-align: right;
}
#custom-search-results.view-list .item-thumbnail {
    width: 220px;
    flex-shrink: 0;
    border-left: 1px solid #f0f0f0;
}
#custom-search-results.view-list .item-details {
    padding: 20px 30px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}
#custom-search-results.view-list .item-button {
    margin-top: 0;
    white-space: nowrap;
}
#custom-search-results.view-list .item-price {
    margin: 0 20px;
}

/* مخفی کردن کدهای مزاحم پیشفرض قالب */
#custom-search-results .search-product-extra {
    display: none !important;
}

/* واکنش گرایی (موبایل و تبلت) */
@media (max-width: 992px) {
    #custom-search-results.view-grid-4 .search-items-wrapper,
    #custom-search-results.view-grid-3 .search-items-wrapper { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    #custom-search-results.view-grid-4 .search-items-wrapper,
    #custom-search-results.view-grid-3 .search-items-wrapper { grid-template-columns: 1fr; }
    #custom-search-results.view-list .search-item,
    #custom-search-results.view-list .item-details { flex-direction: column; text-align: center; }
    #custom-search-results.view-list .item-thumbnail { width: 100%; border-left: none; border-bottom: 1px solid #eee; }
    #custom-search-results.view-list .item-price { margin: 15px 0; }
    .search-results-header { flex-direction: column; gap: 15px; align-items: flex-start; }
}

/* ==========================================
   تنظیمات ریسپانسیو صفحه جستجو برای موبایل و تبلت
   ========================================== */

@media (max-width: 768px) {
    /* 1. مخفی کردن دکمه‌های تغییر چیدمان (آیکن‌ها) در موبایل */
    .search-view-controllers {
        display: none !important;
    }

    /* 2. مرتب کردن هدر (تیترها) */
    .search-results-header {
        justify-content: center !important;
        text-align: center;
        margin-bottom: 20px;
    }

    /* 3. اجبار به نمایش گرید 2 ستونه برای نتایج در تبلت و موبایل */
    #custom-search-results .search-items-wrapper {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    /* 4. مقالات در موبایل بهتر است تمام عرض (1 ستونه) باشند */
    #custom-search-results .post-item {
        grid-column: span 2 !important; 
    }

    /* اصلاح سایز عکس محصولات در موبایل */
    .search-item.product-item .item-thumbnail img {
        height: 150px !important; /* ارتفاع عکس محصولات در موبایل */
    }
}

/* برای گوشی‌های صفحه‌کوچک‌تر (زیر 480 پیکسل) همه چیز 1 ستونه شود */
@media (max-width: 480px) {
    #custom-search-results .search-items-wrapper {
        grid-template-columns: 1fr !important; /* محصولات هم 1 ستونه میشوند */
    }
    
    #custom-search-results .post-item {
        grid-column: span 1 !important;
    }
}
