/* =====================================================
   فروشگاه آنلاین رایان تکس
   ===================================================== */

.rtvs-form,
.rtvs-form * {
    box-sizing: border-box;
}

.rtvs-wrapper {
    direction: rtl;
    margin: 30px 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    overflow: visible;
    padding-bottom: 90px;
    font-family: inherit;
}

/* ---------- Filters ---------- */

.rtvs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background: #f7fafc;
    border-bottom: 1px solid #ececec;
}

.rtvs-filter-group {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rtvs-filter-group label {
    font-size: 13px;
    font-weight: 700;
    color: #00385e;
}

.rtvs-filter {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: #222;
    background: #fff;
    border: 1px solid #d5dde5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s;
}

.rtvs-filter:focus {
    outline: none;
    border-color: #00385e;
}

.rtvs-filter option:disabled {
    color: #bbb;
}

/* ---------- Table ---------- */

.rtvs-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
}

.rtvs-table thead {
    background: #00385e;
}

.rtvs-table thead th {
    color: #fff;
    padding: 14px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
}

.rtvs-table td {
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid #ececec;
    vertical-align: middle;
    font-size: 14px;
    color: #222;
}

.rtvs-table tbody tr {
    cursor: pointer;
    transition: background .2s;
}

.rtvs-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.rtvs-table tbody tr:hover {
    background: #f3f8fc;
}

.rtvs-row.rtvs-selected {
    background: #e6f3ff !important;
}

.rtvs-col-weight {
    font-weight: 700;
    direction: ltr;
}

.rtvs-col-price {
    color: #00385e;
    font-weight: 700;
}

/* ---------- Checkbox ---------- */

.rtvs-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.rtvs-check input {
    display: none;
}

.rtvs-check-box {
    width: 22px;
    height: 22px;
    display: inline-block;
    border: 2px solid #c3ccd5;
    border-radius: 6px;
    position: relative;
    transition: all .2s;
}

.rtvs-check input:checked + .rtvs-check-box {
    background: #00385e;
    border-color: #00385e;
}

.rtvs-check input:checked + .rtvs-check-box::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 6px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---------- Empty state ---------- */

.rtvs-empty {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 14px;
}

/* ---------- Sticky cart bar ---------- */

.rtvs-sticky-cart {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #ececec;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
}

.rtvs-cart-info {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #444;
}

.rtvs-cart-info strong {
    color: #00385e;
}

.rtvs-button {
    background: #00385e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.rtvs-button:hover:not(:disabled) {
    background: #005b96;
}

.rtvs-button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {

    .rtvs-filter-group {
        flex: 1 1 100%;
    }

    .rtvs-table thead th,
    .rtvs-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .rtvs-sticky-cart {
        justify-content: center;
        text-align: center;
    }

    .rtvs-button {
        width: 100%;
    }
}

/* ---------- Color cell ---------- */

.rtvs-color-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    direction: rtl;
}

.rtvs-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, .15);
    box-shadow: inset 0 0 0 2px #fff;
}

.rtvs-color-name {
    font-size: 13px;
    color: #222;
}

.rtvs-col-thread,
.rtvs-col-width {
    font-size: 13px;
    color: #333;
}

/* ---------- Custom dropdown ---------- */

.rtvs-dd {
    position: relative;
    width: 100%;
}

.rtvs-dd-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #222;
    background: #fff;
    border: 1px solid #d5dde5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s;
}

.rtvs-dd-toggle:hover {
    border-color: #00385e;
}

.rtvs-dd-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rtvs-dd-caret {
    color: #7a8794;
    font-size: 12px;
    flex: 0 0 auto;
}

.rtvs-dd-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 40;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e6ec;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
    display: none;
}

.rtvs-dd-menu.open {
    display: block;
}

.rtvs-dd-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    font-size: 14px;
    color: #222;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}

.rtvs-dd-opt:hover {
    background: #f3f8fc;
}

.rtvs-dd-opt.is-disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- Actions ---------- */

.rtvs-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rtvs-clear {
    background: #fff;
    color: #00385e;
    border: 1px solid #cdd7e0;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.rtvs-clear:hover:not(:disabled) {
    background: #f3f8fc;
}

.rtvs-clear:disabled {
    opacity: .5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .rtvs-actions {
        width: 100%;
    }
    .rtvs-actions .rtvs-button,
    .rtvs-actions .rtvs-clear {
        flex: 1 1 auto;
    }
}

