/* چیدمان ریسپانسیو فرم (ثبت + طراح) — مثل جدول HTML که در موبایل ستون‌ها زیر هم می‌روند */

@media (max-width: 600px) {
    .fb-runtime-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .fb-runtime-grid > * {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        min-height: 48px !important;
    }

    .fb-runtime-grid .mud-input-control,
    .fb-runtime-grid .mud-picker-input,
    .fb-runtime-grid .fb-designer-datetime-slot .mud-picker {
        min-height: 48px;
    }

    .fb-runtime-grid .mud-input-slot:not(.mud-input-slot-textarea) {
        min-height: 44px;
    }
}

/* پیش‌نمایش دستگاه در طراح فرم */
.fb-designer-device-shell {
    width: 100%;
    box-sizing: border-box;
    transition: max-width 0.25s ease;
}

.fb-designer-device-shell-inner {
    width: 100%;
    box-sizing: border-box;
    margin-inline: auto;
}

.fb-designer-device-shell--tablet .fb-designer-device-shell-inner {
    max-width: 768px;
    border: 2px solid rgba(25, 118, 210, 0.35);
    border-radius: 16px;
    padding: 12px 10px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

.fb-designer-device-shell--mobile .fb-designer-device-shell-inner {
    max-width: 390px;
    border: 3px solid #1e293b;
    border-radius: 28px;
    padding: 14px 10px 18px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
    position: relative;
}

.fb-designer-device-shell--mobile .fb-designer-device-shell-inner::before {
    content: "";
    display: block;
    width: 72px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.2);
}

.fb-designer-device-preview-mobile .fb-form-designer-drop--grid .mud-drop-item,
.fb-designer-device-preview-mobile .fb-designer-item-wrap:not(.fb-free-designer-item) {
    grid-column: 1 / -1 !important;
}

.fb-designer-device-preview-mobile .fb-designer-item-wrap.fb-free-designer-item {
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.fb-designer-device-preview-mobile .fb-designer-preview--runtime .mud-input-control,
.fb-designer-device-preview-mobile .fb-designer-preview--wysiwyg .mud-input-control,
.fb-designer-device-preview-mobile .fb-designer-preview--runtime .mud-picker-input {
    min-height: 48px;
}

.fb-designer-device-preview-tablet .fb-form-designer-drop--grid .mud-drop-item {
    min-width: 0;
}

/* شبکه شطرنجی هنگام درگ از پالت (الگوی Mud Dropzone) */
.fb-grid-row-shell--palette .fb-cell-overlay-slot--chess-a {
    background: rgba(25, 118, 210, 0.09) !important;
    border-color: rgba(25, 118, 210, 0.18) !important;
}

.fb-grid-row-shell--palette .fb-cell-overlay-slot--chess-b {
    background: rgba(76, 175, 80, 0.1) !important;
    border-color: rgba(46, 125, 50, 0.22) !important;
}

.fb-grid-row-shell--palette .fb-cell-overlay-slot--drop-target {
    background: rgba(25, 118, 210, 0.32) !important;
    border-color: var(--mud-palette-primary, #1976d2) !important;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 0 0 2px rgba(25, 118, 210, 0.35);
}

.fb-free-palette-drop-overlay--chess {
    background-color: rgba(46, 125, 50, 0.05);
    background-image:
        linear-gradient(45deg, rgba(25, 118, 210, 0.11) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(25, 118, 210, 0.11) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(76, 175, 80, 0.1) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(76, 175, 80, 0.1) 75%);
    background-size: 28px 28px;
    background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}
