:root {
    --wpcpq-active: #cc99c2;
}

.wpcpq-table .wpcpq-row {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px dashed #e5e5e5;
}

.wpcpq-table .wpcpq-row:last-child {
    border-bottom: none;
}

.wpcpq-table .wpcpq-row > div {
    flex: 1 1 0;
    width: 0;
}

.wpcpq-table .wpcpq-row.wpcpq-head, .wpcpq-table .wpcpq-row.wpcpq-foot {
    font-weight: 700;
}

.wpcpq-table .wpcpq-item-active {
    background: var(--wpcpq-active);
    color: #fff;
}

.wpcpq-table.wpcpq-tiered .wpcpq-summary .wpcpq-summary-info {
    flex-direction: column;
    flex-basis: 100%;
    flex: 2;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px dashed #e5e5e5;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item:last-child {
    border-bottom: none;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item.wpcpq-item-default {
    display: none !important;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item .wpcpq-item-info {
    flex-grow: 1;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item .wpcpq-item-info .wpcpq-item-qty {
    font-weight: 700;
}

.wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item .add_to_cart_inline, .wpcpq-table.wpcpq-layout-quick_buy .wpcpq-item .wpcpq-item-atc-btn {
    margin: 0 !important;
}

.wpcpq-table.wpcpq-layout-compact {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-left: -5px;
    margin-right: -5px;
}

.wpcpq-table.wpcpq-layout-compact .wpcpq-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    width: calc(25% - 10px);
    min-width: 120px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    margin: 5px;
    padding: 10px;
}

.wpcpq-table.wpcpq-layout-compact .wpcpq-item > div {
    width: 100%;
    flex: 0 0 100%;
}

.wpcpq-table.wpcpq-layout-compact .wpcpq-item .wpcpq-item-qty {
    font-weight: 700;
}

.wpcpq-table.wpcpq-layout-compact .wpcpq-summary {
    width: 100%;
    margin: 5px;
}

.wpcpq-table.wpcpq-click-yes .wpcpq-item {
    cursor: pointer;
}

.wpcpq-table.wpcpq-hide-first-row-yes .wpcpq-item-default {
    display: none;
}

/* Searchable Repeater UI Styles */
.product.type-product, 
.summary.entry-summary,
.wpcpq-wrap,
.wpcpq-distribution-wrap,
.wpcpq-repeater-container,
.wpcpq-repeater-row {
    overflow: visible !important;
}

.wpcpq-distribution-wrap {
    background: transparent !important;
    position: relative;
    z-index: 99;
}

.wpcpq-repeater-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr 140px;
    gap: 20px;
    align-items: end;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 20px 45px 20px 0 !important;
    transition: background 0.2s;
    position: relative;
    z-index: 10;
}

.wpcpq-repeater-row:hover,
.wpcpq-repeater-row:focus-within {
    z-index: 100 !important;
}

.wpcpq-repeater-row:last-child {
    border-bottom: none;
}

.wpcpq-repeater-col {
    position: relative !important;
    min-width: 0 !important;
}

/* Custom Searchable Select */
.wpcpq-select-trigger {
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    z-index: 5;
}

.wpcpq-select-trigger:hover {
    border-color: var(--e-global-color-primary, #cc99c2) !important;
}

.wpcpq-select-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    border: 1px solid #eee !important;
    z-index: 999 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    margin-top: 2px !important;
    display: none;
    animation: wpcpqFadeIn 0.2s ease;
}

@keyframes wpcpqFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.wpcpq-options-list {
    max-height: 400px !important;
    overflow-y: auto !important;
}

.wpcpq-attr-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9em;
    color: #444;
}