/* ---------- Mobile: card layout (overrides earlier mobile rules) ---------- */

@media (max-width: 600px) {

    .rtvs-wrapper {
        padding-bottom: 96px;
    }

    .rtvs-table thead {
        display: none;
    }

    .rtvs-table,
    .rtvs-table tbody,
    .rtvs-table tr,
    .rtvs-table td {
        display: block;
        width: 100%;
    }

    .rtvs-table tbody tr.rtvs-row {
        width: auto;
        background: #fff;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        margin: 12px 10px;
        padding: 4px 12px;
    }

    .rtvs-table tbody tr:nth-child(even) {
        background: #fff;
    }

    .rtvs-row.rtvs-selected {
        border-color: #00385e;
        background: #eef6ff !important;
    }

    .rtvs-table td {
        direction: rtl;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        text-align: left;
        padding: 10px 0;
        border-bottom: 1px dashed #eee;
        font-size: 14px;
    }

    .rtvs-table td:last-child {
        border-bottom: none;
    }

    .rtvs-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 13px;
        font-weight: 700;
        color: #00385e;
    }

    .rtvs-col-price {
        font-size: 15px;
    }

    /* checkbox cell */
    .rtvs-col-check .rtvs-check {
        margin-inline-start: auto;
    }
}

/* ---------- Sticky header + length/price-per-meter columns ---------- */

.rtvs-table thead th {
    position: sticky;
    top: var(--rtvs-sticky-top, 0px);
    z-index: 5;
    background: #00385e;
}

.rtvs-table thead th:first-child {
    border-top-right-radius: 12px;
}

.rtvs-table thead th:last-child {
    border-top-left-radius: 12px;
}

.rtvs-col-length,
.rtvs-col-ppm {
    font-size: 13px;
    color: #333;
    direction: ltr;
}

.rtvs-col-ppm {
    font-weight: 600;
    color: #00385e;
}

@media (max-width: 600px) {
    /* در چیدمان کارتی، ستون‌های عددی راست‌چین شوند تا برچسب سمت راست بماند */
    .rtvs-col-length,
    .rtvs-col-ppm {
        direction: rtl;
    }
}


/* ---------- Price-per-kg column ---------- */

.rtvs-col-ppk {
    font-size: 13px;
    font-weight: 600;
    color: #00385e;
    direction: ltr;
}

@media (max-width: 600px) {
    .rtvs-col-ppk {
        direction: rtl;
    }
}


/* حالت وزنی/گرمی */
.rtvs-table-weight .rtvs-col-ppg,
.rtvs-table-weight .rtvs-col-qty,
.rtvs-table-weight .rtvs-col-linetotal {
    text-align: center;
    white-space: nowrap;
}
.rtvs-table-weight .rtvs-qty {
    width: 120px;
    max-width: 100%;
    padding: 8px 10px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    direction: ltr;
    font-size: 15px;
}
.rtvs-table-weight .rtvs-qty:focus {
    outline: none;
    border-color: #f7c600;
    box-shadow: 0 0 0 2px rgba(247, 198, 0, 0.25);
}
.rtvs-table-weight .rtvs-row-total {
    font-weight: 700;
}

.rtvs-table-weight .rtvs-qty-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #777;
    direction: rtl;
}

/* ---- راستچین: عنوان فیلترها و مقادیر ستون‌های متنی ---- */
.rtvs-filter-group label { text-align: right; }
.rtvs-dd-toggle { text-align: right; }

@media (min-width: 601px) {
    .rtvs-table td.rtvs-col-thread,
    .rtvs-table td.rtvs-col-width,
    .rtvs-table td.rtvs-col-color,
    .rtvs-table thead th.rtvs-col-thread,
    .rtvs-table thead th.rtvs-col-width,
    .rtvs-table thead th.rtvs-col-color {
        text-align: right;
    }
    .rtvs-table td.rtvs-col-color .rtvs-color-cell {
        justify-content: flex-start;
    }
}

/* ---- جستجوی داخل دراپ‌داون ---- */
.rtvs-dd-search {
    position: sticky;
    top: 0;
    padding: 2px 2px 8px;
    background: #fff;
}
.rtvs-dd-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5dde5;
    border-radius: 6px;
    direction: rtl;
    text-align: right;
}
.rtvs-dd-search-input:focus {
    outline: none;
    border-color: #00385e;
}

