/* ========================================
   Archive Shared - Main Styles
   ======================================== */

/* هماهنگ‌سازی عرض هدر با صفحات آرشیو */
.product-tag-archive .header-main,
.product-tag-archive .header-nav-inner,
.post-type-archive-product .header-main,
.post-type-archive-product .header-nav-inner,
.tax-product_cat .header-main,
.tax-product_cat .header-nav-inner,
.tax-product_brand .header-main,
.tax-product_brand .header-nav-inner,
.tax-product_tag .header-main,
.tax-product_tag .header-nav-inner,
.search .header-main,
.search .header-nav-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Hero Section
   ======================================== */
.archive-hero {
    position: relative;
    padding: 0 0 10px;
    overflow: hidden;
}

.archive-hero .kh-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.archive-hero .kh-bc-inner { padding: 0; }

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-bg-desktop,
.hero-bg-mobile {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-bg-mobile {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* breadcrumb styles در assets/global/reset.css هستند */

.hero-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
    color: #0f4f59;
}

.hero-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    max-width: 700px;
}

/* ========================================
   Layout
   ======================================== */
.archive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    margin-top: 10px;
    clear: both;
    width: 100%;
    position: relative;
}

/* ========================================
   Products Grid
   ======================================== */
.products-grid-wrapper {
    position: relative;
    clear: both;
    width: 100%;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    clear: both;
    width: 100%;
    position: relative;
}

.products-grid::after {
    content: "";
    display: table;
    clear: both;
}

.no-products {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.products-pagination {
    margin-top: 40px;
    text-align: center;
}

.products-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.products-pagination .page-numbers:hover,
.products-pagination .page-numbers.current {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.products-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   Description Section
   ======================================== */
.archive-description {
    margin-top: 60px;
    clear: both;
    position: relative;
}

.description-content {
    max-width: 80%;
    margin: 0 auto 3rem;
    padding: 30px 50px;
    border-radius: 20px;
    border: 1px solid #0f4f59;
    line-height: 1.8;
    color: #444;
    position: relative;
}

/* استایل محتوا */
.description-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    color: #0f4f59;
    padding-bottom: 12px;
}

.description-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 14px;
    color: #0f4f59;
}

.description-content p {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.9;
    text-align: justify;
}

.description-content ul,
.description-content ol {
    margin: 20px 0;
    padding-right: 28px;
}

.description-content li {
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.7;
}

.description-content ul li::marker {
    color: #0f4f59;
}

.description-content a {
    color: #0f4f59;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.description-content a:hover {
    border-bottom-color: #0f4f59;
}

.description-content strong {
    color: #0f4f59;
    font-weight: 600;
}

.description-content img {
    display: block;
    margin: 16px auto;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.description-content figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 16px 0;
}

.description-content figcaption {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    text-align: center;
}

/* هماهنگ‌سازی عرض صفحه با هدر */
.archive-hero .hero-content,
.archive-layout,
.archive-description,
.archive-intro-video {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ویدیوی معرفی — همیشه نمایان، بالای باکس توضیحات */
.archive-intro-video {
    margin-top: 28px;
    margin-bottom: 28px;
}
.archive-intro-video .kh-aparat {
    max-width: 720px;
    margin: 0 auto;
}

/* بخش مرتب‌سازی */
.products-sort-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 10px 20px;
    background: #f5f5f5;
    border-radius: 20px;
}

.products-sort-bar .sort-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #0f4f59;
    white-space: nowrap;
}

.products-sort-bar .sort-label svg {
    flex-shrink: 0;
    color: #0f4f59;
}

.sort-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.sort-option {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sort-option:hover {
    color: #333;
}

.sort-option.active {
    border: 1px solid #0f4f59;
    border-radius: 20px;
    color: #0f4f59;
}

.sort-option.active:hover {
    border: 1px solid #0f4f59;
    border-radius: 20px;
    color: #0f4f59;
}

/* No Products Found */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-products-found p {
    font-size: 18px;
}

/* Loading State */
.products-grid-container.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.products-grid-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


/* ========================================
   Archive Shared Layout
   ======================================== */

.archive-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.archive-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
}

/* ========================================
   Archive Main Content
   ======================================== */

.archive-main-content {
    min-width: 0;
}

/* ========================================
   No Products Found
   ======================================== */

.no-products-message {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 20px;
    margin-top: 30px;
}

.no-products-message p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ========================================
   Pagination
   ======================================== */

.archive-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 20px 0;
}

.archive-pagination a,
.archive-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
}

.archive-pagination a:hover {
    background: #e8f5f3;
    border-color: #0f4f59;
    color: #0f4f59;
}

.archive-pagination .current {
    background: #0f4f59;
    border-color: #0f4f59;
    color: #fff;
    font-weight: 600;
}

.archive-pagination .dots {
    border: none;
    background: transparent;
    color: #999;
}

.product-tag-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 45px;
    margin-top: 10px;
    clear: both;
    width: 100%;
    position: relative;
}

