/* ═══════════════════════════════════════════════════════════════
 * Oral Vitality Variation Swatches — Premium Modular Styles
 * Version: 1.3.0
 * ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --ovvs-primary:          #0B4F4A;
    --ovvs-primary-light:    #0D9488;
    --ovvs-primary-glow:     rgba(11, 79, 74, .1);
    --ovvs-primary-gradient: linear-gradient(135deg, #0B4F4A 0%, #0D9488 100%);
    --ovvs-surface:          #FFFFFF;
    --ovvs-surface-alt:      #F8FAFB;
    --ovvs-border:           #E2E8F0;
    --ovvs-border-hover:     #CBD5E1;
    --ovvs-text:             #0F172A;
    --ovvs-text-secondary:   #475569;
    --ovvs-text-muted:       #94A3B8;
    --ovvs-savings:          #059669;
    --ovvs-savings-bg:       #ECFDF5;
    --ovvs-badge-best:       linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    --ovvs-badge-popular:    linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --ovvs-badge-save:       linear-gradient(135deg, #059669 0%, #10B981 100%);
    --ovvs-radius-card:      12px;
    --ovvs-radius-pill:      50px;
    --ovvs-radius-btn:       50px;
    --ovvs-shadow-sm:        0 1px 3px rgba(0,0,0,.05);
    --ovvs-shadow-md:        0 4px 12px rgba(0,0,0,.05);
    --ovvs-shadow-glow:      0 0 0 3px var(--ovvs-primary-glow), 0 4px 16px rgba(11,79,74,.08);
    --ovvs-font:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ovvs-transition:       .2s cubic-bezier(.4,0,.2,1);
}

/* ── Hide Native Elements Safely ───────────────────────────── */
.ovvs-hidden-select {
    display: none !important;
}

/* ── Variations Table Overrides ────────────────────────────── */
.cart table.variations {
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    margin-bottom: 20px !important;
}

.cart table.variations td,
.cart table.variations th {
    border: none !important;
    background: transparent !important;
    padding: 8px 0 !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
}

.cart table.variations th.label {
    padding-bottom: 4px !important;
}

.cart table.variations th label {
    font-family: var(--ovvs-font);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ovvs-text-secondary);
}

/* ── Clear Variations Link Styling (Below Swatches) ────────── */
.cart .reset_variations {
    display: inline-block !important;
    margin: 10px 0 0 0 !important;
    padding: 5px 14px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .06em !important;
    color: var(--ovvs-text-secondary) !important;
    border: 1px solid var(--ovvs-border) !important;
    border-radius: var(--ovvs-radius-pill) !important;
    background: var(--ovvs-surface) !important;
    transition: all var(--ovvs-transition) !important;
    text-decoration: none !important;
    box-shadow: var(--ovvs-shadow-sm) !important;
    cursor: pointer !important;
    position: static !important; /* Positioned statically below the swatches list */
}

.cart .reset_variations:hover {
    background: var(--ovvs-surface-alt) !important;
    border-color: var(--ovvs-border-hover) !important;
    color: #EF4444 !important; /* Turns red on hover to indicate clear action */
}

/* ── Swatches Wrapper ──────────────────────────────────────── */
.ovvs-swatches-wrap {
    margin-top: 6px;
    font-family: var(--ovvs-font);
}

/* ── Variation Cards (Primary Attribute e.g. Quantity) ─────── */
.ovvs-swatches-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.ovvs-swatches-cards .ovvs-swatch-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--ovvs-surface);
    border: 2px solid var(--ovvs-border);
    border-radius: var(--ovvs-radius-card);
    cursor: pointer;
    transition:
        border-color var(--ovvs-transition),
        box-shadow var(--ovvs-transition),
        transform var(--ovvs-transition),
        background var(--ovvs-transition);
    user-select: none;
    outline: none;
}

.ovvs-swatches-cards .ovvs-swatch-item:hover {
    border-color: var(--ovvs-border-hover);
    background: var(--ovvs-surface-alt);
}

/* Selected State */
.ovvs-swatches-cards .ovvs-swatch-item--selected {
    border-color: var(--ovvs-primary) !important;
    box-shadow: var(--ovvs-shadow-glow) !important;
    background: linear-gradient(135deg, rgba(11,79,74,.01) 0%, rgba(13,148,136,.01) 100%) !important;
}

.ovvs-swatches-cards .ovvs-swatch-item--selected .ovvs-swatch-item__check {
    opacity: 1;
    transform: scale(1);
}

.ovvs-swatches-cards .ovvs-swatch-item--selected .ovvs-swatch-item__radio {
    border-color: var(--ovvs-primary);
    background: var(--ovvs-primary);
}

/* Left side elements */
.ovvs-swatch-item__info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.ovvs-swatch-item__radio {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--ovvs-border);
    flex-shrink: 0;
    transition: border-color var(--ovvs-transition), background var(--ovvs-transition);
}

