/**
 * Single Product Add-to-Cart Widget — Styles
 *
 * All rules scoped under `.woh-satc-wrapper` so they can't leak out onto
 * other Elementor widgets or the stock WC form on the same page.
 *
 * @package WOH_Core
 */

/* =================================================================
   Wrapper + form
   ================================================================= */

.woh-satc-wrapper {
    width: 100%;
}

.woh-satc-wrapper .woh-satc {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin: 0;
}

/* Hide the hidden <select> mirrors — they only exist so WC JS keeps working. */
.woh-satc-wrapper .woh-satc-hidden-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =================================================================
   Variations block
   ================================================================= */

.woh-satc-wrapper .woh-satc-variations {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.woh-satc-wrapper .woh-satc-attr {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.woh-satc-wrapper .woh-satc-attr__label {
    display: flex;
    gap: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
}

.woh-satc-wrapper .woh-satc-attr__name {
    font-weight: 600;
}

.woh-satc-wrapper .woh-satc-attr__value {
    opacity: 0.8;
}

/* Hide the ": " when no value is selected yet. */
.woh-satc-wrapper .woh-satc-attr__value:empty::before {
    content: attr(data-empty-label);
}

/* =================================================================
   Pills
   ================================================================= */

.woh-satc-wrapper .woh-satc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.woh-satc-wrapper .woh-satc-pill {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.2;
    color: #1B2D5B;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    user-select: none;
    text-align: center;
    min-width: 44px;
    min-height: 40px;
}

.woh-satc-wrapper .woh-satc-pill:hover:not([aria-disabled="true"]) {
    background: #F5F0EB;
    border-color: #1B2D5B;
}

.woh-satc-wrapper .woh-satc-pill:active:not([aria-disabled="true"]) {
    transform: translateY(1px);
}

.woh-satc-wrapper .woh-satc-pill:focus-visible {
    outline: 2px solid #1B2D5B;
    outline-offset: 2px;
}

.woh-satc-wrapper .woh-satc-pill[aria-pressed="true"] {
    color: #fff;
    background: #1B2D5B;
    border-color: #1B2D5B;
}

.woh-satc-wrapper .woh-satc-pill[aria-disabled="true"] {
    color: #a8a8a8;
    background: #f5f5f5;
    border-color: #e5e5e5;
    cursor: not-allowed;
    position: relative;
}

.woh-satc-wrapper .woh-satc-pill[aria-disabled="true"]::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    top: 50%;
    border-top: 1px solid currentColor;
    opacity: 0.5;
    transform: rotate(-8deg);
}

/* =================================================================
   Clear link
   ================================================================= */

.woh-satc-wrapper .woh-satc-clear-row {
    min-height: 1.25em;
}

.woh-satc-wrapper .woh-satc-clear,
.woh-satc-wrapper .reset_variations {
    font-size: 0.8125rem;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    visibility: hidden;
}

.woh-satc-wrapper .woh-satc-clear.is-visible,
.woh-satc-wrapper .reset_variations.is-visible {
    visibility: visible;
}

.woh-satc-wrapper .woh-satc-clear:hover,
.woh-satc-wrapper .reset_variations:hover {
    color: #1B2D5B;
}

/* =================================================================
   Single variation output (price, stock text injected by WC JS)
   ================================================================= */

.woh-satc-wrapper .woh-satc-single-variation {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.woh-satc-wrapper .woh-satc-single-variation .woocommerce-variation {
    display: block;
    margin: 0;
}

.woh-satc-wrapper .woh-satc-single-variation .woocommerce-variation-price {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1B2D5B;
}

.woh-satc-wrapper .woh-satc-single-variation .woocommerce-variation-price .price {
    font-size: inherit;
}

.woh-satc-wrapper .woh-satc-single-variation .woocommerce-variation-availability {
    font-size: 0.875rem;
    color: #666;
}

.woh-satc-wrapper .woh-satc-single-variation .woocommerce-variation-description {
    font-size: 0.9375rem;
    color: #333;
}

/* Toggles driven by content controls. */
.woh-satc-wrapper .woh-satc--hide-stock .woocommerce-variation-availability {
    display: none;
}

.woh-satc-wrapper .woh-satc--hide-desc .woocommerce-variation-description {
    display: none;
}

/* =================================================================
   Quantity + submit row
   ================================================================= */

.woh-satc-wrapper .woh-satc-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

/* When stacked (Elementor control sets flex-direction: column) make the
   quantity stepper align-left rather than stretch full width. */
.woh-satc-wrapper .woh-satc-row[style*="column"] .woh-qty-stepper,
.woh-satc-wrapper .woh-satc-row.woh-satc-row--stacked .woh-qty-stepper {
    align-self: flex-start;
}

/* =================================================================
   Quantity stepper
   ================================================================= */

.woh-satc-wrapper .woh-qty-stepper {
    display: inline-flex;
    align-items: stretch;
    height: 48px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    flex: 0 0 auto;
}

.woh-satc-wrapper .woh-qty-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 48px;
    padding: 0;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    color: #1B2D5B;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.woh-satc-wrapper .woh-qty-btn:hover:not(:disabled) {
    background: #F5F0EB;
}

.woh-satc-wrapper .woh-qty-btn:focus-visible {
    outline: 2px solid #1B2D5B;
    outline-offset: -2px;
}

.woh-satc-wrapper .woh-qty-btn:disabled {
    color: #c8c8c8;
    cursor: not-allowed;
}

.woh-satc-wrapper .woh-qty-stepper .qty,
.woh-satc-wrapper .woh-qty-stepper input[type="number"].qty {
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    width: 56px;
    height: 48px;
    padding: 0 6px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    color: #1B2D5B;
    background: transparent;
    border: none;
    border-left: 1px solid #d8d8d8;
    border-right: 1px solid #d8d8d8;
    border-radius: 0;
    outline: none;
    margin: 0;
}

/* Hide number spinners — our +/- buttons replace them. */
.woh-satc-wrapper .woh-qty-stepper .qty::-webkit-outer-spin-button,
.woh-satc-wrapper .woh-qty-stepper .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.woh-satc-wrapper .woh-qty-stepper .qty:focus-visible {
    outline: 2px solid #1B2D5B;
    outline-offset: -2px;
}

/* Hide WC's screen-reader-only <label> for the qty input — we rely on
   the pill block labels for context. */
.woh-satc-wrapper .woh-qty-stepper label.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    clip: rect(0, 0, 0, 0) !important;
    overflow: hidden !important;
}

