/* BundlePress Mix & Match Upsell CSS */

.bundlepress-mixmatch-upsell-wrapper {
    font-family: inherit;
    box-sizing: border-box;
    margin: 24px 0;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Prevent sticky bar overlap */
}
.bundlepress-mixmatch-upsell-wrapper * {
    box-sizing: border-box;
}

.bp-mm-inner {
    padding: 20px;
    background: var(--bp-mm-card-bg, #ffffff);
    border-radius: 16px;
    transition: background 0.2s ease-in-out;
}
.bp-mm-inner:hover {
    background: var(--bp-mm-hover-bg, #f3e8ff);
}

/* Header */
.bp-mm-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Better alignment */
    margin-bottom: 12px;
}
.bp-mm-heading-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bp-mm-dot {
    width: 6px;
    height: 6px;
    background-color: var(--bp-mm-header-color, #6b21a8);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.bp-mm-heading {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--bp-mm-header-color, #6b21a8);
    letter-spacing: 0.1em;
    font-weight: 900;
    margin: 0;
    line-height: 1.2;
}
.bp-mm-header-badge {
    background-color: var(--bp-mm-header-badge-bg, #805ad5);
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}

/* Price row */
.bp-mm-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 4px;
}
.bp-mm-price-final {
    font-size: 24px;
    font-weight: 900;
    color: var(--bp-mm-price-color, #1a202c);
    line-height: 1;
}
.bp-mm-price-regular {
    font-size: 14px;
    color: var(--bp-mm-reg-price-color, #9ca3af);
    text-decoration: line-through;
    margin: 0;
}

/* Tier buttons */
.bp-mm-tiers-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 8px 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
}
.bp-mm-tiers-list::-webkit-scrollbar {
    display: none;
}
.bp-mm-tier-card {
    padding: 12px;
    min-width: 110px;
    border: 2px solid #edf2f7;
    background: #f7fafc;
    border-radius: 12px;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.bp-mm-tier-card.selected {
    border-color: var(--bp-mm-tier-active-border, #9f7aea);
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.bp-mm-tier-min {
    font-size: 14px;
    font-weight: 800;
    color: #a0aec0;
    margin: 0 0 2px 0;
}
.bp-mm-tier-card.selected .bp-mm-tier-min {
    color: var(--bp-mm-tier-active-text, #1a202c);
}
.bp-mm-tier-suffix {
    font-size: 12px;
    font-weight: normal;
}
.bp-mm-tier-disc {
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e0;
    margin: 0;
}
.bp-mm-tier-card.selected .bp-mm-tier-disc {
    color: var(--bp-mm-tier-disc-color, #9f7aea);
}
.bp-mm-tier-check {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #38a169;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
}

/* Products Container Layout */
.bundlepress-mixmatch-layout-grid .bp-mm-products-container {
    display: grid;
    grid-template-columns: repeat(var(--bp-mm-cols, 2), minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.bundlepress-mixmatch-layout-list .bp-mm-products-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .bundlepress-mixmatch-layout-grid .bp-mm-products-container {
        grid-template-columns: repeat(min(var(--bp-mm-cols, 2), 2), minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    .bundlepress-mixmatch-layout-grid .bp-mm-products-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* Select Dropdown styling matching Chakra UI <Select size="sm"> */
.bp-mm-var-select {
    width: 100%;
    height: 38px;
    min-height: 38px;
    padding: 0 32px 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: #1a202c;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg stroke='%234A5568' fill='none' stroke-width='2' viewBox='0 0 24 24' stroke-linecap='round' stroke-linejoin='round' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    border: 1.5px solid #cbd5e0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-top: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}
.bp-mm-var-select:hover {
    border-color: #805ad5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.bp-mm-var-select:focus {
    border-color: #805ad5;
    box-shadow: 0 0 0 1px #805ad5;
}

/* Product Card - List View */
.bundlepress-mixmatch-layout-list .bp-mm-product-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #edf2f7;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-card:last-child {
    border-bottom: none;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-thumb {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 10px;
    overflow: hidden;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    flex-shrink: 0;
    position: relative;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-details {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--bp-mm-name-color, #374151);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.bundlepress-mixmatch-layout-list .bp-mm-product-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--bp-mm-price-text-color, #6b7280);
    white-space: nowrap;
}
.bundlepress-mixmatch-layout-list .bp-mm-var-select {
    width: auto;
    min-width: 120px;
    max-width: 180px;
    font-size: 11px;
}
/* In list mode the actions column should be fixed-width, not 100% */
.bundlepress-mixmatch-layout-list .bp-mm-product-actions {
    flex-shrink: 0;
    width: auto;
    min-width: 120px;
    margin-top: 0;
}
.bundlepress-mixmatch-layout-list .bp-mm-add-btn {
    width: 100%;
    white-space: nowrap;
}
.bundlepress-mixmatch-layout-list .bp-mm-qty-controls {
    justify-content: flex-end;
}

/* Product Card - Grid View */
.bundlepress-mixmatch-layout-grid .bp-mm-product-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    border-radius: 16px;
    border: 2px solid #edf2f7;
    background: #ffffff;
    padding: 12px;
    position: relative;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    min-width: 0;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-color: #ddd6fe;
    transform: translateY(-2px);
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-card.selected {
    border-color: var(--bp-mm-tier-active-border, #9f7aea);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-card.selected:hover {
    border-color: var(--bp-mm-tier-active-border, #9f7aea);
    transform: translateY(-2px);
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-thumb {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f7fafc;
    position: relative;
    margin-bottom: 12px;
    border: 1px solid #edf2f7;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-thumb img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-thumb img:hover {
    transform: scale(1.05);
}
.bp-mm-thumb-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #cbd5e0;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    min-width: 0;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--bp-mm-name-color, #374151);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
}
.bundlepress-mixmatch-layout-grid .bp-mm-product-price {
    font-size: 14px;
    font-weight: 900;
    color: var(--bp-mm-price-text-color, #6b7280);
}

.bp-mm-item-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--bp-mm-qty-btn-add-color, #805ad5);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    z-index: 2;
}

/* Actions & Quantity Controls */
.bp-mm-product-actions {
    margin-top: auto;
    width: 100%;
}
.bp-mm-add-btn {
    width: 100%;
    min-height: 32px;
    padding: 4px;
    border-radius: 12px;
    background-color: var(--bp-mm-add-deal-bg, #f3f4f6);
    color: var(--bp-mm-add-deal-color, #805ad5);
    font-weight: 800;
    font-size: 11px;
    line-height: 1.2;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s ease;
    text-align: center;
}
.bp-mm-add-btn:hover {
    background-color: var(--bp-mm-add-deal-color, #805ad5);
    color: #ffffff;
    transform: scale(1.02);
}

.bundlepress-mixmatch-layout-grid .bp-mm-qty-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bp-mm-qty-btn-bg, #f3f4f6);
    padding: 2px;
    border-radius: 12px;
    border: 1px solid var(--bp-mm-tier-active-border, #9f7aea);
    width: 100%;
    min-height: 32px;
    box-sizing: border-box;
}
.bundlepress-mixmatch-layout-list .bp-mm-qty-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bp-mm-qty-btn-bg, #f3f4f6);
    padding: 4px 8px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
}
.bp-mm-qty-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    border-radius: 8px;
    border: none !important;
    background: transparent;
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s ease;
    flex-shrink: 0;
    line-height: 1 !important;
    box-shadow: none;
}
.bundlepress-mixmatch-layout-list .bp-mm-qty-btn {
    border-radius: 9999px;
}
.bp-mm-qty-btn.bp-mm-minus {
    color: #4a5568;
}
.bp-mm-qty-btn.bp-mm-minus:hover {
    background: #ffffff;
    color: #e53e3e;
}
.bp-mm-qty-btn.bp-mm-plus {
    background-color: var(--bp-mm-qty-btn-add-color, #805ad5);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.bp-mm-qty-btn.bp-mm-plus:hover:not(:disabled) {
    opacity: 0.9;
}
.bp-mm-qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.bp-mm-qty-count {
    font-size: 11px;
    font-weight: 800;
    color: #1a202c;
    white-space: nowrap;
    line-height: 1;
    margin: 0;
    padding: 0 2px;
    text-align: center;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer Bar */
.bp-mm-footer-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background-color: var(--bp-mm-bar-bg, #f9fafb);
    border-radius: 16px;
    border: 1px solid #edf2f7;
    margin-top: 16px;
}
.bp-mm-bar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bp-mm-bar-label {
    font-size: 12px;
    font-weight: 900;
    color: var(--bp-mm-bar-text, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bp-mm-bar-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--bp-mm-bar-text, #6b7280);
}

.bp-mm-submit-btn {
    width: 100%;
    height: 50px;
    border-radius: 12px;
    background-color: var(--bp-mm-btn-bg, #805ad5);
    color: var(--bp-mm-btn-color, #ffffff);
    font-weight: 900;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}
.bp-mm-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
}
.bp-mm-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: none;
}

/* Extra Mobile Tweaks for 600px */
@media (max-width: 600px) {
    .bp-mm-inner {
        padding: 12px;
    }
    .bundlepress-mixmatch-layout-grid .bp-mm-product-card {
        padding: 8px;
        border-radius: 12px;
    }
    .bundlepress-mixmatch-layout-grid .bp-mm-product-name {
        font-size: 13px;
    }
    .bp-mm-add-btn {
        height: 32px;
        font-size: 11px;
    }
    .bp-mm-price-final {
        font-size: 20px;
    }
    .bp-mm-footer-bar {
        padding: 12px;
    }
}

