@media (max-width: 600px) {
    /* ...existing mobile styles... */
    #mhweb-category-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
        justify-items: center !important;
        align-items: stretch !important;
        margin-bottom: 2em !important;
    }
    #mhweb-category-buttons li,
    #mhweb-category-buttons .mhweb-category-tile {
        flex: unset !important;
        max-width: none !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
}
/* Mobile styles for plugin frontend */
@media (max-width: 600px) {
    body.home #mhweb-form,
    body.front-page #mhweb-form {
        max-width: 90% !important;
        padding: 8px !important;
        margin-top: 0 !important;
    }
    #mhweb-form input[type="text"],
    #mhweb-form input[type="email"],
    #mhweb-form input[type="date"],
    #mhweb-form input[type="file"] {
        font-size: 16px !important;
        padding: 10px !important;
        border-radius: 8px !important;
        width: 100% !important;
        margin-bottom: 16px !important;
    }
    #mhweb-form label,
    .mhweb-form-label {
        font-size: 15px !important;
        margin-bottom: 4px !important;
    }
    .mhweb-send-button-wrapper button,
    #mhweb-form button[type="submit"] {
        width: 100% !important;
        font-size: 18px !important;
        padding: 14px !important;
        margin-top: 18px !important;
    }
    .mhweb-form-group {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px 0 !important;
        font-size: 1em !important;
    }
    .mhweb-tooltip {
        font-size: 13px !important;
        left: 0 !important;
        top: 100% !important;
        transform: none !important;
        padding: 8px 12px !important;
        left: 50% !important;
        top: auto !important;
        bottom: 8px !important;
        transform: translateX(-50%) !important;
        max-width: 90vw !important;
        min-width: 180px !important;
        font-size: 14px !important;
        white-space: normal !important;
        word-break: break-word !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
    }
}
/* Only for owned examples */
#mhweb-owned-examples .mhweb-example-item {
    width: 101px;
    height: 102px;
}
/* Tooltip for info icon */
.mhweb-info-icon:hover .mhweb-tooltip,
.mhweb-info-icon:focus .mhweb-tooltip {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
}
.mhweb-tooltip { 
    display: none;
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: #222;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
/* Hide owned examples by default */
#mhweb-owned-examples { display: none; }
#mhweb-owned-examples.mhweb-show { display: block; }
.mhweb-form-group { 
    display: flex !important;  
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 500px !important;
    padding: 18px 0 !important;
    border-bottom: 1px solid #eee !important;
    font-size: 1.46em !important; /* increased ~15% from 1.27em */
}
.mhweb-form-group:last-child {
    border-bottom: none !important; 
}
.mhweb-form-label,
#mhweb-form label {
    font-weight: 700 !important;
    color: #000 !important;
    font-size: 16px !important; /* fixed label size requested */
}

/* Ownership question label inside .mhweb-origin should match other form headers */
.mhweb-origin .mhweb-form-label {
    display: block;
    margin-bottom: 6px !important;
}
.mhweb-form-input {
    width: 70px !important;
    padding: 6px 10px !important;
    font-size: 1.32em !important; /* increased ~15% */
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    text-align: center !important;
    background: #fafafa !important;
}
body.home #mhweb-form,
body.front-page #mhweb-form {
    max-width: 60%;
    margin-left: auto;
    margin-right: auto;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding-top: 10px !important;
    margin-top: 0.75em !important;
}
#mhweb-form input[type="text"],
#mhweb-form input[type="email"] {
    width: 100% !important;
    margin-bottom: 12px !important;
    padding: 8px 10px !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    font-size: 1.32em !important;
}

/* Reduce name and email input font size slightly for better visual balance */
#mhweb-name, #mhweb-email {
    font-size: 1.12em !important; /* ~15% smaller than 1.32em */
}
.mhweb-send-button-wrapper{
    text-align: center !important;
}
#mhweb-form button[type="submit"] {
    margin-top: 16px !important;
    padding: 10px 24px !important;
    background: #222 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 1.46em !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}
