/**
 * Advanced Assembly Builder - استایل قیدها (نوع شاسی و ظرفیت پردازنده)
 * این فایل جدا نگه داشته شده تا CSS اصلی دست‌نخورده بماند.
 */

/* ====================================================================
 * انتخابگر سراسری نوع شاسی
 * ================================================================== */
.aab-chassis-selector {
    direction: rtl;
    background: linear-gradient(135deg, #fdf3f6 0%, #fbeef2 100%);
    border: 1px solid #eed3dc;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 22px;
}

.aab-chassis-selector.aab-chassis-pending {
    border-color: #97183c;
    box-shadow: 0 0 0 3px rgba(151,24,60,.12);
}

.aab-chassis-selector-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.aab-chassis-selector-label {
    font-size: 15px;
    font-weight: 700;
    color: #71112d;
}

.aab-chassis-selector-label .aab-required {
    color: #d63638;
    margin-right: 2px;
}

.aab-chassis-selected-badge {
    display: inline-block;
    background: #46b450;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.aab-chassis-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.aab-chassis-option {
    flex: 0 1 auto;
    min-width: 120px;
    padding: 12px 22px;
    background: #fff;
    border: 2px solid #ecd6de;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    cursor: pointer;
    transition: all .15s ease;
}

.aab-chassis-option:hover {
    border-color: #97183c;
    color: #97183c;
    transform: translateY(-1px);
}

.aab-chassis-option.active {
    background: #97183c;
    border-color: #97183c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(151,24,60,.25);
}

.aab-chassis-hint {
    margin: 12px 0 0;
    font-size: 12.5px;
    color: #50575e;
}

/* وقتی شاسی انتخاب شد، راهنما کم‌رنگ شود */
.aab-chassis-selector:not(.aab-chassis-pending) .aab-chassis-hint {
    opacity: .5;
}

/* ====================================================================
 * حالت قفلِ نقش‌ها (تا انتخاب نوع شاسی)
 * ================================================================== */
.aab-builder-main.aab-roles-locked .aab-tabs-content,
.aab-builder-main.aab-roles-locked .aab-tab-content {
    position: relative;
    opacity: .55;
    pointer-events: none;
    filter: grayscale(35%);
    user-select: none;
}

.aab-builder-main.aab-roles-locked .aab-chassis-selector {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* قفل نقش پردازنده تا انتخاب مادربرد */
.aab-role-accordion.aab-cpu-locked,
.aab-role-row.aab-cpu-locked {
    position: relative;
}

.aab-role-accordion.aab-cpu-locked::after,
.aab-role-row.aab-cpu-locked::after {
    content: "🔒 ابتدا مادربرد را انتخاب کنید";
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #b26a00;
    background: #fff7e6;
    border: 1px dashed #e2b04a;
    border-radius: 6px;
    padding: 6px 10px;
}

.aab-select-btn.aab-disabled,
.aab-select-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ====================================================================
 * استپرِ تعداد پردازنده (هم‌نوع)
 * ================================================================== */
.aab-cpu-stepper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    background: #faf6f7;
    border: 1px solid #efe1e6;
    border-radius: 10px;
}

.aab-cpu-stepper-label {
    font-size: 13px;
    font-weight: 700;
    color: #1d2327;
}

.aab-cpu-count-options {
    display: flex;
    gap: 8px;
}

.aab-cpu-count-option {
    min-width: 44px;
    padding: 8px 14px;
    background: #fff;
    border: 2px solid #ecd6de;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: #1d2327;
    cursor: pointer;
    transition: all .15s ease;
}

.aab-cpu-count-option:hover {
    border-color: #97183c;
    color: #97183c;
}

.aab-cpu-count-option.active {
    background: #97183c;
    border-color: #97183c;
    color: #fff;
}

.aab-cpu-stepper-hint {
    font-size: 12px;
    color: #787c82;
    margin-right: auto;
}

/* ====================================================================
 * اعلانِ شناور قیدها (Toast)
 * ================================================================== */
.aab-constraint-notice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1d2327;
    color: #fff;
    font-size: 13.5px;
    line-height: 1.7;
    padding: 13px 22px;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
    max-width: 90vw;
    text-align: center;
    direction: rtl;
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

.aab-constraint-notice.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ====================================================================
 * پایداری و لایه‌ی مودال محصول (جلوگیری از پرش و پنهان‌شدنِ هدر زیر منوی سایت)
 * ================================================================== */
.aab-product-modal {
    /* بالاتر از منوهای چسبانِ اکثر قالب‌ها */
    z-index: 2147483600 !important;
}

.aab-product-modal .aab-modal-content {
    /* ارتفاع ثابت تا با تغییر تعداد محصولات، مودال جابجا/پرشی نشود */
    height: 85vh !important;
    max-height: 85vh !important;
}

/* هدر مودال همیشه بالای محتوای اسکرول‌شونده بماند */
.aab-product-modal .aab-modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
}

@media (max-width: 768px) {
    .aab-product-modal .aab-modal-content {
        height: 92vh !important;
        max-height: 92vh !important;
    }
}