/* Layout support for the new commerce controls. Page themes come from the
   original product/checkout stylesheets or the staff area's default Bootstrap. */
[hidden] { display: none !important; }
.commerce-description { white-space: pre-line; overflow-wrap: anywhere; }
.commerce-amount, #image-counter { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.stock-add { margin-bottom: 24px; border: 1px solid var(--storefront-border, #cbdce9); border-radius: 12px; background: #fff; font-size: 14px; }
.stock-add summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; color: var(--storefront-accent, #12669b); cursor: pointer; }
.stock-add summary span { color: var(--storefront-muted, #526174); font-size: 13px; }
.stock-add form { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; padding: 0 20px 20px; }
.stock-add label { display: grid; gap: 6px; min-width: 150px; max-width: 100%; margin: 0; }
.stock-add input:not([type=hidden]), .stock-add select { padding: 10px 12px; min-width: 0; max-width: 100%; border: 1px solid var(--storefront-border, #a6b1be); border-radius: 7px; background: #fff; color: var(--storefront-text, #263445); font: inherit; }
.stock-add input[type=number] { width: 170px; }
.stock-add select { width: 260px; }
.stock-add-preview { display: grid; gap: 6px; font-size: 13px; color: var(--storefront-muted, #526174); padding-bottom: 4px; }
.stock-add-preview b { display: inline-block; min-width: 32px; margin-inline-start: 8px; color: var(--storefront-text, #263445); }
.stock-add button { border: 1px solid var(--storefront-accent, #12669b); border-radius: 7px; padding: 11px 18px; background: var(--storefront-accent, #12669b); color: #fff; font: 700 14px/1.5 'Almarai', sans-serif; cursor: pointer; }
.stock-add button:disabled { opacity: .5; cursor: not-allowed; }
.stock-add-help, .stock-add-result { flex-basis: 100%; margin: 0; }
.stock-add-help { color: var(--storefront-muted, #526174); font-size: 13px; }
.stock-add-result { padding: 10px 12px; background: var(--storefront-surface, #ecfdf3); color: var(--storefront-text, #146536); border-radius: 7px; }
.stock-add-result.error { background: #fff0ef; color: #a02a24; }
.stock-add :focus-visible { outline: 3px solid var(--storefront-accent, #36a7e9); outline-offset: 3px; }
.commerce-product button { font-family: inherit; }
.commerce-product button:disabled { opacity: .5; cursor: not-allowed; }
.commerce-product .product-layout { align-items: start; }
.commerce-product .product-layout > * { min-width: 0; }
.commerce-product .order-section { top: 90px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.commerce-color-options .form-label { margin-bottom: 12px; font-size: 19px; }
.commerce-product .color-swatch { min-width: 0; width: 54px; height: 48px; padding: 4px; border: 2px solid #e3e3e3; border-radius: 3px; background: #fff; }
.color-swatch-fill { display: block; width: 100%; height: 100%; background: var(--swatch-color); border: 1px solid rgba(0, 0, 0, .08); }
.commerce-product .color-swatch:hover, .commerce-product .color-swatch.selected { border-color: #252525; background: #fff; }
.commerce-product .color-swatch.selected { outline: 2px solid #252525; outline-offset: 2px; }
.commerce-product .color-swatch:disabled { opacity: .3; }
.commerce-product .color-swatch:disabled .color-swatch-fill { background-image: linear-gradient(to top right, transparent 47%, #fff 48%, #fff 52%, transparent 53%); }
.customer-information { min-width: 0; margin: 20px 0 0; padding: 40px 28px 48px; border: 2px solid #202020; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .04); container: customer-information / inline-size; }
.customer-information .customer-information-title { margin: 0 0 20px; text-align: center; font-size: 26px; font-weight: 700; color: #303030; line-height: 1.5; }
.customer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 576px; margin: 0 auto; }
.customer-field { min-width: 0; }
.customer-field-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.customer-information .form-input { min-width: 0; height: 64px; padding: 16px; border: 1px solid var(--storefront-border, #d8bd68); border-radius: 10px; background: #fff; color: #303030; font: inherit; font-size: 16px; }
.customer-information .form-input::placeholder { color: var(--storefront-muted, #8b8b8b); opacity: 1; }
.customer-information .form-input:focus { border-color: var(--storefront-accent, #aa8625); box-shadow: 0 0 0 3px var(--storefront-focus, rgba(216, 189, 104, .2)); outline: none; }
[dir="rtl"] .customer-information input[type="tel"] { text-align: right; }
.commerce-product .color-swatch:focus-visible { outline: 3px solid var(--storefront-accent, #aa8625); outline-offset: 3px; }
.commerce-checkout #checkout-form { padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.commerce-checkout .customer-information { margin-top: 0; }
.commerce-option-group { border: 0; padding: 0; min-width: 0; }
.commerce-product #open-image { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.commerce-product .thumbnail { padding: 0; background: transparent; }
.commerce-product .thumbnail[aria-pressed="true"] { border-color: var(--primary); }
.commerce-product #image-counter { position: absolute; bottom: 10px; inset-inline-end: 10px; background: var(--white); padding: 2px 8px; pointer-events: none; }
.commerce-product #reset-options { border: 0; background: transparent; cursor: pointer; padding-inline: 0; }
.commerce-product #selection-summary, .commerce-product #variant-status { margin-bottom: 15px; }
.commerce-buy-actions { display: grid; gap: 10px; margin: 15px 0; }
.commerce-buy-actions .header-btn { justify-content: center; }
.product-explanation { max-width: 900px; margin: 40px auto 0; }
.product-explanation-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.product-explanation-heading .section-heading { margin: 0; }
.product-explanation-heading a { font-size: 14px; }
.product-explanation-images { display: flex; flex-direction: column; gap: 0; background: #fff; }
.product-explanation-images img { display: block; width: 100%; height: auto; max-height: none; margin: 0; border: 0; border-radius: 0; }
.product-explanation-empty { padding: 20px; background: #fff; border: 1px dashed var(--storefront-border, #cbdce9); border-radius: 8px; }
.detail-image-editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.detail-image-tile { min-width: 0; padding: 10px; border: 1px solid #dee2e6; border-radius: 8px; }
.detail-image-tile > img { display: block; width: 100%; height: 180px; object-fit: contain; background: #f8f9fa; margin-bottom: 8px; }
.detail-image-tile label { display: block; font-size: 13px; margin-bottom: 4px; }
.detail-image-preview { margin-top: 12px; }
.detail-image-preview summary { cursor: pointer; color: var(--storefront-accent, #12669b); }
.detail-image-preview .product-explanation-images { max-width: 600px; margin: 16px auto 0; }
#product-details-editor { scroll-margin-top: 20px; }
#image-lightbox { margin: auto; padding: 15px; width: min(90vw, 850px); max-height: 92vh; border: 1px solid var(--border-color); border-radius: var(--radius); }
#image-lightbox::backdrop { background: rgba(0, 0, 0, .7); }
#image-lightbox img { display: block; width: 100%; height: 72vh; object-fit: contain; }
.commerce-lightbox-actions { display: flex; justify-content: space-between; gap: 10px; }
.commerce-product .service-notice { background: var(--storefront-surface, #f0fdf4); padding: 1rem; border-radius: 8px; margin: 1rem 0; border: 1px solid var(--storefront-border, #d1fae5); }
.commerce-product .service-notice.error, .commerce-checkout .service-notice.error { background: #fef2f2; border-color: #fecaca; color: #ef4444; }
.commerce-checkout .order-summary h2 { margin-bottom: 2rem; color: #1a1a1a; font-size: 1.5rem; }
.commerce-checkout .checkout-grid > * { min-width: 0; }
.commerce-checkout .form-input { font-family: inherit; }
.commerce-checkout .order-item-details { min-width: 0; overflow-wrap: anywhere; }
.commerce-checkout .order-item-image { flex-shrink: 0; }
.commerce-checkout .header-actions a { text-decoration: none; }
.commerce-cart-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.commerce-cart-edit .form-input { width: 65px; padding: 4px; }
.commerce-cart-edit .remove-item-btn { background: none; border: none; color: #ef4444; cursor: pointer; padding: 4px 8px; font-size: 13px; }
.commerce-delivery { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.commerce-receipt { max-width: 900px; margin: 2rem auto; }
.commerce-receipt-confirmation { display: block; width: 432px; max-width: 100%; height: auto; margin: 0 auto 1.5rem; }
.commerce-receipt .submit-btn { text-decoration: none; }
.commerce-order-item { display: flex; align-items: flex-start; gap: 1rem; }
.commerce-order-images { display: flex; flex-wrap: wrap; gap: 5px; width: 130px; flex-shrink: 0; }
.commerce-order-images img { width: 60px; height: 60px; object-fit: contain; }
.commerce-order-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.commerce-admin { font-family: Almarai, system-ui, sans-serif; }
.commerce-admin .editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; }
.commerce-admin .editor-grid > * { min-width: 0; }
.commerce-admin .bundle-price-field { display: flex; align-items: center; gap: .625rem; min-width: 220px; direction: ltr; }
.commerce-admin .bundle-price-field .form-control { min-width: 0; min-height: 56px; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.commerce-admin .bundle-price-currency { flex-shrink: 0; font-size: 1.25rem; font-weight: 700; }
.commerce-admin .media-editor { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.commerce-admin .media-tile { width: 140px; overflow-wrap: anywhere; }
.commerce-admin .media-tile img { width: 100%; height: 120px; object-fit: contain; margin-bottom: .5rem; }
.commerce-admin .media-actions { display: flex; gap: .25rem; margin-top: .5rem; }
.commerce-admin .option-editor-group { margin-bottom: 16px; padding: 18px; border: 1px solid #e1e3e8; border-radius: 10px; background: #fff; }
.commerce-admin #product-options-editor { container: option-editor / inline-size; }
.commerce-admin .option-editor-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(140px, 1fr) minmax(220px, 2fr) 32px; gap: 16px; align-items: start; }
.commerce-admin .option-field { min-width: 0; }
.commerce-admin .option-field .form-label { display: block; margin-bottom: 8px; font-size: 14px; color: #49515e; }
.commerce-admin .option-field .form-control, .commerce-admin .option-field .form-select { min-height: 44px; font-size: 16px; }
.commerce-admin .option-value-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; }
.commerce-admin .option-value-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 2px 8px; border: 1px solid #e5d5d9; border-radius: 5px; background: #faf5f6; color: #343039; overflow-wrap: anywhere; }
.commerce-admin .option-value-chip.selected { border-color: #926275; background: #f7eaef; }
.commerce-admin .option-chip-remove, .commerce-admin .option-group-remove { flex-shrink: 0; width: 32px; min-height: 36px; border: 0; border-radius: 4px; background: transparent; color: #67616a; font-size: 24px; line-height: 1; }
.commerce-admin .option-group-remove { margin-top: 28px; }
.commerce-admin .option-chip-color { flex-shrink: 0; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.commerce-admin .option-chip-color::-webkit-color-swatch-wrapper { padding: 3px; }
.commerce-admin .option-chip-color::-webkit-color-swatch { border: 1px solid #0002; border-radius: 50%; }
.commerce-admin .option-value-entry { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.commerce-admin .option-value-entry .form-control { min-width: 0; }
.commerce-admin .option-new-color { flex-shrink: 0; width: 36px; height: 36px; padding: 2px; border: 1px solid #d8dce1; border-radius: 4px; background: #fff; }
.commerce-admin .option-add-value { min-width: 40px; min-height: 44px; padding: 8px; border: 0; border-radius: 4px; background: transparent; color: #7b4d60; font-size: 16px; }
.commerce-admin .option-static-field { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid #e1e3e8; border-radius: 6px; background: #f9fafb; font-size: 15px; }
.commerce-admin .option-editor-notice { padding: 12px 16px; border-inline-start: 3px solid #3482a7; background: #f0f8fc; color: #416476; font-size: 14px; line-height: 1.7; }
.commerce-admin .bundle-edit { padding: 6px 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: start; }
.commerce-admin .single-unit-offer { color: #626773; background: #f6f7f9; border-color: #e1e3e8; }
.commerce-admin .bundle-fields { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(220px, 2fr); gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee; }
.commerce-admin .bundle-fields .bundle-price-field { min-width: 0; }
.commerce-admin .option-field .bundle-price-field .form-control { min-height: 56px; font-size: 24px; }
.commerce-admin .option-chip-remove:focus-visible, .commerce-admin .option-group-remove:focus-visible, .commerce-admin .option-add-value:focus-visible, .commerce-admin .bundle-edit:focus-visible { outline: 3px solid #3482a7; outline-offset: 2px; }
.commerce-admin .option-editor-group button { cursor: pointer; touch-action: manipulation; }
.commerce-admin .option-editor-group button:disabled { opacity: .45; cursor: not-allowed; }
.commerce-admin .option-editor-group button:active { background-color: #eee7eb; }
.commerce-admin .option-color-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: -.5rem 0 1rem; }
.commerce-admin .option-color-controls label { margin: 0; }
.commerce-admin .option-color-controls input[type="color"] { width: 48px; height: 40px; padding: 4px; cursor: pointer; }
.commerce-admin #variant-editor input:not([type="checkbox"]), .commerce-admin #variant-editor select { min-width: 85px; }
.commerce-admin .staff-item-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 75px auto; gap: .5rem; margin-bottom: 1rem; }
@container option-editor (max-width: 640px) {
    .commerce-admin .option-editor-row, .commerce-admin #promotions-editor .option-editor-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
    .commerce-admin .option-editor-row > .option-field:nth-child(3) { grid-column: 1 / -1; }
    .commerce-admin .option-group-remove { grid-column: 2; justify-self: end; margin-top: 0; }
}
@container customer-information (max-width: 440px) {
    .customer-fields { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
    .commerce-checkout .checkout-grid { grid-template-columns: 1fr; }
    .commerce-checkout .order-summary { position: static; }
}
@media (max-width: 900px) {
    .commerce-admin .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .customer-information { padding: 32px 24px 38px; }
    .commerce-product .order-section { position: static; }
    .commerce-order-images { width: 60px; }
    .commerce-order-item { gap: .5rem; }
    .commerce-admin .option-editor-row, .commerce-admin #promotions-editor .option-editor-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
    .commerce-admin .option-editor-row > .option-field:nth-child(3) { grid-column: 1 / -1; }
    .commerce-admin .option-group-remove { grid-column: 2; justify-self: end; margin-top: 0; }
    .commerce-admin .option-editor-group { padding: 12px; }
    .commerce-admin .bundle-fields { grid-template-columns: 1fr; }
    .commerce-admin .staff-item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .customer-information { padding: 28px 18px 32px; border-radius: 16px; }
    .customer-information .customer-information-title { font-size: 23px; margin-bottom: 18px; }
    .customer-fields { grid-template-columns: 1fr; gap: 14px; }
    .customer-information .form-input { height: 58px; }
    .stock-add summary { padding: 14px; }
    .stock-add form { padding: 0 14px 14px; }
    .stock-add label, .stock-add input[type=number], .stock-add select, .stock-add button { width: 100%; }
    .stock-add-preview { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; }
    .commerce-product .header-btn, .commerce-product .back-btn { padding: 8px; }
    .commerce-checkout .checkout-form, .commerce-checkout .order-summary { padding: 1rem; }
}
/* Product promotions share the existing storefront controls. */
.commerce-offers { margin: 16px 0; padding: 16px; border: 1px solid #ddd; border-radius: 12px; }
.commerce-offers h3 { margin: 0 0 10px; font-size: 1rem; }
.commerce-bundles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.commerce-bundles .size-button { width: auto; padding-inline: 14px; }
.commerce-bundles [aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 2px; }
.commerce-savings { color: var(--storefront-text, #16713d); font-weight: 700; }
#product-line-total { font-weight: 700; font-size: 1.1rem; }
#product-regular-price { color: #666; font-size: 1rem; }

/* Product purchase layout: price, choices, then delivery details. */
.commerce-product .order-section { padding: 32px 24px 24px; background: #fff; border: 1px solid #e7e7e7; border-radius: 12px; }
.product-purchase-price { margin: 8px 0 38px; text-align: center; color: #111; }
.product-price-main { display: flex; justify-content: center; align-items: baseline; gap: 12px; font-size: clamp(4.5rem, 8vw, 6.5rem); font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.product-price-main.long-amount { font-size: clamp(2rem, 4vw, 3.5rem); }
.product-price-currency { flex-shrink: 0; font-size: clamp(1.75rem, 2.6vw, 2.25rem); font-weight: 700; }
.purchase-options { text-align: center; }
.commerce-product .purchase-options .commerce-option-group { margin: 0 0 28px; }
.commerce-product .purchase-options .form-label { float: none; width: 100%; margin: 0 0 14px; font-size: 17px; line-height: 1.6; color: #202020; }
.product-radio-choices { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: fit-content; max-width: 100%; margin-inline: auto; }
.product-choice { position: relative; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.product-radio-choice { display: flex; align-items: center; gap: 12px; min-height: 44px; text-align: start; direction: ltr; }
[dir="rtl"] .product-radio-choice > span { direction: rtl; unicode-bidi: isolate; }
.product-radio-choice input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 24px; height: 24px; margin: 0; border: 1.5px solid #c8c8c8; border-radius: 50%; background: #fff; cursor: inherit; }
.product-radio-choice input:checked { border-color: #242424; background: radial-gradient(circle, #242424 0 5px, #fff 6px); }
.product-radio-choice > span { font-size: 18px; overflow-wrap: anywhere; }
.product-choice:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.product-color-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.product-color-choice { width: 58px; height: 58px; }
.product-color-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.product-color-swatch { display: block; width: 100%; height: 100%; padding: 4px; border: 1px solid #d7d7d7; background: var(--swatch-color); background-clip: content-box; border-radius: 2px; }
.product-color-choice input:checked + .product-color-swatch { outline: 2px solid #202020; outline-offset: 3px; }
.product-color-choice input:focus-visible + .product-color-swatch, .product-radio-choice input:focus-visible { outline: 3px solid var(--storefront-accent, #3482a7); outline-offset: 4px; }
.commerce-product .commerce-offers { padding: 0; border: 0; border-radius: 0; }
.commerce-product .commerce-bundles { flex-wrap: nowrap; margin-bottom: 0; }
.commerce-product #reset-options { margin: -10px 0 16px; padding: 8px; background: transparent; border: 0; color: #686868; font-size: 13px; text-decoration: underline; touch-action: manipulation; }
.commerce-product #variant-status, .commerce-product #selection-summary { text-align: center; color: #686868; font-size: 14px; }
.commerce-product .quantity-controls { margin-inline: auto; }
.custom-quantity { margin: 12px 0 20px; font-size: 14px; color: #686868; }
.custom-quantity summary { padding: 8px; cursor: pointer; }
.custom-quantity .quantity-section { margin-top: 12px; }
.commerce-product #product-line-total, .commerce-product #product-savings { text-align: center; }
.commerce-product .customer-information, .commerce-checkout .customer-information { padding: 24px 0 0; border: 0; border-top: 3px dotted #c8c8c8; border-radius: 0; box-shadow: none; background: transparent; }
.commerce-product .customer-information-title, .commerce-checkout .customer-information-title { font-size: 18px; }
.commerce-product .customer-fields, .commerce-checkout .customer-fields { gap: 12px; }
.commerce-product .customer-information .form-input, .commerce-checkout .customer-information .form-input { min-height: 52px; height: 56px; padding: 12px; border: 1px solid #d7d7d7; border-radius: 7px; background: #fff; font-size: 16px; }
.commerce-product .customer-information .form-input:focus, .commerce-checkout .customer-information .form-input:focus { border-color: #737373; box-shadow: 0 0 0 3px #0000000d; }
@media (hover: hover) and (pointer: fine) {
    .product-color-choice:hover .product-color-swatch { border-color: #777; }
    .product-radio-choice:hover > span { color: #000; }
    .commerce-admin .option-editor-group button:hover { background-color: #f2ebee; }
}
@media (max-width: 480px) {
    .commerce-admin .option-editor-row, .commerce-admin #promotions-editor .option-editor-row { grid-template-columns: minmax(0, 1fr); }
    .commerce-admin .option-editor-row > .option-field:nth-child(3), .commerce-admin .option-group-remove { grid-column: 1; }
    .commerce-product .order-section { padding: 24px 16px 20px; }
    .product-purchase-price { margin-bottom: 28px; }
    .product-color-choice { width: 52px; height: 52px; }
}