#mhweb-form button[type="submit"]:hover {
    background: #444 !important;
}
#mhweb-form button[type="submit"]:disabled,
#mhweb-form button[type="submit"][disabled],
#mhweb-submit:disabled,
#mhweb-submit[disabled],
.button:disabled,
.button[disabled] {
    background: #ccc !important;
    color: #666 !important;
    border-color: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
    box-shadow: none !important;
}
#mhweb-form button[type="submit"]:disabled:hover,
#mhweb-submit:disabled:hover,
.button:disabled:hover {
    background: #ccc !important;
    color: #666 !important;
}
#mhweb-submit.disabled,
.button.disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}
#mhweb-custom-flavors .mhweb-custom-row {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    margin-bottom: 8px !important;
}
.mhweb-custom-name {
    flex: 1 !important;
    padding: 6px 8px !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
}
.mhweb-custom-qty {
    width: 80px !important;
    padding: 6px 8px !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    text-align: center !important;
}
.mhweb-remove-custom {
    background: #e74c3c !important;
    color: #fff !important;
    border: none !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
}
#mhweb-form input:focus,
#mhweb-form button:focus,
#mhweb-custom-flavors .mhweb-custom-name:focus,
#mhweb-custom-flavors .mhweb-custom-qty:focus {
    outline: 3px solid rgba(100,150,255,0.25) !important;
    outline-offset: 2px !important;
}

/* Hide any textual label rendered near mh_qty shortcodes (targets labels for the visible inputs) */
label[for^="mhweb-visible-qty-"] {
    display: none !important;
}

/* Visible qty input styling — compact, aligned, and consistent with form theme */
.mhweb-visible-qty {
    width: 70px !important;
    padding: 6px 10px !important;
    font-size: 1.32rem !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    text-align: center !important;
    background: #fafafa !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    margin-top: 10px !important; /* added top spacing */
}

/* Remove spinner arrows on some browsers for cleaner look (optional) */
.mhweb-visible-qty::-webkit-outer-spin-button,
.mhweb-visible-qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
.mhweb-visible-qty[type=number] {
    -moz-appearance: textfield !important;
}

/* Small responsive tweak if many boxes are inline */
.mhweb-visible-qty + .mhweb-visible-qty {
    margin-left: 8px !important;
}

/* keep focus styles consistent */
.mhweb-visible-qty:focus {
    outline: 3px solid rgba(100,150,255,0.25) !important;
    outline-offset: 2px !important;
}

/* result / notice styles for AJAX responses */
#mhweb-result {
    display: block !important;
    margin-top: 12px !important;
    padding: 10px 12px !important;
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
    transition: background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease !important;
}

/* success / error states */
#mhweb-result.mhweb-result--success {
    text-align: center !important;
    color: #1a7f37 !important;
}

#mhweb-result.mhweb-result--error {
    background: #fdecea !important;
    text-align: center !important;
    color: #b3362b !important;
}

/* neutral / sending state */
#mhweb-result.mhweb-result--info {
    color: #333 !important;
    text-align: center !important;
}

/* uniform boxes, preserve whole image (may show gaps) */
.uagb-ifb-image-content {
    width: 300px !important;
    height: 300px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fff !important;
    margin: auto !important;
    border-radius: 29px !important;
}
.uagb-ifb-image-content img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* no cropping */
    object-position: center center !important;
    max-width: none !important;
}

