:root {
    --pss-primary: #1e293b;
    --pss-primary-hover: #0f172a;
    --pss-accent: #2563eb;
    --pss-accent-glow: rgba(37, 99, 235, 0.25);
    --pss-bg-pill: #f8fafc;
    --pss-border: #e2e8f0;
    --pss-text-main: #1e293b;
    --pss-text-muted: #94a3b8;
    --pss-disabled: #f1f5f9;
    --pss-radius: 12px;
    --pss-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ظرف اصلی */
.pss-size-selector-wrapper {
    margin: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* هدر سایز و نمایش سایز فعال */
.pss-selected-size-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--pss-text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.pss-selected-size-label span.pss-active-val {
    color: var(--pss-accent);
    font-weight: 700;
}

/* شبکه تایل‌های سایز */
.pss-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* دکمه‌های تکی سایز (Pills) */
.pss-size-pill {
    position: relative;
    min-width: 52px;
    height: 48px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--pss-bg-pill);
    border: 1.5px solid var(--pss-border);
    border-radius: var(--pss-radius);
    color: var(--pss-text-main);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--pss-transition);
    outline: none;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* افکت هاور برای سایزهای موجود */
.pss-size-pill.in-stock:hover {
    border-color: var(--pss-accent);
    background: #ffffff;
    color: var(--pss-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--pss-accent-glow);
}

/* حالت انتخاب‌شده (Active) */
.pss-size-pill.selected {
    background: var(--pss-primary) !important;
    border-color: var(--pss-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
    transform: scale(1.05);
}

/* سایزهای ناموجود */
.pss-size-pill.out-of-stock {
    background: var(--pss-disabled);
    border-color: #e2e8f0;
    color: var(--pss-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
    overflow: hidden;
}

/* خط مورب زیبا برای سایز ناموجود */
.pss-size-pill.out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -20%;
    width: 140%;
    height: 1.5px;
    background: #cbd5e1;
    transform: rotate(-35deg);
}

/* دکمه باز کردن راهنمای سایز */
.pss-guide-trigger-wrap {
    margin-bottom: 12px;
}
.pss-open-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
    color: var(--pss-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pss-transition);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.pss-open-modal-btn:hover {
    color: var(--pss-primary-hover);
    text-decoration-color: var(--pss-primary-hover);
}
.pss-open-modal-btn svg {
    stroke: currentColor;
    transition: transform 0.2s ease;
}
.pss-open-modal-btn:hover svg {
    transform: rotate(15deg);
}

/* ----------------- مدال پاپ‌آپ راهنما و محاسبه‌گر ----------------- */
.pss-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.pss-modal.is-active {
    display: flex;
}
.pss-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(5px);
    animation: pssFadeIn 0.25s ease;
}
.pss-modal-dialog {
    position: relative;
    background: #ffffff;
    width: 92%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    padding: 28px;
    z-index: 10;
    animation: pssSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
}

.pss-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.pss-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--pss-text-main);
}
.pss-close-modal {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: var(--pss-transition);
}
.pss-close-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* بخش اینپوت محاسبه‌گر */
.pss-calculator-section {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 20px;
}
.pss-calculator-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--pss-text-main);
}
.pss-input-group {
    display: flex;
    gap: 8px;
}
.pss-input-group input {
    flex: 1;
    height: 44px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
    transition: var(--pss-transition);
}
.pss-input-group input:focus {
    border-color: var(--pss-accent);
    box-shadow: 0 0 0 3px var(--pss-accent-glow);
}
.pss-btn-primary {
    background: var(--pss-accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pss-transition);
}
.pss-btn-primary:hover {
    background: #1d4ed8;
}

.pss-result {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* جدول سایزها */
.pss-table-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--pss-text-main);
}
.pss-size-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: center;
}
.pss-size-table th {
    background: #f1f5f9;
    padding: 8px;
    font-weight: 600;
    color: #475569;
}
.pss-size-table td {
    padding: 7px;
    border-bottom: 1px solid #f1f5f9;
}

@keyframes pssFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pssSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
