/* Estrutura Base */
.modal-overlay { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.85); 
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 9999; 
    justify-content: center; 
    align-items: center; 
}

.modal-content { 
    background: #fff; 
    width: 95%; 
    max-width: 480px; 
    max-height: 85vh; 
    border-radius: 20px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
}

/* Header */
.modal-product-header { position: relative; display: flex; flex-direction: column; }
.modal-header-img { position: relative; height: 50px; width: 100%; flex-shrink: 0; }
.modal-header-img img { width: 100%; height: 50%; object-fit: cover; }
.modal-product-info { padding: 12px 16px; border-bottom: 1px solid #eee; }

.btn-close-modal { 
    position: absolute; 
    top: 12px; right: 12px; 
    background: #fff; 
    border: none; 
    border-radius: 50%; 
    width: 32px; height: 32px; 
    font-weight: bold; 
    cursor: pointer; 
    z-index: 10; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Corpo e Adicionais */
.modal-body { flex: 1; overflow-y: auto; background: #fff; }

.section-title { 
    background: #f4f4f4; 
    padding: 8px 15px; 
    font-weight: bold; 
    font-size: 0.8rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    color: #333;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 20;
}

.blinking-flavor-label {
    animation: blinkFlavorLabel 1s ease-in-out infinite;
}

@keyframes blinkFlavorLabel {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.section-title small { 
    background: #e63946; 
    color: #fff; 
    padding: 2px 6px; 
    border-radius: 8px; 
    font-size: 0.65rem; 
    text-transform: none;
}

.additional-row { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 10px 15px; 
    border-bottom: 1px solid #f5f5f5; 
}

.add-left { display: flex; align-items: center; gap: 10px; }

.add-img-thumb { 
    width: 44px; height: 44px; 
    border-radius: 8px; 
    object-fit: cover; 
    border: 1px solid #f0f0f0;
}

.add-name strong { font-size: 13px; color: #333; display: block; }
.add-composition { 
    font-size: 10px; color: #777; 
    font-style: italic; margin-top: 2px; 
    line-height: 1.2; 
}

/* CAMPO DE OBSERVAÇÕES */
.modal-obs-container {
    padding: 12px 15px;
    border-top: 1px solid #f5f5f5;
    background: #fff;
}

.modal-obs-container label {
    display: block;
    font-size: 0.8rem;
    font-weight: bold;
    color: #444;
    margin-bottom: 6px;
}

#modal-observation {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    background: #fdfdfd;
}

#modal-observation:focus {
    border-color: #e63946;
    background: #fff;
}

/* Footer e Seletores */
.modal-footer { 
    padding: 12px 15px; 
    border-top: 1px solid #eee; 
    display: flex; gap: 8px; 
    align-items: center; 
}

.product-qty-selector { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    background: #f0f0f0; 
    padding: 6px 12px; 
    border-radius: 8px; 
}

.product-qty-selector button { 
    border: none; background: none; 
    font-size: 1rem; font-weight: bold; 
    color: #e63946; cursor: pointer; 
}

.qty-selector { 
    display: flex; align-items: center; 
    gap: 8px; background: #f0f0f0; 
    padding: 3px 8px; border-radius: 20px; 
}

.qty-selector button { 
    border: none; background: #fff; 
    color: #e63946; width: 26px; height: 26px; 
    border-radius: 50%; font-weight: bold; 
    cursor: pointer; 
}

.btn-confirm-add { 
    flex: 1; background: #e63946; 
    color: #fff; border: none; 
    padding: 10px; border-radius: 8px; 
    font-weight: bold; font-size: 0.95rem; 
    cursor: pointer; 
}

/* Ajustes Mobile */
@media (max-width: 480px) {
    .modal-product-header {
        flex-direction: row;
        align-items: center;
        padding: 15px;
        gap: 15px;
        border-bottom: 1px solid #eee;
    }
    .modal-header-img { width: 70px; height: 70px; }
    .modal-header-img img { border-radius: 12px; }
    .modal-product-info { padding: 0; border-bottom: none; flex: 1; }
    .modal-product-info h2 { font-size: 1.1rem; margin: 0; }
    .btn-close-modal { top: 10px !important; right: 10px !important; }

    /* Quando a pizza composta (imagem fracionada) está visível, o header genérico
       fica redundante — escondemos só em telas de celular */
    .modal-product-header.has-flavor-composite .modal-header-img {
        display: none;
    }
    .modal-product-header.has-flavor-composite .modal-product-info {
        flex: 1;
        width: 100%;
    }
}

/* NOVOS ESTILOS PARA ADICIONAIS ESGOTADOS */
.additional-row.sold-out {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.8);
    background: #f9f9f9;
    position: relative;
}

.option-sold-out-badge {
    background: #ff0000;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.additional-row.sold-out .option-sold-out-badge {
    filter: none !important;
    opacity: 1 !important;
}

/* EXIBIÇÃO DE SABOR(ES) SELECIONADO(S) */
#modal-selected-flavors {
    animation: slideDown 0.3s ease-out;
}

#modal-selected-flavors-list .flavor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 6px 0;
}

#modal-selected-flavors-list .flavor-item:last-child {
    margin-bottom: 0;
}

#modal-selected-flavors-list .flavor-name {
    flex: 1;
    color: #333;
    font-weight: 600;
}

#modal-selected-flavors-list .flavor-price {
    background: #e63946;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

/* ESTILOS PARA A GRADE DE SABORES (NOVO) */
.flavor-card {
    transition: all 0.2s ease;
    border: 2px solid #eee;
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    background: #fff;
    position: relative;
}

.flavor-card:hover {
    border-color: #ccc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.flavor-card.selected {
    border-color: #e63946 !important;
    background: #fff5f5 !important;
}

.flavor-card .flavor-check {
    font-size: 18px;
    color: #ccc;
    margin-left: 6px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.flavor-card.selected .flavor-check {
    color: #e63946;
}

/* ESGOTADO dentro da lista de sabores (mesmo padrão dos adicionais esgotados) */
.flavor-card.sold-out {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.8);
    background: #f9f9f9 !important;
    cursor: default;
}

.flavor-card.sold-out .flavor-check {
    display: none;
}

.flavor-list {
    padding: 6px 10px;
}

.flavor-composition {
    font-size: 10.5px;
    color: #888;
    font-style: italic;
    margin-top: 2px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 480px) {
    .flavor-composition {
        -webkit-line-clamp: 3;
    }
}

/* Layout compacto de sabores: ícone pequeno + texto na mesma linha, também no mobile */
.flavor-card .flavor-check {
    margin-left: 6px;
}