/*
 * Marvels Clover Sync: modifier groups on the product page and in the quick-add modal (1.7.2).
 *
 * Deliberately plain: inherits the theme's font, colour and form controls,
 * and uses currentColor for borders so it suits light and dark themes.
 * Restyle with the "Custom CSS" box (Clover Sync → General), your theme's
 * stylesheet, or by overriding the templates. Every element has a stable
 * class: .mcs-mod, .mcs-mod-group, .mcs-mod-group-title, .mcs-mod-group-name,
 * .mcs-mod-rule, .mcs-mod-options, .mcs-mod-option, .mcs-mod-input,
 * .mcs-mod-name, .mcs-mod-price, .mcs-mod-image, .mcs-mod-select.
 */
.mcs-mod { margin: 0 0 1.25em; }
.mcs-mod-group { margin: 0 0 1em; padding: 0; border: 0; min-width: 0; }
.mcs-mod-group-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5em; margin: 0 0 .4em; padding: 0; font-weight: 600; }
.mcs-mod-rule { font-weight: 400; font-size: .875em; opacity: .7; }
.mcs-mod-options { display: flex; flex-direction: column; gap: .35em; }
.mcs-mod-option { display: flex; align-items: center; gap: .5em; margin: 0; cursor: pointer; }
.mcs-mod-input { margin: 0; flex: none; }
.mcs-mod-name { flex: 1 1 auto; }
.mcs-mod-price { flex: none; font-size: .925em; opacity: .8; white-space: nowrap; }
.mcs-mod-option:has(.mcs-mod-input:disabled) { opacity: .5; cursor: not-allowed; }
.mcs-mod-select { width: 100%; max-width: 24em; }

/* Pills: the inputs stay in the page (keyboard and screen readers) but out of sight */
.mcs-mod-group--pills .mcs-mod-options,
.mcs-mod-group--cards .mcs-mod-options { flex-direction: row; flex-wrap: wrap; gap: .5em; }
.mcs-mod-group--pills .mcs-mod-input,
.mcs-mod-group--cards .mcs-mod-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mcs-mod-group--pills .mcs-mod-option { position: relative; padding: .45em .9em; border: 1px solid currentColor; border-radius: 999px; border-color: rgba(127, 127, 127, .5); }
.mcs-mod-group--pills .mcs-mod-name { flex: none; }
.mcs-mod-group--pills .mcs-mod-option--checked,
.mcs-mod-group--pills .mcs-mod-option:has(.mcs-mod-input:checked) { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; font-weight: 600; }

/* Cards, with the option's image when it has one */
.mcs-mod-group--cards .mcs-mod-option { position: relative; flex-direction: column; align-items: flex-start; gap: .25em; width: 9em; padding: .6em; border: 1px solid rgba(127, 127, 127, .5); border-radius: 8px; }
.mcs-mod-group--cards .mcs-mod-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.mcs-mod-group--cards .mcs-mod-option--checked,
.mcs-mod-group--cards .mcs-mod-option:has(.mcs-mod-input:checked) { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }

.mcs-mod-input:focus-visible + .mcs-mod-image,
.mcs-mod-group--pills .mcs-mod-option:has(.mcs-mod-input:focus-visible),
.mcs-mod-group--cards .mcs-mod-option:has(.mcs-mod-input:focus-visible) { outline: 2px solid; outline-offset: 2px; }

/* Quick-add modal (1.7.2): .mcs-modal is the script's dialog, .mcs-modal-form is modal.php */
.mcs-modal-open { overflow: hidden; }
.mcs-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mcs-modal[hidden] { display: none; }
.mcs-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.mcs-modal-panel { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: #fff; color: #1d2327; border-radius: 12px; padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.mcs-modal-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: inherit; font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.mcs-modal-head { display: flex; gap: 12px; align-items: center; margin: 0 32px 12px 0; }
.mcs-modal-image { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.mcs-modal-title { margin: 0; font-size: 1.2em; }
.mcs-modal-base-price { opacity: .75; }
.mcs-modal-errors { color: #b32d2e; margin: 8px 0; }
.mcs-modal-errors p { margin: 0 0 4px; }
.mcs-modal-foot { position: sticky; bottom: -20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 12px -20px -20px; padding: 12px 20px; background: inherit; border-top: 1px solid rgba(127, 127, 127, .25); }
.mcs-modal-qty { display: flex; align-items: center; gap: 4px; margin: 0; }
.mcs-modal-qty input { width: 3.5em; text-align: center; }
.mcs-qty-step { min-width: 36px; min-height: 36px; border: 1px solid rgba(127, 127, 127, .5); background: transparent; color: inherit; border-radius: 6px; cursor: pointer; }
.mcs-modal-add { display: flex; gap: .75em; align-items: center; justify-content: space-between; min-height: 44px; }
.mcs-modal-add[disabled] { opacity: .6; }