.ovvs-swatch-item__check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ovvs-primary);
    color: #fff;
    opacity: 0;
    transform: scale(.6);
    transition: opacity var(--ovvs-transition), transform var(--ovvs-transition);
    flex-shrink: 0;
    position: absolute;
    left: 20px;
}

.ovvs-swatch-item__check svg {
    width: 10px;
    height: 10px;
}

.ovvs-swatch-item__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ovvs-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right side pricing */
.ovvs-swatch-item__pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 16px;
}

.ovvs-swatch-item__price {
    font-size: 15px;
    font-weight: 700;
    color: var(--ovvs-text);
}

.ovvs-swatch-item__original {
    font-size: 12px;
    font-weight: 500;
    color: var(--ovvs-text-muted);
    text-decoration: line-through;
}

/* Out of Stock */
.ovvs-swatch-item--out-of-stock {
    opacity: .5;
    pointer-events: none;
}

.ovvs-swatch-item--out-of-stock::after {
    content: 'Out of Stock';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #EF4444;
    background: rgba(255,255,255,.9);
    padding: 3px 8px;
    border-radius: 4px;
}

/* Badges on Cards */
.ovvs-badge {
    position: absolute;
    top: -8px;
    right: 16px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.4;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.ovvs-badge--best { background: var(--ovvs-badge-best); }
.ovvs-badge--popular { background: var(--ovvs-badge-popular); }
.ovvs-badge--save { background: var(--ovvs-badge-save); }

/* ── Swatch Pills (Secondary Attributes e.g. Design/Color) ─── */
.ovvs-swatches-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.ovvs-swatches-pills .ovvs-swatch-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: var(--ovvs-surface);
    border: 1.5px solid var(--ovvs-border);
    border-radius: var(--ovvs-radius-pill);
    cursor: pointer;
    transition: all var(--ovvs-transition);
    user-select: none;
    outline: none;
}

.ovvs-swatches-pills .ovvs-swatch-item:hover {
    border-color: var(--ovvs-border-hover);
    background: var(--ovvs-surface-alt);
}

.ovvs-swatches-pills .ovvs-swatch-item--selected {
    border-color: var(--ovvs-primary) !important;
    background: var(--ovvs-primary) !important;
}

.ovvs-swatches-pills .ovvs-swatch-item--selected .ovvs-swatch-pill__text {
    color: #FFFFFF !important;
}

.ovvs-swatch-pill__text {
    font-size: 13px;
    font-weight: 600;
    color: var(--ovvs-text-secondary);
    transition: color var(--ovvs-transition);
}

/* ── Dynamic Pricing Area (Premium Slate/Black Theme) ─────── */
.ovvs-dynamic-pricing {
    padding: 16px 0;
    margin: 12px 0;
    border-top: 1px solid var(--ovvs-border);
    border-bottom: 1px solid var(--ovvs-border);
    font-family: var(--ovvs-font);
    animation: ovvsFadeIn .3s ease;
}

.ovvs-pricing-current {
    font-size: 28px;
    font-weight: 800;
    color: var(--ovvs-text) !important; /* Premium Slate/Black color, not Gold */
    line-height: 1.2;
    margin-bottom: 4px;
}

.ovvs-pricing-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ovvs-pricing-original {
    font-size: 14px;
    font-weight: 500;
    color: var(--ovvs-text-muted);
    text-decoration: line-through;
}

.ovvs-pricing-savings {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ovvs-savings);
    background: var(--ovvs-savings-bg);
    padding: 3px 10px;
    border-radius: var(--ovvs-radius-pill);
}

/* ── Quantity + Add to Cart Flex Row ───────────────────────── */
.ovvs-action-buttons-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    margin-bottom: 12px !important;
}

/* ── Enhanced Quantity Selector (Fixed 120px width always) ──── */
.cart .quantity.ovvs-qty-enhanced {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #FFFFFF !important;
    border: 1px solid var(--ovvs-border) !important;
    border-radius: var(--ovvs-radius-pill) !important;
    padding: 2px 4px !important;
    width: 120px !important; /* Fixed width across all screen widths */
    max-width: 120px !important;
    height: 48px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    float: none !important;
    flex-shrink: 0 !important;
}

/* Spans inside quantity to act as minus/plus controls */
.cart .quantity.ovvs-qty-enhanced .ovvs-qty-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    background: transparent !important;
    color: var(--ovvs-text-secondary) !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    transition: all var(--ovvs-transition) !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    user-select: none !important;
    font-size: 16px !important;
}

/* Minimal hover without weird shapes */
.cart .quantity.ovvs-qty-enhanced .ovvs-qty-btn:hover {
    background: #F1F5F9 !important;
    color: var(--ovvs-primary) !important;
}

.cart .quantity.ovvs-qty-enhanced .ovvs-qty-btn:active {
    transform: scale(0.92) !important;
}