/* =================================================================
   Submit button
   ================================================================= */

.woh-satc-wrapper .woh-satc-submit {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: #1B2D5B;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    flex: 1 1 auto;
    min-height: 48px;
    text-align: center;
}

.woh-satc-wrapper .woh-satc-submit:hover:not(:disabled) {
    background: #ba5011;
}

.woh-satc-wrapper .woh-satc-submit:active:not(:disabled) {
    transform: translateY(1px);
}

.woh-satc-wrapper .woh-satc-submit:focus-visible {
    outline: 2px solid #1B2D5B;
    outline-offset: 2px;
}

/* Disabled / "select options first" state.
   !important is used to beat Elementor kit defaults (.elementor-kit-NN
   button/.elementor-button) that otherwise outrank our plain class
   selector here. We deliberately do NOT include
   `.wc-variation-selection-needed` — WooCommerce adds that class on init
   but does not remove it when a valid variation is found, so using it
   would keep the button looking disabled even after selection. */
.woh-satc-wrapper .woh-satc-submit[disabled],
.woh-satc-wrapper .woh-satc-submit:disabled,
.woh-satc-wrapper .woh-satc-submit.disabled {
    color: #888 !important;
    background: #e5e5e5 !important;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

.woh-satc-wrapper .woh-satc-submit[disabled]:hover,
.woh-satc-wrapper .woh-satc-submit:disabled:hover,
.woh-satc-wrapper .woh-satc-submit.disabled:hover {
    color: #888 !important;
    background: #e5e5e5 !important;
    transform: none;
}

/* Loading state while the AJAX add-to-cart request is in flight. */
.woh-satc-wrapper .woh-satc-submit.loading {
    position: relative;
    cursor: progress !important;
    color: transparent !important;
    pointer-events: none;
    background: #1B2D5B !important;
}

.woh-satc-wrapper .woh-satc-submit.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: woh-satc-spin 0.6s linear infinite;
}