.wpcpq-attr-option:hover {
    background: #f9f9f9;
    color: var(--e-global-color-primary, #cc99c2);
}

.wpcpq-attr-search {
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    font-size: 0.9em !important;
    border-radius: 4px !important;
    margin: 0 !important;
    background: #fff !important;
    color: #333 !important;
    box-shadow: none !important;
}

.wpcpq-attr-search:focus {
    border-color: var(--e-global-color-primary, #cc99c2) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(204, 153, 194, 0.1) !important;
}

/* Quantity Controls with SVG Icons */
.wpcpq-qty-input-wrap button:hover {
    background: #f5f5f5 !important;
}

.wpcpq-qty-input-wrap button svg {
    transition: transform 0.2s;
}

.wpcpq-qty-input-wrap button:active svg {
    transform: scale(0.9);
}

.wpcpq-matrix-qty::-webkit-inner-spin-button,
.wpcpq-matrix-qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wpcpq-remove-row:hover {
    color: #f44336 !important;
}

.wpcpq-repeater-col-remove {
    position: absolute !important;
    top: 20px !important;
    right: 5px !important;
    z-index: 10;
    width: 32px !important;
    height: 32px !important;
    background: #fcfcfc !important;
    border: 1px solid #eee !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #999 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
    transition: all 0.2s ease !important;
}

.wpcpq-repeater-col-remove:hover {
    background: #fff5f5 !important;
    border-color: #ffcdd2 !important;
    color: #f44336 !important;
}

.wpcpq-repeater-col-remove label {
    display: none !important;
}

.wpcpq-repeater-col-remove svg {
    width: 14px !important;
    height: 14px !important;
}

.wpcpq-add-variation-row:hover {
    background: rgba(204, 153, 194, 0.05) !important;
    transform: translateY(-1px);
}

.wpcpq-dist-status {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 15px;
}

/* Hide spin buttons */
.wpcpq-matrix-qty::-webkit-outer-spin-button,
.wpcpq-matrix-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.wpcpq-matrix-qty[type=number] {
  -moz-appearance: textfield;
}

/* Repeater Qty Button Styling */
.wpcpq-qty-input-wrap {
    display: flex !important;
    align-items: center;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    overflow: hidden;
    height: 44px !important;
    background: #fff !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.wpcpq-qty-input-wrap .wpcpq-qty-minus,
.wpcpq-qty-input-wrap .wpcpq-qty-plus {
    width: 44px !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fbfbfb !important;
    border: none !important;
    cursor: pointer !important;
    color: #444 !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.wpcpq-qty-input-wrap .wpcpq-qty-minus:hover,
.wpcpq-qty-input-wrap .wpcpq-qty-plus:hover {
    background: #f0f0f0 !important;
    color: var(--e-global-color-primary, #cc99c2) !important;
}

.wpcpq-qty-input-wrap .wpcpq-matrix-qty {
    flex: 1 !important;
    min-width: 0 !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #eee !important;
    border-right: 1px solid #eee !important;
    padding: 0 5px !important;
    margin: 0 !important;
    font-weight: 500 !important;
    font-size: 1em !important;
    height: 100% !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    background: #fff !important;
    color: #333 !important;
    border-radius: 0 !important;
}

/* Mobile Responsiveness for Repeater */
/* Mobile Responsiveness for Repeater */
/* Mobile Responsiveness for Repeater */
/* Mobile Responsiveness for Repeater */
@media screen and (max-width: 768px) {
    .wpcpq-repeater-row {
        display: block !important;
        padding: 20px 0 !important;
        padding-right: 45px !important; /* Reserved space for the delete button */
        border-bottom: 2px solid #f8f8f8 !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 0 !important;
        position: relative !important;
    }
    
    .wpcpq-repeater-col,
    .wpcpq-repeater-col-qty {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 15px !important;
        gap: 15px;
    }
    
    .wpcpq-repeater-col:last-child {
        margin-bottom: 0 !important;
    }
    
    .wpcpq-repeater-col label,
    .wpcpq-repeater-col-qty label {
        margin-bottom: 0 !important;
        flex: 0 0 80px !important;
        font-size: 0.85em !important;
    }
    
    .wpcpq-searchable-select,
    .wpcpq-qty-input-wrap {
        flex: 1 !important;
        max-width: 100% !important; /* Fill the remaining space */
    }
    
    .wpcpq-repeater-col-remove {
        top: 20px !important;
        right: 5px !important;
    }
    
    .wpcpq-dist-status {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px;
    }
    
    span.wpcpq-status-msg {
        margin: 0 !important;
    }
}

.wpcpq-matrix-table-container::-webkit-scrollbar {
    width: 6px;
}
.wpcpq-matrix-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.wpcpq-matrix-table-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.wpcpq-stock-warning {
    background: #fff5f5;
    padding: 10px 15px !important;
    border-left: 3px solid #d32f2f;
    border-radius: 0 4px 4px 0;
}

/* Mobile Optimization */
@media screen and (max-width: 600px) {
    .wpcpq-matrix-row td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0 !important;
    }
}
/* Multi-Choice Option Styles */
.wpcpq-item-checkbox {
    margin-right: 12px !important;
    cursor: pointer;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid #ddd !important;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff !important;
    vertical-align: middle;
}

.wpcpq-item-checkbox:checked {
    background-color: var(--wpcpq-active, #cc99c2) !important;
    border-color: var(--wpcpq-active, #cc99c2) !important;
}

.wpcpq-item-checkbox:checked::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.wpcpq-item-checkbox:hover {
    border-color: var(--wpcpq-active, #cc99c2) !important;
    transform: scale(1.05);
}

.wpcpq-item-active .wpcpq-item-checkbox {
    border-color: #fff !important;
}

/* Side Image Styling */
.wpcpq-repeater-row img {
    width: 50px !important;
    height: 50px !important;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    margin-right: 15px;
}

/* Responsive adjustment for checkbox */
@media screen and (max-width: 600px) {
    .wpcpq-item-qty {
        display: flex;
        align-items: center;
    }
}