/* Standard quantity text box */
.cart .quantity.ovvs-qty-enhanced input[type="number"].qty {
    width: 32px !important;
    height: 34px !important;
    border: none !important;
    background: transparent !important;
    text-align: center !important;
    font-family: var(--ovvs-font) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ovvs-text) !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -moz-appearance: textfield !important;
}

.cart .quantity.ovvs-qty-enhanced input[type="number"].qty::-webkit-inner-spin-button,
.cart .quantity.ovvs-qty-enhanced input[type="number"].qty::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* ── Primary Add to Cart Button ────────────────────────────── */
.cart .ovvs-action-buttons-row .single_add_to_cart_button {
    flex: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 48px !important;
    border-radius: var(--ovvs-radius-btn) !important;
    background: var(--ovvs-primary-gradient) !important;
    color: #FFFFFF !important;
    font-family: var(--ovvs-font) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: .02em !important;
    cursor: pointer !important;
    transition: all var(--ovvs-transition) !important;
    border: none !important;
    padding: 0 24px !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(11,79,74,.1) !important;
    float: none !important;
    text-transform: none !important;
}

.cart .ovvs-action-buttons-row .single_add_to_cart_button:hover {
    box-shadow: 0 6px 16px rgba(11,79,74,.2) !important;
    transform: translateY(-1px) !important;
    opacity: 0.95 !important;
}

.cart .ovvs-action-buttons-row .single_add_to_cart_button:active {
    transform: translateY(0) !important;
}

/* ── Stacked Secondary Action Wrapper ──────────────────────── */
.cart .woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-top: 16px !important;
    width: 100% !important;
}

/* Target Subscribe Now or any sibling button to stack cleanly below the row */
.cart .woocommerce-variation-add-to-cart > button,
.cart .woocommerce-variation-add-to-cart > .button,
.cart > button.button.alt,
.cart > .button.alt {
    width: 100% !important;
    height: 48px !important;
    border-radius: var(--ovvs-radius-btn) !important;
    font-family: var(--ovvs-font) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: .02em !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 10px 0 0 0 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all var(--ovvs-transition) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.08) !important;
}

/* Specifically style the subscription button to look cohesive */
.cart .woocommerce-variation-add-to-cart > button:not(.single_add_to_cart_button),
.cart .woocommerce-variation-add-to-cart > .button:not(.single_add_to_cart_button),
.cart > button.button.alt:not(.single_add_to_cart_button) {
    background: #2D6A4F !important; /* Premium dark forest green for subscription */
    color: #FFFFFF !important;
}

.cart .woocommerce-variation-add-to-cart > button:not(.single_add_to_cart_button):hover,
.cart .woocommerce-variation-add-to-cart > .button:not(.single_add_to_cart_button):hover,
.cart > button.button.alt:not(.single_add_to_cart_button):hover {
    background: #1B4332 !important;
    box-shadow: 0 6px 16px rgba(27,67,50,.2) !important;
    transform: translateY(-1px) !important;
}

/* Loading status */
.ovvs-btn-loading {
    position: relative !important;
    color: transparent !important;
    pointer-events: none !important;
}

.ovvs-btn-loading::after {
    content: '' !important;
    position: absolute !important;
    width: 18px !important;
    height: 18px !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: -9px !important;
    margin-left: -9px !important;
    border: 2px solid #FFFFFF !important;
    border-top-color: transparent !important;
    border-radius: 50% !important;
    animation: ovvsSpin 0.8s linear infinite !important;
}

@keyframes ovvsSpin {
    to { transform: rotate(360deg); }
}

/* ── Express Checkout Row ──────────────────────────────────── */
.ovvs-express-checkout-row {
    margin-top: 24px;
    border-top: 1px solid var(--ovvs-border);
    padding-top: 16px;
    font-family: var(--ovvs-font);
    width: 100%;
}

.ovvs-express-label {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.ovvs-express-label::before,
.ovvs-express-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ovvs-border);
}

.ovvs-express-label span {
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ovvs-text-muted);
}

.ovvs-express-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.ovvs-express-buttons > * {
    flex: 1 1 0%;
    min-width: 0;
}

.ovvs-express-buttons iframe,
.ovvs-express-buttons > div,
.ovvs-express-buttons > button {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes ovvsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive Styling ─────────────────────────────────────── */
@media (max-width: 600px) {
    .ovvs-action-buttons-row {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    .cart .quantity.ovvs-qty-enhanced {
        width: 120px !important; /* Keep fixed 120px width even on mobile (centered/left aligned) */
        margin: 0 auto 10px !important; /* Centered in column on mobile */
    }

    .cart .ovvs-action-buttons-row .single_add_to_cart_button {
        width: 100% !important;
        flex: none !important;
    }

    .ovvs-express-buttons {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .ovvs-express-buttons > * {
        width: 100% !important;
    }
}