/* ---- سرستون‌های قابل مرتب‌سازی ---- */
.rtvs-table thead th {
    cursor: pointer;
    user-select: none;
}
.rtvs-table thead th::after {
    content: '⇅';
    margin-inline-start: 6px;
    font-size: 11px;
    opacity: .45;
}
.rtvs-table thead th.rtvs-sort-asc::after { content: '▲'; opacity: 1; }
.rtvs-table thead th.rtvs-sort-desc::after { content: '▼'; opacity: 1; }

/* ---- موبایل: راهنمای مقدار زیر کادر برود ---- */
@media (max-width: 600px) {
    .rtvs-table-weight td.rtvs-col-qty {
        flex-wrap: wrap;
    }
    .rtvs-table-weight td.rtvs-col-qty .rtvs-qty-help {
        flex-basis: 100%;
        text-align: right;
        margin-top: 4px;
    }
}

/* ---- پنل محصولِ مکمل (هم‌رنگ زیرِ هر طاقه) ---- */
.rtvs-companion-row > td { background:#f4f9ff; padding:0; border-bottom:1px solid #dbe7f3; }
.rtvs-companion { padding:14px 18px; direction:rtl; text-align:right; }
.rtvs-companion-head { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-bottom:10px; }
.rtvs-companion-title { font-weight:700; color:#00385e; }
.rtvs-companion-pct { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:#333; }
.rtvs-companion-pct .rtvs-pct { width:72px; padding:6px 8px; border:1px solid #ccc; border-radius:6px; text-align:center; direction:ltr; }
.rtvs-companion-weight { font-size:12px; color:#777; }
.rtvs-companion-items { display:flex; flex-direction:column; gap:8px; }
.rtvs-companion-item { display:flex; flex-wrap:wrap; align-items:center; gap:10px; background:#fff; border:1px solid #e5eef7; border-radius:8px; padding:8px 12px; }
.rtvs-ci-name { flex:1 1 170px; font-size:13px; color:#222; font-weight:700; }
.rtvs-ci-ppg { font-size:12px; color:#777; white-space:nowrap; }
.rtvs-ci-qwrap { display:inline-flex; align-items:center; gap:4px; }
.rtvs-ci-qty { width:100px; padding:6px 8px; border:1px solid #ccc; border-radius:6px; text-align:center; direction:ltr; }
.rtvs-ci-unit { font-size:12px; color:#555; }
.rtvs-ci-total { font-weight:700; color:#00385e; white-space:nowrap; min-width:120px; text-align:left; }
.rtvs-companion-empty { color:#999; font-size:13px; }
.rtvs-pct:focus, .rtvs-ci-qty:focus { outline:none; border-color:#00385e; }
@media (max-width:600px){
    .rtvs-companion-row > td { display:block; }
    .rtvs-companion-row > td::before { content:none !important; }
    .rtvs-ci-total { min-width:auto; text-align:right; }
}

/* ---- کلید نمایش فقط انتخاب‌شده‌ها ---- */
.rtvs-only-selected { display:inline-flex; align-items:center; gap:6px; margin-top:6px; font-size:13px; color:#00385e; cursor:pointer; }
.rtvs-only-selected input { cursor:pointer; width:16px; height:16px; }

/* ---- دسترس‌پذیری: نمایانگرِ فوکوس کیبورد (a11y) ---- */
.rtvs-dd-toggle:focus-visible,
.rtvs-dd-opt:focus,
.rtvs-dd-opt:focus-visible,
.rtvs-dd-search-input:focus-visible,
.rtvs-check input[type="checkbox"]:focus-visible + .rtvs-check-box {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: 4px;
}
.rtvs-dd-opt:focus {
    background: rgba(34, 113, 177, 0.08);
}

/* ---- هشدارِ بیش از موجودی (حالت وزنی و محصول مکمل) ---- */
.rtvs-qty-warn,
.rtvs-ci-warn {
    display: block;
    margin-top: 4px;
    color: #b32d2e;
    font-size: 12px;
    line-height: 1.5;
}
.rtvs-qty-warn:empty,
.rtvs-ci-warn:empty {
    display: none;
}
.rtvs-qty.rtvs-over,
.rtvs-ci-qty.rtvs-over {
    border-color: #b32d2e !important;
    box-shadow: 0 0 0 1px #b32d2e;
}
.rtvs-button.rtvs-blocked {
    opacity: .6;
    cursor: not-allowed;
}
