/* Explain: Styles for the size panel, input fields, and interactive elements. */
/* ===== لوحة المقاسات — التصنيع حسب الطلب ===== */

/* خط Cairo مقتصر على نصوص الأداة وحقولها فقط — الأيقونات تحتفظ بخط Font Awesome */
.sp-scope {
    font-family: 'Cairo', sans-serif;
    max-width: 1100px;
    margin-inline: auto;
    overflow-x: hidden;
}

.sp-scope input,
.sp-scope button,
.sp-scope select,
.sp-scope textarea {
    font-family: 'Cairo', sans-serif;
}

/* ضمان ظهور أيقونات Font Awesome داخل الأداة */
.sp-scope i.fa-solid,
.sp-scope i.fa-regular {
    font-family: "Font Awesome 6 Free" !important;
}

.sp-scope i.fa-brands {
    font-family: "Font Awesome 6 Brands" !important;
}

/* أشرطة تحريك المقاسات */
.sp-scope input[type="range"] {
    width: 100%;
    height: 30px;
    accent-color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    outline: none;
}

.sp-scope input[type="range"]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 8px;
}

/* الحقل الرقمي للمقاس */
.sp-scope .sp-num {
    width: 5.5rem;
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    padding: 0.4rem 0.5rem;
}

.sp-scope .sp-num:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.sp-scope .sp-num.sp-invalid {
    border-color: #dc2626;
    color: #dc2626;
}

.sp-err {
    color: #dc2626;
}

/* حقول النص (المدينة والملاحظات) */
.sp-scope .sp-text {
    width: 100%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.sp-scope .sp-text:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* أزرار العدد */
.sp-scope .sp-step-btn {
    width: 2.4rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    background: var(--surface-color);
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
}

.sp-scope .sp-step-btn:hover {
    border-color: var(--primary-color);
}

/* مفتاح تشغيل/إيقاف */
.sp-scope .sp-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 3rem;
    height: 1.6rem;
    background: var(--border-color);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex: none;
    margin: 0;
}

.sp-scope .sp-toggle:checked {
    background: var(--primary-color);
}

.sp-scope .sp-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    inline-size: 1.35rem;
    block-size: 1.35rem;
    background: #fff;
    border-radius: 50%;
    transition: inset-inline-start 0.2s;
}

.sp-scope .sp-toggle:checked::after {
    inset-inline-start: calc(3rem - 1.35rem - 2px);
}

/* صفوف ملخص الطلب */
.sp-sum-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.4rem;
}

.sp-sum-row dt {
    color: var(--text-muted);
}

.sp-sum-row dd {
    font-weight: 700;
    color: var(--text-color);
    text-align: end;
}

/* مساحة الرسم */
.sp-canvas {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    min-height: 240px;
}

.sp-canvas svg {
    display: block;
    width: 100%;
    height: auto;
}

/* الشريط السفلي الثابت على الجوال */
.sp-stickybar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-color);
}

/* إخفاء الأزرار العائمة على الجوال في صفحة الأداة لمنع التداخل */
@media (max-width: 1023px) {
    body.sp-page > a.fixed,
    body.sp-page > div.fixed {
        display: none !important;
    }
}

@media (max-width: 400px) {
    .sp-scope .sp-prod {
        flex: 1 1 calc(50% - 0.75rem);
        justify-content: center;
    }
}