/* Main Container Styles */
html.modal-open, body.modal-open {
    overflow: hidden !important;
    padding-right: var(--scrollbar-width, 0px) !important;
}

.product-type-buffet .price-wrapper {
    display: none;
}

div.product form.cart {
    margin: 0 !important;
    padding: 0 !important;
}

.product-type-buffet button.buffet-popup-trigger {
    padding: 0.25rem;
    border-radius: 4px;
}

/* Popup Modal Styles */
.product-type-buffet .buffet-popup-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.product-type-buffet .buffet-popup-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 550px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.product-type-buffet .buffet-popup-close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    line-height: 1;
    z-index: 1;
}

.product-type-buffet .buffet-popup-close:hover {
    color: #000;
}

.product-type-buffet .buffet-popup-trigger {
    width: 100%;
    margin-bottom: 20px;
}

/* Buffet Options Styles */
.product-type-buffet .buffet-options {
    margin: 0;
}

.product-type-buffet .buffet-options h3 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Updated Addon Styles with Flexbox */
.product-type-buffet .buffet-addon {
    margin: 15px 0;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.product-type-buffet .buffet-addon:hover {
    background: #f5f5f5;
}

/* Buffet Option Groups */
.product-type-buffet .buffet-option-group {
    margin: 20px 0;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.product-type-buffet .buffet-option-label {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.product-type-buffet .buffet-option-label .required {
    color: #dc3232;
    font-weight: bold;
    margin-left: 3px;
}

.product-type-buffet .buffet-option-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.product-type-buffet .buffet-option-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-type-buffet .buffet-option-choice {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.product-type-buffet .buffet-option-choice:hover {
    background: #f5f5f5;
    border-color: #885c2b;
}

.product-type-buffet .buffet-option-choice input[type="radio"] {
    flex: 0 0 auto;
    margin: 3px 10px 0 0;
    cursor: pointer;
}

.product-type-buffet .buffet-option-choice input[type="radio"]:checked + .choice-content {
    font-weight: 600;
}

/* Use class instead of :has() for browser compatibility */
.product-type-buffet .buffet-option-choice.is-selected {
    background: #fff;
    border-color: #885c2b;
    border-width: 2px;
    box-shadow: 0 0 0 1px #885c2b;
}

.product-type-buffet .choice-content {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.product-type-buffet .choice-label {
    flex: 1 1 auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: #333;
    line-height: 1.4;
}

.product-type-buffet .choice-products {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.product-type-buffet .choice-price {
    flex: 0 0 auto;
    font-weight: 600;
    color: #885c2b;
    white-space: nowrap;
}

/* New flexbox layout for labels */
.product-type-buffet .buffet-addon label {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    position: relative;
    min-height: 24px;
}

.product-type-buffet .buffet-addon-checkbox {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    align-self: center;
    margin: 3px 0 0 0 !important;
    position: relative;
    top: 1px;
}

.product-type-buffet .buffet-addon-label {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.product-type-buffet .buffet-addon-price {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    font-weight: 600;
    color: #885c2b;
    white-space: nowrap;
}

.product-type-buffet .buffet-label-and-description {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.buffet-meta-item {
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Quantity Controls */
.product-type-buffet .quantity-control {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
    height: 34px;
}

.product-type-buffet .quantity-control .quantity-button {
    height: 34px;
    background: #f9f9f9;
    color: #666;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0 0.5em;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-type-buffet .quantity-control .quantity-button:hover {
    background: #f1f1f1;
    color: #000;
}

.product-type-buffet .quantity-control .quantity-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.product-type-buffet input[type=number].item-quantity {
    width: 2.5rem;
    text-align: center;
    border: none;
    padding: 0 8px;
    height: 100%;
    margin: 0;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    -moz-appearance: textfield;
    background-color: white;
}

/* Remove spinner buttons */
.product-type-buffet input.item-quantity::-webkit-outer-spin-button,
.product-type-buffet input.item-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Quantity Options */
.product-type-buffet .quantity-options {
    margin-top: 15px;
    padding-left: 25px;
}

.product-type-buffet .quantity-option {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.product-type-buffet .quantity-label label {
    font-weight: bold;
    margin: 0;
}

/* Price Display */
.product-type-buffet .price-summary {
    margin-top: 30px;
}

.product-type-buffet .price-display {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.product-type-buffet .product-price {
    font-size: 24px;
    font-weight: bold;
    color: #885c2b;
}

.product-type-buffet .price-per-person {
    font-size: 16px;
    color: #666;
    margin-left: 10px;
}

/* Price Breakdown */
.product-type-buffet .price-breakdown {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.product-type-buffet .breakdown-title {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* Table-based layout for breakdown items */
.product-type-buffet .breakdown-item {
    display: table;
    width: 100%;
    margin-bottom: 8px;
    padding: 5px 0;
}

.product-type-buffet .breakdown-item > span {
    display: table-cell;
    vertical-align: middle;
}

.product-type-buffet .breakdown-label {
    width: 57%;
    color: #333;
}

.product-type-buffet .breakdown-details {
    width: 28%;
    color: #666;
    font-size: 1rem;
}

.product-type-buffet .breakdown-total {
    width: 15%;
    text-align: right;
    color: #885c2b;
    font-weight: 500;
}

.product-type-buffet .breakdown-total-line {
    display: table;
    width: 100%;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 2px solid #eee;
    font-weight: bold;
}

.product-type-buffet .breakdown-total-line > span {
    display: table-cell;
    vertical-align: middle;
}

.product-type-buffet .breakdown-total-line > span:first-child {
    width: 80%;
}

.product-type-buffet .breakdown-total-line > span:last-child {
    width: 20%;
    text-align: right;
}

/* Divider */
.product-type-buffet .price-summary-divider {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #ddd;
    background-color: transparent;
}

/* Add to Cart Button */
.product-type-buffet .buffet-popup-content .single_add_to_cart_button {
    width: 100%;
    margin-top: 20px;
    padding: 0.25rem;
    font-size: 16px;
    border-radius: 4px;
}

/* Error States */
.product-type-buffet .item-quantity.error {
    border-color: #dc3232;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .product-type-buffet .buffet-popup-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 15px;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .product-type-buffet .buffet-addon label {
        -webkit-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        padding-bottom: 24px;
    }

    .product-type-buffet .buffet-addon-label {
        padding-right: 0;
    }

    .product-type-buffet .buffet-addon-price {
        position: absolute;
        left: 24px;
        top: auto;
        bottom: 0;
    }

    .product-type-buffet .quantity-option {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-type-buffet .breakdown-item {
        display: block;
        margin-bottom: 15px;
    }

    .product-type-buffet .breakdown-item > span {
        display: block;
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }

    .product-type-buffet .breakdown-details {
        font-size: 0.85em;
        color: #666;
    }

    .product-type-buffet .breakdown-total-line {
        display: block;
    }

    .product-type-buffet .breakdown-total-line > span {
        display: block;
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }

    .product-type-buffet .breakdown-total-line > span:last-child {
        text-align: left;
    }

    .product-type-buffet .price-display {
        flex-direction: column;
        text-align: center;
    }

    .product-type-buffet .price-per-person {
        margin-top: 5px;
        margin-left: 0;
        display: block;
    }

    .product-type-buffet .buffet-option-choice {
        padding: 10px;
    }

    .product-type-buffet .choice-content {
        flex-direction: column;
        gap: 8px;
    }

    .product-type-buffet .choice-price {
        align-self: flex-start;
        margin-left: 24px;
    }
}

/* Additional Mobile Optimizations */
@media screen and (max-width: 480px) {
    .product-type-buffet .buffet-popup-content {
        padding: 10px;
    }

    .product-type-buffet .buffet-popup-close {
        right: 10px;
        top: 5px;
    }

    .product-type-buffet .buffet-options h3 {
        font-size: 18px;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .product-type-buffet .buffet-addon {
        padding: 10px;
    }

    .product-type-buffet .product-price {
        font-size: 20px;
    }

    .product-type-buffet .price-per-person {
        font-size: 14px;
    }

    .product-type-buffet .breakdown-item,
    .product-type-buffet .breakdown-total-line {
        font-size: 14px;
    }

    .product-type-buffet .quantity-label label {
        font-size: 14px;
    }

    .product-type-buffet .quantity-control .quantity-button {
        font-size: 16px;
    }

    .product-type-buffet input.item-quantity {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .product-type-buffet .buffet-popup-modal {
        position: static;
        background: none;
        overflow: visible;
    }

    .product-type-buffet .buffet-popup-content {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }

    .product-type-buffet .buffet-popup-close,
    .product-type-buffet .quantity-control .quantity-button,
    .product-type-buffet .single_add_to_cart_button {
        display: none;
    }
}