@media (max-width: 899px) {
    /* Center the form container and make it comfortably narrow on mobile */
    #mhweb-form {
        width: calc(100% - 32px) !important;
        max-width: 480px !important;
        margin: 0 auto !important;
        padding-top: 12px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Stack rows and remove horizontal spacing */
    .mhweb-form-group {
        display: block !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid #eee !important;
        max-width: 100% !important;
    }

    /* Hide visual labels (inputs keep aria-label) to save space */
    .mhweb-form-label {
        display: none !important;
    }

    /* Make text/email inputs full width */
    #mhweb-form input[type="text"],
    #mhweb-form input[type="email"] {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 0 12px 0 !important;
        padding: 10px 12px !important;
    }

    /* Center quantity boxes under image and make them consistent size */
    .mhweb-form-input,
    .mhweb-visible-qty {
        display: block !important;
        width: 64px !important;
        margin: 8px auto 0 auto !important;
        text-align: center !important;
    }

    /* Make submit button full width and centered */
    #mhweb-form button[type="submit"] {
        display: block !important;
        width: calc(100% - 0px) !important;
        max-width: none !important;
        margin: 14px auto 0 auto !important;
        padding: 12px 14px !important;
        box-sizing: border-box !important;
    }

    /* Slightly reduce focus outline on small screens */
    #mhweb-form input:focus,
    #mhweb-form button:focus,
    .mhweb-visible-qty:focus {
        outline-offset: 1px !important;
        outline: 3px solid rgba(100,150,255,0.18) !important;
    }
}
/* Styles moved from shortcode in diazclothes-form-by-arturo.php */
#mhweb-category-buttons {
    display: flex;
    flex-flow: row wrap; /* ensure row-wise wrapping left-to-right */
    direction: ltr; /* force left-to-right flow */
    gap: 2em;
    margin: 0 !important;
    padding: 0;
    list-style: none;
    justify-content: flex-start; /* align items to the left */
    align-content: flex-start; /* align wrapped rows to the top/left */
}
/* Default: outer tile should be visually neutral (no bg, border or shadow).
   The selected state will apply the visible border and shadow. */
#mhweb-category-buttons li, #mhweb-category-buttons .mhweb-category-tile {
    background: transparent !important;
    border-radius: 16px;
    box-shadow: none !important;
    text-align: center;
    /*padding: 1.5em 0.5em 1em 0.5em;*/
    transition: box-shadow 0.2s, border 0.2s;
    border: 0 !important;
    cursor: pointer;
    flex: 0 1 129px;
    max-width: 240px;
}
/* Show border and shadow only when tile is selected */
#mhweb-category-buttons .mhweb-category-tile.selected, #mhweb-category-buttons li.selected {
    border: 2px solid #0073aa !important;
    box-shadow: 0 10px 36px rgba(0,115,170,0.12) !important;
    background: transparent !important;
}
#mhweb-category-buttons .prod-img-wrap {
    /*margin-bottom: 1em;*/
    width: 100%;
}
#mhweb-category-buttons img {
    width: 100%;
    height: auto; /* let the height flow while preserving aspect ratio */
    object-fit: contain;
    border-radius: 8px;
    background: #f9f9f9;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    display: block;
}
/* plugin-specific title styling (bigger + enforced black color) */
#mhweb-category-buttons mark.count {
    background: #f7f5e6;
    color: #b59f3b;
    border-radius: 4px;
    padding: 0 0.3em;
    font-size: 0.93em; /* reduced ~15% from previous */
    font-weight: 500;
}
.mhweb-cat-title { font-size: 1.03em; font-weight:600; color:#000 !important; /*margin-top:0.4em; */}
.mhweb-cat-name { display:block; color:#000 !important; }
/* force plugin text to black for consistency */
#mhweb-form, #mhweb-form label, #mhweb-form input, #mhweb-form button, #mhweb-result { color: #000 !important; }
/* Defensive fixes: ensure plugin UI is interactive even if other plugins/themes
   insert overlays or global styles (e.g., when WooCommerce is toggled). */
/* Make the form a new stacking context and put it above nearby overlays */
#mhweb-form {
    position: relative !important;
    z-index: 9999 !important;
    isolation: isolate !important;
    pointer-events: auto !important;
    -webkit-font-smoothing: antialiased !important;
}
/* Ensure category buttons and anchors receive pointer events and are on top */
#mhweb-category-buttons,
#mhweb-category-buttons li,
#mhweb-category-buttons li a,
#mhweb-category-buttons .prod-img-wrap {
    position: relative !important;
    z-index: 10000 !important;
    pointer-events: auto !important;
}
/* Defensive: neutralize any pseudo-element overlays created on the form */
#mhweb-form::before, #mhweb-form::after,
#mhweb-category-buttons::before, #mhweb-category-buttons::after {
    pointer-events: none !important;
    content: none !important;
}
/* When the shortcode is placed on the front page (body.home), use a slightly wider layout */
.home .mhweb-form, .front-page .mhweb-form { /* fallback for themes */ }
body.home #mhweb-form, body.front-page #mhweb-form {
    max-width: 60%;
    margin-left: auto;
    margin-right: auto;
}
/* Examples header and captions */
.mhweb-examples-header {
    font-size: 1rem;
    color: #222;
}

