/* Maestro Pizza & Panzarotti Builder Styles */
.maestro-pizza-builder,
.maestro-panzarotti-builder {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.maestro-pizza-builder *,
.maestro-panzarotti-builder * {
    box-sizing: border-box;
}

.maestro-pizza-builder h2,
.maestro-panzarotti-builder h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

/* Builder Sections */
.builder-section,
.maestro-sizes,
.maestro-toppings {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

.section-title,
.maestro-sizes h3,
.maestro-toppings h3,
.maestro-topping-section h4 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #c41e3a;
}

/* Size Selection - Card Style */
.maestro-sizes .size-grid,
.size-options,
.style-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 600px) {
    .maestro-sizes .size-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.size-option,
.style-option,
.maestro-size-option {
    position: relative;
}

.size-option input,
.style-option input,
.maestro-size-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Maestro Size Option - Card Style Labels */
.maestro-size-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.maestro-size-option label:hover {
    border-color: #c41e3a;
    background: #fff5f5;
}

.maestro-size-option input:checked + label {
    border-color: #c41e3a;
    background: #c41e3a;
    color: #fff;
}

.maestro-size-option input:checked + label .topping-price-hint {
    color: rgba(255,255,255,0.9);
}

.maestro-size-option .topping-price-hint {
    font-size: 11px;
    font-weight: normal;
    color: #666;
    display: block;
    margin-top: 4px;
}

/* Size options grid layout */
.maestro-sizes {
    display: block;
}

.maestro-sizes .maestro-size-option {
    display: inline-block;
    width: calc(50% - 6px);
    margin-bottom: 12px;
    vertical-align: top;
}

.maestro-sizes .maestro-size-option:nth-child(odd) {
    margin-right: 12px;
}

@media (min-width: 600px) {
    .maestro-sizes .maestro-size-option {
        width: calc(25% - 9px);
        margin-right: 12px;
    }

    .maestro-sizes .maestro-size-option:nth-child(4n) {
        margin-right: 0;
    }

    .maestro-sizes .maestro-size-option:nth-child(odd) {
        margin-right: 12px;
    }
}

.size-option .option-card,
.style-option .option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.size-option .option-card:hover,
.style-option .option-card:hover {
    border-color: #c41e3a;
    background: #fff5f5;
}

.size-option input:checked + .option-card,
.style-option input:checked + .option-card {
    border-color: #c41e3a;
    background: #c41e3a;
    color: #fff;
}

.size-option input:checked + .option-card .option-price,
.style-option input:checked + .option-card .option-desc {
    color: rgba(255,255,255,0.9);
}

.option-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.option-price,
.option-desc {
    font-size: 12px;
    color: #666;
}

.option-slices {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Toppings Grid */
.maestro-topping-list,
.toppings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 600px) {
    .maestro-topping-list,
    .toppings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Topping Items - Card Style */
.maestro-topping-item,
.topping-item {
    position: relative;
}

/* Show checkbox for toppings - input is inside label so :checked+label won't work */
.maestro-topping-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: #c41e3a;
    cursor: pointer;
    flex-shrink: 0;
}

/* Note: .topping-item checkboxes are styled in combo-builder.css */

.maestro-topping-item label,
.topping-card {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    word-break: break-word;
    overflow: hidden;
}

.maestro-topping-item label:hover,
.topping-item:hover .topping-card {
    border-color: #c41e3a;
    background: #fff5f5;
}

/* Highlight selected topping items */
.maestro-topping-item:has(input:checked) label {
    border-color: #c41e3a;
    background: #fff5f5;
}

.maestro-topping-item input:checked + label,
.topping-item input:checked + .topping-card {
    border-color: #c41e3a;
    background: #c41e3a;
    color: #fff;
}

.maestro-topping-item input:checked + label .premium-badge,
.topping-item input:checked + .topping-card .premium-badge {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

/* Premium Toppings */
.maestro-topping-item.premium label,
.topping-item.premium .topping-card {
    border-color: #d4af37;
    background: #fffef5;
}

.maestro-topping-item.premium input:checked + label,
.topping-item.premium input:checked + .topping-card {
    background: #d4af37;
    border-color: #d4af37;
}

.premium-badge {
    background: #d4af37;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.premium-title {
    color: #d4af37;
    font-size: 14px;
    font-weight: 600;
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #d4af37;
}

.premium-note {
    font-weight: normal;
    color: #888;
    font-size: 12px;
}

/* Toppings Counter */
.toppings-counter,
.topping-counter-display {
    background: #fff3e0;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.counter-value {
    font-size: 18px;
    font-weight: 700;
    color: #e65100;
}

/* Notes Section */
.topping-note,
.topping-pricing-note {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 6px;
}

/* Special Instructions */
.special-instructions {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 80px;
}

.special-instructions:focus {
    outline: none;
    border-color: #c41e3a;
}

/* Base Toppings Info */
.base-toppings-info {
    background: #f0f9f0;
    border: 1px solid #c8e6c9;
}

.base-toppings-info .section-title {
    border-bottom-color: #4caf50;
}

.included-list {
    margin: 0;
    color: #2e7d32;
    font-weight: 500;
}

/* Free Badge */
.free-badge {
    background: #4caf50;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* Price Summary */
.builder-summary,
.maestro-price-display {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    position: sticky;
    top: 20px;
    max-width: 100%;
}

@media (max-width: 767px) {
    .maestro-price-display {
        position: static;
    }
}

/* Toppings Summary List */
.maestro-pricing-summary h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 10px;
}

/* Summary Sections - Match combo builder style */
.maestro-pricing-summary .summary-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.maestro-pricing-summary .summary-section:last-of-type {
    border-bottom: none;
}

.maestro-pricing-summary .summary-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
}

.maestro-pricing-summary .summary-section .summary-value {
    font-size: 14px;
    color: #333;
    margin: 0;
    font-weight: 500;
}

.maestro-pricing-summary .summary-section .no-selection {
    color: #999;
    font-style: italic;
    font-size: 13px;
    margin: 0;
}

.maestro-pricing-summary .summary-section .selected-toppings-list {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
}

.maestro-pricing-summary .summary-section .selected-toppings-list li {
    font-size: 13px;
    color: #333;
    padding: 2px 0;
}

.maestro-pricing-summary .summary-section .premium-tag {
    color: #d4af37;
    font-weight: 600;
    font-size: 11px;
}

.maestro-pricing-summary .summary-section .toppings-count-summary {
    font-size: 12px;
    color: #666;
    margin: 8px 0 0 0;
    padding: 6px 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* Summary Total */
.maestro-pricing-summary .summary-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #c41e3a;
}

.maestro-pricing-summary .summary-total .total-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.maestro-pricing-summary .summary-total .grand-total {
    font-size: 18px;
    color: #c41e3a;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}

.maestro-pricing-summary .summary-total .total-price {
    font-size: 18px;
    font-weight: 700;
    color: #c41e3a;
}

/* Legacy styles for backwards compatibility */
.toppings-list {
    margin: 15px 0;
}

.toppings-list ul {
    margin: 0;
    padding: 0 0 0 20px;
    list-style: disc;
}

.toppings-list li {
    padding: 4px 0;
    font-size: 14px;
    color: #333;
}

.toppings-list .premium {
    color: #d4af37;
    font-weight: 600;
    font-size: 12px;
}

.summary-row,
.price-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.summary-row:last-child,
.price-line:last-child {
    border-bottom: none;
}

.total-row {
    font-size: 18px;
    font-weight: 700;
    color: #c41e3a;
    border-top: 2px solid #c41e3a;
    margin-top: 10px;
    padding-top: 15px;
}

.price-total {
    font-size: 24px;
    font-weight: 700;
    color: #c41e3a;
}

/* Add to Cart Button */
.builder-actions,
.maestro-builder-right {
    margin-top: 20px;
}

.btn-add-panzarotti,
.maestro-add-to-cart {
    display: block;
    width: 100%;
    padding: 16px 30px;
    font-size: 18px;
    font-weight: 600;
    background: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-add-panzarotti:hover,
.maestro-add-to-cart:hover {
    background: #a01830;
}

.btn-add-panzarotti:disabled,
.maestro-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Status Messages */
.builder-status {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}

.builder-status.success {
    color: #28a745;
}

.builder-status.error {
    color: #dc3545;
}

/* Combo Info Box */
.combo-size-info {
    background: #e3f2fd;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #1976d2;
    margin-bottom: 20px;
    font-size: 14px;
    color: #1565c0;
}

/* Grid Layout */
.maestro-builder-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 100%;
    overflow: hidden;
}

.maestro-builder-left,
.maestro-builder-right {
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 768px) {
    .maestro-builder-grid {
        grid-template-columns: 2fr 1fr;
    }

    .maestro-price-display {
        position: sticky;
        top: 20px;
    }
}

/* Hide WooCommerce default elements */
.maestro-pizza-builder ~ form.cart,
.maestro-pizza-builder ~ .cart,
.maestro-panzarotti-builder ~ form.cart,
.maestro-panzarotti-builder ~ .cart,
form.cart:not(.maestro-builder-form),
.single_add_to_cart_button:not(.maestro-add-to-cart):not(.btn-add-panzarotti),
form.variations_form {
    display: none !important;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    .maestro-pizza-builder,
    .maestro-panzarotti-builder {
        padding: 10px;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    .maestro-builder-grid {
        gap: 15px;
    }

    .builder-section,
    .maestro-sizes,
    .maestro-toppings {
        padding: 15px;
        margin-bottom: 15px;
    }

    .maestro-pizza-builder .combo-summary-panel {
        padding: 15px;
    }

    .option-name {
        font-size: 13px;
    }

    .option-price {
        font-size: 11px;
    }
}

/* Crust Selection Styles */
.maestro-crust-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

.maestro-crust-section h3 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #c41e3a;
}

.crust-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.crust-option {
    flex: 1;
    min-width: 140px;
    position: relative;
}

.crust-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.crust-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.crust-option label:hover {
    border-color: #c41e3a;
    background: #fff5f5;
}

.crust-option input[type="radio"]:checked + label {
    border-color: #c41e3a;
    background: #c41e3a;
    color: #fff;
}

@media (max-width: 600px) {
    .crust-options {
        flex-direction: column;
    }

    .crust-option {
        min-width: auto;
    }
}

/* Combo-Style Summary Panel for Pizza Builder */
.maestro-pizza-builder .combo-summary-panel {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    position: sticky;
    top: 20px;
    max-width: 100%;
}

@media (max-width: 767px) {
    .maestro-pizza-builder .combo-summary-panel {
        position: static;
    }
}

.maestro-pizza-builder .combo-summary-panel h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 10px;
}

.maestro-pizza-builder .summary-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.maestro-pizza-builder .summary-section:last-of-type {
    border-bottom: none;
}

.maestro-pizza-builder .summary-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
}

