/*
 * Ahan Price Tables — Public Stylesheet
 * استایل نمایش جداول در سایت
 */

/* ── متغیرها ─────────────────────────────────────────────────────────── */
.apt-table-wrap {
    --apt-font:        inherit;
    --apt-radius:      6px;
    --apt-border:      #e2e5e9;
    --apt-head-bg:     #5E0520;
    --apt-head-color:  #ffffff;
    --apt-row-odd:     #ffffff;
    --apt-row-even:    #f9fafb;
    --apt-row-hover:   #eef2f7;
    --apt-text:        #3d4a5a;
    --apt-text-light:  #7f8c9a;
    --apt-accent:      #1a6eb5;
    --apt-shadow:      0 2px 12px rgba(0, 0, 0, 0.07);
    --apt-cell-pad:    10px 14px;
    --apt-font-size:   14px;
    --apt-line-height: 1.6;
}

/* ── کانتینر ─────────────────────────────────────────────────────────── */
.apt-table-wrap {
    direction: rtl;
    font-family: var(--apt-font);
    font-size: var(--apt-font-size);
    line-height: var(--apt-line-height);
    color: var(--apt-text);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--apt-radius);
    box-shadow: var(--apt-shadow);
    border: 1px solid var(--apt-border);
/*     margin: 20px 0; */
}

/* ── جدول ────────────────────────────────────────────────────────────── */
.apt-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--apt-row-odd);
}

/* ── هدر ─────────────────────────────────────────────────────────────── */
.apt-table-wrap thead tr {
    background: var(--apt-head-bg);
}

.apt-table-wrap thead th {
    padding: var(--apt-cell-pad);
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    color: var(--apt-head-color);
/*     white-space: nowrap; */
    letter-spacing: 0.01em;
    border-bottom: 2px solid var(--apt-border);
    position: relative;
}

/* خط جداکننده عمودی بین هدرها */
.apt-table-wrap thead th + th::before {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--apt-border);
}

/* ── ردیف‌ها ─────────────────────────────────────────────────────────── */
.apt-table-wrap tbody tr:nth-child(odd) {
    background: var(--apt-row-odd);
}

.apt-table-wrap tbody tr:nth-child(even) {
    background: var(--apt-row-even);
}

.apt-table-wrap tbody tr {
    transition: background 0.15s ease;
}

.apt-table-wrap tbody tr:hover {
    background: var(--apt-row-hover);
}

.apt-table-wrap tbody tr:last-child td {
    border-bottom: none;
}

/* ── سلول‌ها ─────────────────────────────────────────────────────────── */
.apt-table-wrap td,
.apt-table-wrap th {
    padding: var(--apt-cell-pad);
    text-align: right;
    border-bottom: 1px solid var(--apt-border);
    vertical-align: middle;
	white-space: nowrap;
}

.apt-table-wrap td {
    color: var(--apt-text);
}

/* ستون اول — معمولاً نام کالا — کمی پررنگ‌تر */
.apt-table-wrap td:first-child {
    font-weight: 500;
/*     color: var(--apt-head-color); */
}

/* ستون‌های عددی — راست‌چین تقویت‌شده با فونت مونو */
.apt-table-wrap td:not(:first-child) {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* ── مخفی کردن دو ستون آخر ──────────────────────────────────────────── */
/*
 * هر دو ستون — هم هدر هم بدنه — مخفی می‌شوند.
 * اگر جدول شما <tfoot> دارد، قانون سوم آن را هم می‌پوشاند.
 */
/* .apt-table-wrap th:nth-last-child(1),
.apt-table-wrap th:nth-last-child(2),
.apt-table-wrap td:nth-last-child(1),
.apt-table-wrap td:nth-last-child(2) {
    display: none;
} */
.apt-table-wrap table tr th.apt-col-hidden,
.apt-table-wrap table tr td.apt-col-hidden {
    display: none;
}

/* ── caption ─────────────────────────────────────────────────────────── */
.apt-table-wrap caption {
    caption-side: top;
    text-align: right;
    padding: 12px 14px 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--apt-head-color);
    border-bottom: 1px solid var(--apt-border);
    background: var(--apt-head-bg);
}

/* ── اسکرول افقی روی صفحه‌های کوچک ─────────────────────────────────── */
/* @media (max-width: 640px) {
    .apt-table-wrap {
        --apt-cell-pad:  7px 10px;
        --apt-font-size: 13px;
    }
} */

/* ── حالت چاپ ────────────────────────────────────────────────────────── */
@media print {
    .apt-table-wrap {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .apt-table-wrap tbody tr:hover {
        background: inherit;
    }
}
/* ── موبایل: فشرده‌سازی جدول ────────────────────────────────────────── */
@media (max-width: 767px) {
    .apt-table-wrap {
        --apt-cell-pad:  5px 6px;
        --apt-font-size: 12px;
        border-radius: 4px;
        overflow-x: hidden;
    }

    .apt-table-wrap table {
        table-layout: fixed;
        width: 100%;
    }

    .apt-table-wrap th,
    .apt-table-wrap td {
        word-break: break-word;
        white-space: normal;
        padding: var(--apt-cell-pad);
        font-size: var(--apt-font-size);
    }

    .apt-table-wrap thead th {
        font-size: 11px;
        letter-spacing: 0;
    }
}
/* ── لودر ────────────────────────────────────────── */
/* لودر پیش‌فرض — همیشه فعاله */
.apt-table-wrap {
    position: relative;
    min-height: 60px;
}

.apt-table-wrap table {
    visibility: hidden;
}

.apt-table-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
}

.apt-table-wrap::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: apt-spin 0.7s linear infinite;
    z-index: 1;
}

/* وقتی JS تموم کرد این کلاس اضافه میشه */
.apt-table-wrap.apt-ready table {
    visibility: visible;
}

.apt-table-wrap.apt-ready::after,
.apt-table-wrap.apt-ready::before {
    display: none;
}

@keyframes apt-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}