@keyframes woh-satc-spin {
    to { transform: rotate(360deg); }
}

/* Brief confirmation after a successful add. */
.woh-satc-wrapper .woh-satc-submit--added {
    background: #3a7d44 !important;
    color: #fff !important;
}

/* =================================================================
   Grouped product fallback
   ================================================================= */

.woh-satc-wrapper .woh-satc-grouped .group_table {
    width: 100%;
    border-collapse: collapse;
}

.woh-satc-wrapper .woh-satc-grouped .group_table td {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* =================================================================
   Bundle products — the Bundle plugin renders its own <form> inside
   .woh-satc-wrapper (we delegate entirely for bundles). Style its
   output to match the rest of this widget.
   ================================================================= */

/* Bundled item variation selectors (for variable items inside a bundle). */
.woh-satc-wrapper .bundled_item_cart_content .variations,
.woh-satc-wrapper .bundle_form .variations {
    border: none;
    margin: 0 0 8px;
    width: 100%;
}

.woh-satc-wrapper .bundled_item_cart_content .variations tr,
.woh-satc-wrapper .bundle_form .variations tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.woh-satc-wrapper .bundled_item_cart_content .variations th,
.woh-satc-wrapper .bundle_form .variations th {
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1B2D5B;
    text-align: left;
    border: none;
    background: transparent;
}

.woh-satc-wrapper .bundled_item_cart_content .variations td,
.woh-satc-wrapper .bundle_form .variations td {
    padding: 0;
    border: none;
    background: transparent;
}

.woh-satc-wrapper .bundled_item_cart_content .variations select,
.woh-satc-wrapper .bundle_form .variations select {
    width: 100%;
    max-width: 320px;
    height: 44px;
    padding: 0 12px;
    font: inherit;
    font-size: 0.9375rem;
    color: #1B2D5B;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

.woh-satc-wrapper .bundled_item_cart_content .variations select:focus,
.woh-satc-wrapper .bundle_form .variations select:focus {
    border-color: #1B2D5B;
}

/* Bundle quantity input — wrap it like our stepper visually. */
.woh-satc-wrapper .bundle_wrap .quantity input.qty,
.woh-satc-wrapper .bundle_data .quantity input.qty {
    height: 48px;
    width: 64px;
    padding: 0 6px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    color: #1B2D5B;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
}

/* Bundle add-to-cart button. */
.woh-satc-wrapper .bundle_wrap .single_add_to_cart_button,
.woh-satc-wrapper .bundle_form .single_add_to_cart_button {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: #1B2D5B;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 48px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.woh-satc-wrapper .bundle_wrap .single_add_to_cart_button:hover:not(:disabled),
.woh-satc-wrapper .bundle_form .single_add_to_cart_button:hover:not(:disabled) {
    background: #ba5011;
}

/* Bundled item wrapper spacing. */
.woh-satc-wrapper .bundled_product {
    margin-bottom: 16px;
}

/* "Reset" link inside bundle variable items. */
.woh-satc-wrapper .bundled_item_cart_content .reset_variations {
    font-size: 0.8125rem;
    color: #666;
}

/* =================================================================
   Editor placeholder helpers
   ================================================================= */

.woh-satc-wrapper.woh-satc--editor {
    border: 1px dashed #c8c8c8;
    padding: 16px;
    border-radius: 8px;
}

/* =================================================================
   Responsive
   ================================================================= */

@media (max-width: 600px) {
    .woh-satc-wrapper .woh-satc-row {
        flex-direction: column;
    }

    .woh-satc-wrapper .woh-qty-stepper {
        align-self: flex-start;
    }

    .woh-satc-wrapper .woh-satc-submit {
        width: 100%;
        flex: 1 1 100%;
    }
}
