/* Modal de combo compartilhado: o site do cliente (Bootstrap 5) e o painel (Bootstrap 4) usam este mesmo visual.
   Nada aqui depende de classe utilitária do Bootstrap: o layout do cabeçalho, da barra e do rodapé é todo cmx-*. */
/* Utility & Layout */
.z-sticky { 
    z-index: 1020; 
    position: sticky; 
    top: 0; 
    background-color: rgba(255, 255, 255, 0.85) !important; /* Translucent white */
    backdrop-filter: blur(12px); /* Glass effect */
    -webkit-backdrop-filter: blur(12px);
}

.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.shadow-success { box-shadow: 0 4px 14px 0 rgba(45, 122, 79, 0.39); }
.shadow-success:disabled { box-shadow: none; }

/* Grid Layout for Items */
.combo-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column */
    gap: 1rem;
}

@media (min-width: 992px) {
    .combo-grid {
        grid-template-columns: repeat(2, 1fr); /* Desktop: 2 columns */
    }
}

/* Animation Keyframes */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5); }
    70% { transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Combo Item Card */
.combo-item-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

/* Dedicated class for entrance animation to avoid conflicts */
.animate-entrance {
    animation: slideUpFade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.combo-item-card:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.combo-item-card.selected {
    border-color: var(--primary-green, #2D7A4F);
    background-color: #f0fdf4;
    box-shadow: 0 0 0 1px var(--primary-green, #2D7A4F);
}

/* Visual Image/Placeholder */
.item-visual {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    position: relative;
}

.combo-item-img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.combo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.2rem;
}

.selection-icon {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--primary-green, #2D7A4F);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transform: scale(0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
    /* Transition removed, animation handled by keyframe on select */
}

.combo-item-card.selected .selection-icon {
    opacity: 1;
    transform: scale(1);
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.min-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--orange, #FF8C00);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 5;
}

/* Content Typography */
.item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: #1e293b;
    font-size: 0.9rem;
    margin-bottom: 2px;
    line-height: 1.2;
}

.item-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Actions - Matching Quantity Controls */
.item-actions {
    flex-shrink: 0;
}

.item-preco { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.35rem; margin: 0.1rem 0 0.2rem; line-height: 1.2; }
.item-preco s { font-size: 0.75rem; color: #94a3b8; }
.item-preco__final { font-size: 0.95rem; font-weight: 800; color: #166534; }
.item-preco__badge { padding: 0 0.4rem; border-radius: 999px; background: #dcfce7; color: #166534; font-size: 0.68rem; font-weight: 700; white-space: nowrap; }

.item-peso { display: inline-block; margin-left: 0.25rem; padding: 0 0.45rem; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 0.68rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }

/* "Saiba mais": descrição completa, ingredientes e link da marmita, em linha própria dentro do cartão do item */
/* grade: foto à esquerda; nome e descrição em largura total; "Saiba mais" e +/- numa linha própria; detalhes por último */
.combo-item-card {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "visual content" "visual acoes" "info info";
    align-items: center; column-gap: 10px; row-gap: 4px;
}
.combo-item-card .item-visual { grid-area: visual; }
.combo-item-card .item-content { grid-area: content; }
.combo-item-card .item-actions { grid-area: acoes; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-width: 0; }
.combo-item-card .item-info { grid-area: info; }
.item-info-btn {
    padding: 2px 0; border: 0; background: none;
    color: #2D7A4F; font-size: 0.75rem; font-weight: 700; cursor: pointer; min-height: 28px;
}
.item-info-btn i { margin-right: 2px; }
.item-info { padding: 0.6rem 0.7rem; border-radius: 12px; background: #f1f8f4; cursor: default; }
.item-info[hidden] { display: none; }
.item-info__texto { margin: 0 0 0.4rem; font-size: 0.8rem; color: #334155; overflow-wrap: anywhere; }
.item-info__ingredientes { margin: 0 0 0.4rem; font-size: 0.75rem; color: #475569; overflow-wrap: anywhere; }
.item-info__alerg { margin: 0 0 0.4rem; font-size: 0.75rem; overflow-wrap: anywhere; }
.item-info__alerg--contem { color: #9a3412; }
.item-info__alerg--traco { color: #92400e; }
.item-info__link { font-size: 0.78rem; font-weight: 700; color: #2D7A4F; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; min-height: 32px; }

.quantity-controls-mini {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--gray-light, #f5f5f5);
    padding: 0.25rem;
    border-radius: 8px;
}

.qty-btn-mini {
    width: 32px; /* Increased size for mobile touch */
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    color: var(--gray-text, #4a5568);
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn-mini:hover {
    border-color: var(--primary-green, #2D7A4F);
    color: var(--primary-green, #2D7A4F);
}

.combo-item-card.selected .qty-btn-mini {
    border-color: var(--primary-green, #2D7A4F);
    color: var(--primary-green, #2D7A4F);
}

.combo-item-card.selected .qty-btn-mini:hover {
    background: var(--primary-green, #2D7A4F);
    color: white;
}

.qty-val-mini {
    min-width: 24px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-text, #2d3748);
}

/* Counter Pill Style */
.counter-pill {
    background: linear-gradient(135deg, var(--primary-green, #2D7A4F) 0%, var(--secondary-green, #3FA76B) 100%);
    color: white;
    padding: 4px 14px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(45, 122, 79, 0.2);
    display: inline-block;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.counter-pill.text-danger-custom {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* Progress Bar Error */
.progress-bar.bg-danger-custom {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Card Error State */
.combo-item-card.card-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 1px #ef4444 !important;
}

/* Footer Quantity Selector */
.quantity-selector-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

.quantity-selector-pill:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.btn-qty-modal {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}

.btn-qty-modal:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    transform: scale(1.05);
}

.btn-qty-modal.plus {
    background-color: #f8fafc;
    color: var(--primary-green, #2D7A4F);
}

.btn-qty-modal.plus:hover {
    background-color: var(--primary-green, #2D7A4F);
    color: white;
    box-shadow: 0 4px 10px rgba(45, 122, 79, 0.2);
}

/* Animation for limits */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.shake { 
    animation: shake 0.3s ease-in-out; 
    animation-delay: 0s !important; /* Fix conflict with cascade entrance */
}

/* Mobile Responsive Tweaks */
@media (max-width: 768px) {
    .item-visual { width: 55px; height: 55px; }
    .item-title { font-size: 0.85rem; }
    .item-desc { font-size: 0.7rem; -webkit-line-clamp: 1; }
    .modal-header { position: sticky; top: 0; z-index: 10; }
    .combo-item-card { padding: 8px; gap: 10px; }
}

/* ---------- casca do modal ---------- */
#comboModal .modal-dialog { width: calc(100% - 1rem); max-width: 800px; margin-left: auto; margin-right: auto; }
#comboModal .modal-content { max-height: calc(100vh - 1.5rem); border: 0; border-radius: 24px; background-color: #f8fafc; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
#comboModal .modal-body { min-height: 0; overflow-y: auto; flex: 1 1 auto; }

.cmx-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.5rem 1.5rem 0.5rem; background: #fff; border-radius: 24px 24px 0 0; }
.cmx-topo__texto { min-width: 0; padding-left: 1rem; border-left: 4px solid var(--orange, #FF8C00); border-radius: 2px; }
.cmx-selo { display: inline-block; margin-bottom: 0.5rem; padding: 0.25rem 0.5rem; border-radius: 999px; background: #ffc107; color: #212529; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px; }
.cmx-titulo { margin: 0 0 0.25rem; font-size: 1.75rem; font-weight: 800; letter-spacing: -1px; line-height: 1.1; color: #212529; overflow-wrap: anywhere; }
.cmx-descricao { margin: 0; font-size: 0.85rem; line-height: 1.4; font-weight: 500; color: #6c757d; opacity: 0.8; overflow-wrap: anywhere; }
.cmx-preco { margin: 0.25rem 0 0; font-size: 0.95rem; font-weight: 800; color: var(--orange, #ff8c00); }
.cmx-fechar { flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: #f8f9fa; color: #475569; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); transition: all 0.2s; }
.cmx-fechar:hover { background: #e9ecef; }
.cmx-extra:empty { display: none; }
.cmx-extra { padding: 0 1.5rem 0.75rem; background: #fff; }
.cmx-extra select, .cmx-extra input { display: block; width: 100%; padding: 0.6rem 0.75rem; border: 2px solid #e2e8f0; border-radius: 10px; font-family: inherit; background: #fff; }

.cmx-progresso { position: sticky; top: 0; z-index: 1020; padding: 1rem 1.5rem; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid #f8f9fa; box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); }
.cmx-progresso__linha { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.cmx-rotulo { font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #212529; opacity: 0.7; }
.cmx-barra { height: 8px; border-radius: 10px; background: #f8f9fa; overflow: hidden; }
.cmx-barra__preenchida { width: 0; height: 100%; border-radius: 10px; background: #28a745; transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.cmx-barra__preenchida.bg-danger-custom { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.cmx-corpo { padding: 1.5rem; }
.cmx-rodape { display: flex; align-items: center; gap: 0.5rem; padding: 1rem; background: #fff; border-top: 1px solid #f8f9fa; border-radius: 0 0 24px 24px; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03); }
.cmx-rodape__qtd { flex: 0 0 33%; max-width: 33%; }
.cmx-rodape__add { flex: 1 1 auto; min-width: 0; }
.cmx-rodape .quantity-selector-pill .cmx-qtd-valor { flex: 1; text-align: center; font-size: 1.25rem; font-weight: 800; color: #212529; }
.cmx-add { width: 100%; height: 54px; border: 0; border-radius: 50px; background: #28a745; color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px 0 rgba(45, 122, 79, 0.39); transition: all 0.2s; }
.cmx-add:disabled { opacity: 0.65; box-shadow: none; cursor: not-allowed; }
.cmx-add__rotulo { font-size: 0.65rem; letter-spacing: 0.5px; line-height: 1; margin-bottom: 2px; opacity: 0.75; }
.cmx-add__total { font-size: 1.2rem; line-height: 1; }
@media (max-width: 480px) { .cmx-topo, .cmx-progresso, .cmx-corpo { padding-left: 1rem; padding-right: 1rem; } .cmx-titulo { font-size: 1.5rem; } }