.product-tag-hero .hero-content, .product-tag-layout, .product-tag-description {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}


/* ── Pagination AJAX ── */
.khabco-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 32px 0;
    flex-wrap: wrap;
}
.kh-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #e5e7eb;
    color: #374151;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    padding: 0 6px;
}
.kh-page-btn:hover  { background: #d1d5db; }
.kh-page-btn.active { background: #0f4f59; color: #fff; }
.kh-page-dots       { color: #9ca3af; font-size: .875rem; padding: 0 4px; }




/* description collapse — CSS max-height based */
.description-body {
    overflow: hidden;
    transition: max-height 0.4s ease;
}
.description-body.is-collapsed {
    max-height: 220px;
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.description-body:not(.is-collapsed) {
    max-height: none;
    -webkit-mask-image: none;
    mask-image: none;
}

.desc-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0 0;
    padding: 10px;
    background: transparent;
    border-radius: 8px;
    color: #0f4f59;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 14px;
}


/* ── جداول داخل توضیحات دسته‌بندی ──
   به‌جای اسکرول افقی، متن طولانی داخل سلول می‌شکند (white-space: normal)
   تا جدول همیشه کامل و بدون اسکرول در عرض دسکتاپ دیده شود.
   جدول‌های khabco-specs-table از این قانون مستثنا هستند — ظاهرشان را
   includes/components/specs-table/specs-table.css مدیریت می‌کند تا با
   بوردر/اسکرول دوبل برخورد نکند. */
.archive-description .description-body table:not(.khabco-specs-table) {
    display: table;
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    border: 1px solid #e8e8e8 !important;
    font-size: 14px;
    margin: 24px 0;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* reset کامل بوردرهای پیش‌فرض وردپرس روی سلول‌ها */
.archive-description .description-body table:not(.khabco-specs-table) th,
.archive-description .description-body table:not(.khabco-specs-table) td {
    width: auto !important;
    border: none !important;
}

/* ── هدر ── */
.archive-description .description-body table:not(.khabco-specs-table) thead tr:first-child,
.archive-description .description-body table:not(.khabco-specs-table) thead tr:first-child th {
    background: var(--c-primary);
    color: var(--c-white);
}

.archive-description .description-body table:not(.khabco-specs-table) th {
    padding: 12px 20px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    letter-spacing: .01em;
    vertical-align: middle;
}

/* جداکننده سفید بین ستون‌های هدر */
.archive-description .description-body table:not(.khabco-specs-table) th + th {
    border-right: 1px solid rgba(255,255,255,.25) !important;
}

/* ── بدنه ── */
.archive-description .description-body table:not(.khabco-specs-table) td {
    padding: 11px 20px;
    text-align: right;
    border-bottom: none !important;
    color: var(--c-text);
    font-size: 13px;
    line-height: 1.75;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
}

/* ستون اول — bold و رنگ برند، معمولاً برچسب کوتاه است */
.archive-description .description-body table:not(.khabco-specs-table) td:first-child {
    font-weight: 700;
    color: var(--c-primary);
    white-space: nowrap;
    width: 1%;
}

/* اگر ردیف هدر هم با <td> ساخته شده باشد (نه <th>)، رنگ سفید را برگردان — فقط ردیف اول thead، نه ردیف اول tbody */
.archive-description .description-body table:not(.khabco-specs-table) thead tr:first-child td {
    background: var(--c-primary);
    color: #fff !important;
}

.archive-description .description-body table:not(.khabco-specs-table) tbody tr:nth-child(even) {
    background: var(--c-primary-soft);
}

.archive-description .description-body table:not(.khabco-specs-table) tbody tr:hover {
    background: var(--c-bg-soft);
    transition: background .15s ease;
}

.archive-description .description-body table:not(.khabco-specs-table) tbody tr:last-child td {
    border-bottom: none !important;
}

/* table overflow on small screens → handled in category-mobile.css */

.desc-toggle-btn::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 10px;
    left: 10px;
    height: 1px;
    background: #0f4f59;
}

/* ══════════════════════════════════════════
   Archive FAQ Section — خارج از باکس توضیحات
══════════════════════════════════════════ */
.archive-faq-section {
    padding: 8px 0 56px;
    background: #fff;
}

.archive-faq-inner {
    max-width: 860px;
    margin: 0 auto;
}

/* ── هدر ── */
.archive-faq-header {
    text-align: right;
    margin-bottom: 20px;
}

.archive-faq-title {
    font-size: clamp(18px, 2.4vw, 24px);
    font-weight: 700;
    color: var(--c-primary);
    margin: 0;
    line-height: 1.5;
}

/* ── لیست ── */
.archive-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* FAQ responsive → handled in category-mobile.css */

/* ── ردیف لوگو + H1 برند ── */
.brand-hero-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.brand-hero-banner {
    background: #f3f4f6;
    border-radius: 14px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-hero-banner__img {
    max-height: 60px;
    max-width: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.brand-hero-row .hero-title {
    margin-bottom: 0;
}