/* Examples: single-row thumbnail strip */
.mhweb-examples-list { align-items: center; }
.mhweb-examples-list-container {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    padding: 0.4rem 0;
}
.mhweb-examples-list-container::-webkit-scrollbar { height: 8px; }
.mhweb-examples-list-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 8px; }
.mhweb-example-item {
    flex: 0 0 auto;
    width: 96px; /* fixed thumbnail width */
    height: 72px; /* fixed thumbnail height to keep a compact single row */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.mhweb-example-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover; /* crop to fill thumbnail box */
    border-radius: 8px;
    display: block;
}

.mhweb-example-item img { max-width: none; }

/* Hide categories and examples when the customer indicates they bring their own article */
#mhweb-form.mhweb-owned #mhweb-category-buttons,
#mhweb-form.mhweb-owned #mhweb-examples {
    display: none !important;
}

/* Also hide the visible 'Categoría' label and its following line break when owned */
#mhweb-form.mhweb-owned label[for="mhweb-category"],
#mhweb-form.mhweb-owned label[for="mhweb-category"] + br {
    display: none !important;
}

/* Short visual highlight used when category validation fails */
.mhweb-error-highlight {
    animation: mhweb-flash 2.2s ease-in-out;
}
@keyframes mhweb-flash {
    0% { box-shadow: 0 0 0 0 rgba(255,0,0,0.0); }
    10% { box-shadow: 0 0 0 4px rgba(183,54,43,0.12); }
    30% { box-shadow: 0 0 0 6px rgba(183,54,43,0.06); }
    100% { box-shadow: none; }
}
.mhweb-info-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    cursor: pointer;
    position: relative;
    top: -2px;
}

/* Inventory System Styles */
.mhweb-category-tile.mhweb-out-of-stock {
    opacity: 0.5;
    filter: grayscale(70%);
    pointer-events: none;
    position: relative;
}

.mhweb-category-tile.mhweb-out-of-stock a {
    cursor: not-allowed;
    pointer-events: none;
}

.mhweb-stock-indicator {
    display: block;
    background: #d63638;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
}

/* Only apply out-of-stock styling when "new" article is selected */
#mhweb-form:not(.mhweb-owned) .mhweb-category-tile.mhweb-out-of-stock {
    opacity: 0.5;
    filter: grayscale(70%);
    pointer-events: none;
}

#mhweb-form:not(.mhweb-owned) .mhweb-category-tile.mhweb-out-of-stock a {
    cursor: not-allowed;
    pointer-events: none;
}

/* When "owned" article is selected, show categories normally */
#mhweb-form.mhweb-owned .mhweb-category-tile.mhweb-out-of-stock {
    opacity: 1;
    filter: none;
    pointer-events: auto;
}

#mhweb-form.mhweb-owned .mhweb-category-tile.mhweb-out-of-stock a {
    cursor: pointer;
    pointer-events: auto;
}

/* Hide stock indicator when "owned" is selected since it doesn't apply */
#mhweb-form.mhweb-owned .mhweb-stock-indicator {
    display: none;
}