/* Admin / seller form modals (.fm-modal) — the admin counterpart of the customer area's
   .u-modal: white rounded card, icon tile + title + subtitle header, label-above-field
   bodies, and a Cancel / Save footer. Builds on the panel's base .modal-* styles
   (layout/head_script.php); use the header WITHOUT bg-* classes. */

.fm-modal .modal-dialog { max-width: 560px; }
.fm-modal .modal-dialog.modal-lg { max-width: 760px; }
.fm-modal .modal-content { border: 0; border-radius: 16px; overflow: hidden; }

.fm-modal .modal-header {
	display: flex;
	align-items: flex-start !important;
	justify-content: flex-start !important;
	gap: .85rem;
	padding: 1.25rem 1.5rem !important;
	background: #fff !important;
	border-bottom: 1px solid #f1f5f9 !important;
}
.fm-modal .modal-header .close { margin: 0 0 0 auto !important; }
.fm-icon {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(var(--dr-accent-rgb), .12);
	color: var(--dr-accent, #8C52FF);
	font-size: 1.1rem;
}
.fm-icon--warning { background: #fef3c7; color: #b45309; }
.fm-heading { min-width: 0; }
.fm-heading .modal-title { font-size: 1rem !important; font-weight: 700 !important; color: #0f172a !important; line-height: 1.3 !important; }
.fm-sub { margin: .15rem 0 0; font-size: .78rem; color: #64748b; line-height: 1.4; }

.fm-modal .modal-body { padding: 1.35rem 1.5rem .5rem; }
.fm-modal .modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: .5rem;
	padding: 1rem 1.5rem 1.25rem;
	border-top: 1px solid #f1f5f9;
	background: #fcfcfd;
}
.fm-modal .modal-footer .btn { min-width: 110px; justify-content: center; }

/* Fields: label above input, optional two-up grid. */
.fm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.fm-field { margin-bottom: 1.1rem; }
.fm-field > label:not(.fm-upload):not(.fm-switch) { display: flex; align-items: baseline; gap: .35rem; margin-bottom: .4rem; font-size: .8rem; font-weight: 600; color: #334155; }
.fm-field > label:not(.fm-upload):not(.fm-switch) .text-danger { font-weight: 700; }
.fm-field > label:not(.fm-upload):not(.fm-switch) .fm-count { margin-left: auto; font-size: .72rem; font-weight: 500; color: #94a3b8; }
.fm-field .dr-field-hint, .fm-field .dr-field-hint-warning { margin-top: .35rem; margin-bottom: 0; }
.fm-section {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin: .35rem 0 1rem;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #94a3b8;
}
.fm-section::after { content: ""; flex: 1; height: 1px; background: #eef0f5; }

/* Image upload: preview tile + button-like picker. The real <input type=file> is inside
   the label, visually hidden, so the whole tile is clickable and keyboard reachable. */
.fm-upload { display: flex; align-items: center; gap: .9rem; padding: .75rem; border: 1px dashed #d8dbe5; border-radius: 12px; background: #fafbfc; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; margin: 0; }
.fm-upload:hover, .fm-upload:focus-within { border-color: var(--dr-accent, #8C52FF); background: #faf8ff; }
.fm-upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.fm-upload-preview { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px; border: 1px solid #eef0f5; background: #fff; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; color: #cbd5e1; font-size: 1.3rem; }
.fm-upload-preview img { width: 100%; height: 100%; object-fit: contain; }
.fm-upload-text { min-width: 0; }
.fm-upload-text strong { display: block; font-size: .82rem; color: #0f172a; }
.fm-upload-text span { display: block; font-size: .74rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 575.98px) {
	.fm-grid { grid-template-columns: 1fr; }
	.fm-modal .modal-header, .fm-modal .modal-body, .fm-modal .modal-footer { padding-left: 1.1rem; padding-right: 1.1rem; }
	.fm-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
	.fm-choice span { padding: .55rem .35rem; font-size: .74rem; }
	.fm-switch { padding: .7rem .85rem; gap: .65rem; }
	.fm-switch-text { min-width: 0; flex: 1 1 auto; }
	.fm-modal .modal-footer { display: flex; gap: .5rem; }
	.fm-modal .modal-footer .btn { flex: 1 1 0; min-width: 0; }
}

/* select2 multi-selects measure their search box while the modal is hidden (0px wide), which
   hides the placeholder; let it fill the field instead. */
.fm-modal .select2-selection--multiple .select2-search--inline,
.fm-modal .select2-selection--multiple .select2-search--inline .select2-search__field { width: 100% !important; }
.fm-modal .select2-selection--multiple .select2-selection__choice ~ .select2-search--inline,
.fm-modal .select2-selection--multiple .select2-selection__choice ~ .select2-search--inline .select2-search__field { width: auto !important; }
.fm-modal .select2-selection--multiple .select2-search__field { font-size: .8125rem !important; margin: 0 !important; padding: 0 .35rem !important; line-height: 2.1 !important; }
.fm-modal .select2-selection--multiple .select2-search__field::placeholder { color: #94a3b8; }

/* Choice cards: radio buttons shown as selectable tiles (e.g. attribute type). */
.fm-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; }
.fm-choice { position: relative; margin: 0; cursor: pointer; }
.fm-choice input { position: absolute; opacity: 0; pointer-events: none; }
.fm-choice span { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .7rem .5rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; font-size: .78rem; font-weight: 600; color: #475569; text-align: center; transition: border-color .15s ease, background-color .15s ease, color .15s ease; word-break: break-word; }
.fm-choice span i { font-size: 1.05rem; color: #94a3b8; }
.fm-choice:hover span { border-color: #c4b5fd; }
.fm-choice input:checked + span { border-color: var(--dr-accent, #8C52FF); background: #faf8ff; color: var(--dr-accent-dark); box-shadow: 0 0 0 3px rgba(var(--dr-accent-rgb), .12); }
.fm-choice input:checked + span i { color: var(--dr-accent, #8C52FF); }
.fm-choice input:focus-visible + span { outline: 2px solid var(--dr-accent, #8C52FF); outline-offset: 2px; }

/* Switch row: title + explanation on the left, toggle on the right. */
.fm-switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; cursor: pointer; margin: 0; }
.fm-switch-text strong { display: block; font-size: .82rem; color: #0f172a; }
.fm-switch-text small { display: block; font-size: .74rem; color: #94a3b8; margin-top: .1rem; }
.fm-switch input { position: absolute; opacity: 0; pointer-events: none; }
.fm-switch-track { flex: 0 0 auto; position: relative; width: 40px; height: 22px; border-radius: 999px; background: #e2e8f0; transition: background-color .15s ease; }
.fm-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .2); transition: transform .15s ease; }
.fm-switch input:checked ~ .fm-switch-track { background: var(--dr-accent, #8C52FF); }
.fm-switch input:checked ~ .fm-switch-track::after { transform: translateX(18px); }
.fm-switch input:focus-visible ~ .fm-switch-track { outline: 2px solid var(--dr-accent, #8C52FF); outline-offset: 2px; }
.fm-modal .fm-switch-text small { font-weight: 400 !important; color: #94a3b8 !important; }