.maestro-pizza-builder .summary-section .no-selection {
    color: #999;
    font-style: italic;
    font-size: 13px;
    margin: 0;
}

.maestro-pizza-builder .summary-section .selected-crust {
    font-size: 14px;
    color: #333;
    margin: 0;
    font-weight: 500;
}

.maestro-pizza-builder .summary-section .selected-toppings-list {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
}

.maestro-pizza-builder .summary-section .selected-toppings-list li {
    font-size: 13px;
    color: #333;
    padding: 2px 0;
}

.maestro-pizza-builder .summary-section .premium-badge {
    color: #d4af37;
    font-weight: 600;
    font-size: 11px;
    margin-left: 5px;
}

.maestro-pizza-builder .summary-section .toppings-count-summary {
    font-size: 12px;
    color: #666;
    margin: 8px 0 0 0;
    padding: 6px 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* Summary Total */
.maestro-pizza-builder .summary-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #c41e3a;
}

.maestro-pizza-builder .summary-total .total-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.maestro-pizza-builder .summary-total .grand-total {
    font-size: 18px;
    color: #c41e3a;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}

.maestro-pizza-builder .summary-total .extra-toppings-cost {
    color: #c41e3a;
}

.maestro-pizza-builder .summary-total .total-price {
    color: #c41e3a;
}

/* Combo Add to Cart Button in Pizza Builder */
.maestro-pizza-builder .combo-add-to-cart {
    display: block;
    width: 100%;
    padding: 16px 30px;
    font-size: 18px;
    font-weight: 600;
    background: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 15px;
}

.maestro-pizza-builder .combo-add-to-cart:hover {
    background: #a01830;
}

.maestro-pizza-builder .combo-status {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}
