.rayehe-atc {
    --ratc-primary: var(--wd-primary-color, var(--e-global-color-primary, #052A60));
    --ratc-text: var(--wd-title-color, #111827);
    --ratc-muted: #6b7280;
    --ratc-border: #e5e7eb;
    --ratc-surface: #ffffff;
    --ratc-soft: #f8fafc;
    --ratc-danger: #b42318;
    --ratc-success: #067647;
    width: 100%;
    box-sizing: border-box;
    direction: rtl;
    color: var(--ratc-text);
    font: inherit;
}

.rayehe-atc *,
.rayehe-atc *::before,
.rayehe-atc *::after {
    box-sizing: border-box;
}

.rayehe-atc__top,
.rayehe-atc__weight-row,
.rayehe-atc__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.rayehe-atc__top {
    margin-bottom: 14px;
}

.rayehe-atc__heading,
.rayehe-atc__unit-price,
.rayehe-atc__summary-label {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rayehe-atc__title,
.rayehe-atc__summary-label > span {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
}

.rayehe-atc__range,
.rayehe-atc__unit-price > span,
.rayehe-atc__summary-label small,
.rayehe-atc__hint {
    color: var(--ratc-muted);
    font-size: 12px;
    line-height: 1.7;
}

.rayehe-atc__unit-price {
    align-items: flex-end;
    text-align: left;
}

.rayehe-atc__unit-price strong,
.rayehe-atc__total {
    color: var(--ratc-text);
    font-weight: 800;
    white-space: nowrap;
}

.rayehe-atc__unit-price strong {
    font-size: 17px;
    line-height: 1.45;
}

.rayehe-atc__total {
    font-size: 15px;
    transition: color .18s ease, transform .18s ease, opacity .18s ease;
    transform-origin: center;
}

.rayehe-atc__total.is-changing {
    color: var(--ratc-primary);
    transform: translateY(-1px) scale(1.015);
    opacity: .82;
}

.rayehe-atc__weight-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
}

.rayehe-atc__quick-weights {
    width: 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 1px 0 3px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.rayehe-atc__quick-weights::-webkit-scrollbar {
    display: none;
}

.rayehe-atc__quick-weight {
    flex: 1 0 0;
    min-width: 68px;
    min-height: 38px;
    margin: 0;
    padding: 0 9px;
    border: 1px solid var(--ratc-border);
    border-radius: 10px;
    background: var(--ratc-surface);
    color: var(--ratc-text);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .15s ease;
}

.rayehe-atc__quick-weight:hover:not(:disabled):not(.is-active) {
    border-color: color-mix(in srgb, var(--ratc-primary) 42%, var(--ratc-border));
    background: color-mix(in srgb, var(--ratc-primary) 4%, #fff);
    color: var(--ratc-text) !important;
}

.rayehe-atc__quick-weight:active:not(:disabled) {
    transform: translateY(1px);
}

.rayehe-atc__quick-weight.is-active,
.rayehe-atc__quick-weight.is-active:hover,
.rayehe-atc__quick-weight.is-active:focus {
    border-color: var(--ratc-primary);
    background: color-mix(in srgb, var(--ratc-primary) 9%, #fff);
    color: var(--ratc-primary) !important;
}

.rayehe-atc__quick-weight:disabled {
    opacity: .42;
    cursor: not-allowed;
}

.rayehe-atc__stepper {
    width: 100%;
    min-height: 52px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--ratc-border);
    border-radius: 12px;
    background: var(--ratc-surface);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.rayehe-atc__stepper:focus-within {
    border-color: var(--ratc-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ratc-primary) 12%, transparent);
}

.rayehe-atc__step {
    width: 48px;
    min-width: 48px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--ratc-soft);
    color: var(--ratc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .2s ease, opacity .2s ease;
}

.rayehe-atc__step:hover:not(:disabled),
.rayehe-atc__step:focus:not(:disabled) {
    background: color-mix(in srgb, var(--ratc-primary) 8%, #fff);
    color: var(--ratc-primary) !important;
}

.rayehe-atc__step:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.rayehe-atc__step svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor !important;
    stroke-width: 2;
    stroke-linecap: round;
}

.rayehe-atc__input-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 8px;
    background: var(--ratc-surface);
}

.rayehe-atc__input {
    width: 82px;
    min-width: 0;
    height: 50px;
    padding: 0;
    margin: 0;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--ratc-text);
    font: inherit;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    text-align: left;
    direction: ltr;
    appearance: textfield;
    -moz-appearance: textfield;
}

.rayehe-atc__input::-webkit-outer-spin-button,
.rayehe-atc__input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.rayehe-atc__suffix {
    color: var(--ratc-muted);
    font-size: 13px;
    font-weight: 600;
}

.rayehe-atc__summary {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--ratc-soft);
}

.rayehe-atc__feedback {
    min-height: 24px;
    padding-top: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.7;
}

/* Do not reserve vertical space when there is no inline feedback message. */
.rayehe-atc__feedback:empty {
    display: none;
}

.rayehe-atc__feedback.is-error {
    color: var(--ratc-danger);
}

.rayehe-atc__feedback.is-success {
    color: var(--ratc-success);
}

.rayehe-atc__submit,
.rayehe-atc__cart-link {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rayehe-atc__submit {
    position: relative;
    padding: 0 18px;
    border: 1px solid var(--ratc-primary);
    background: var(--ratc-primary);
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease, opacity .2s ease, filter .2s ease;
}

.rayehe-atc__submit:hover:not(:disabled) {
    filter: brightness(.94);
}

.rayehe-atc__submit:active:not(:disabled) {
    transform: translateY(1px);
}

.rayehe-atc__submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* The custom CTA owns the cart/view-cart state. Never reserve space for or show
   WooCommerce's automatically injected secondary "View cart" link here. */
.rayehe-atc > a.added_to_cart.wc-forward,
.rayehe-atc .added_to_cart.wc-forward {
    display: none !important;
}

.rayehe-atc__spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rayehe-atc-spin .7s linear infinite;
}

.rayehe-atc.is-loading .rayehe-atc__spinner {
    display: inline-block;
}

.rayehe-atc__cart-link {
    min-height: 42px;
    margin-top: 8px;
    border: 1px solid var(--ratc-border);
    background: transparent;
    color: var(--ratc-primary) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.rayehe-atc__cart-link.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rayehe-atc.has-error .rayehe-atc__stepper {
    border-color: color-mix(in srgb, var(--ratc-danger) 55%, var(--ratc-border));
}

.rayehe-atc-unit-label {
    font-size: .78em;
    font-weight: 500;
    white-space: nowrap;
}

.rayehe-cart-weight,
.rayehe-mini-cart-weight {
    white-space: nowrap;
}

.rayehe-atc-admin-note,
.rayehe-atc__unavailable {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--ratc-border, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    color: #475467;
    font-size: 13px;
}

@keyframes rayehe-atc-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .rayehe-atc__top {
        align-items: flex-start;
    }

    .rayehe-atc__unit-price {
        max-width: 48%;
    }

    .rayehe-atc__stepper {
        grid-template-columns: 46px minmax(0, 1fr) 46px;
    }

    .rayehe-atc__step {
        width: 46px;
        min-width: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rayehe-atc *,
    .rayehe-atc *::before,
    .rayehe-atc *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* v1.0.1: isolated container preview. It never overlays or replaces the site gallery. */
.rayehe-atc__preview {
    width: 100%;
    margin: 0 0 14px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--ratc-border);
    border-radius: 12px;
    background: var(--ratc-soft);
}

.rayehe-atc__preview-media {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
    background: var(--ratc-surface);
}

.rayehe-atc__preview-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    margin: 0;
    padding: 0;
    border: 0;
}

.rayehe-atc__preview-label {
    min-width: 0;
    color: var(--ratc-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
}

.rayehe-atc__preview.is-empty {
    display: none;
}

/* Keep gallery thumbnails at the same five-column size even when stock rules
   hide some container images. Fewer items leave empty columns instead of growing. */
.rayehe-atc-gallery .flex-control-thumbs,
.rayehe-atc-gallery .woocommerce-product-gallery__thumbnails {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    align-items: start;
}

.rayehe-atc-gallery .flex-control-thumbs > li,
.rayehe-atc-gallery .woocommerce-product-gallery__thumbnails > * {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    float: none !important;
}


/* Product brand logo shortcode: [rayehe_brand_logo] */
.rayehe-brand-logo {
    --rayehe-brand-logo-width: 120px;
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
    line-height: 1;
}

.rayehe-brand-logo__image {
    display: block;
    width: min(var(--rayehe-brand-logo-width), 100%);
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.rayehe-brand-logo__name {
    color: inherit;
    font: inherit;
    line-height: 1.6;
}
