﻿/* 
|----------------------------------------------------------------------------
| 1. Reset e Controle Global do Modal
|----------------------------------------------------------------------------
*/


.modal, .modal-open {
    padding-right: 0 !important;
    overflow: hidden;
}

.modal {
    padding-top: 3em;
    overflow-y: auto;
}

    .modal.fade .modal-dialog {
        transform: none !important;
        transition: none !important;
    }

/* Melhoria nos estilos do Skeleton Loader para garantir visibilidade */
.skeleton-loader {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.3s ease-in-out;
    position: relative;
    z-index: 10; /* Garantir que fique acima */
    background-color: white; /* Fundo branco para melhor contraste */
}

/* Efeito de shimmer melhorado */
.skeleton {
    background: #e0e0e0; /* Cinza base */
    background: linear-gradient(90deg, #e0e0e0 25%, #f5f5f5 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear; /* Adicionado linear para movimento mais suave */
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden; /* Garantir que o efeito fique dentro do elemento */
}

/* Aumentar a visibilidade dos elementos do skeleton */
.skeleton-img {
    width: 100%;
    height: 200px;
    border-radius: 1rem;
    background-color: #e0e0e0;
}

.skeleton-title {
    width: 70%;
    height: 24px; /* Altura aumentada */
    background-color: #e0e0e0;
}

.skeleton-text {
    width: 100%;
    height: 16px;
    background-color: #e0e0e0;
}

    .skeleton-text.small {
        width: 60%;
        background-color: #e0e0e0;
    }

.skeleton-price {
    width: 40%;
    height: 28px; /* Altura aumentada */
    margin-top: 0.5rem;
    background-color: #e0e0e0;
}

.skeleton-quantidade {
    width: 120px; /* Largura aumentada */
    height: 40px; /* Altura aumentada */
    margin-top: 0.5rem;
    background-color: #e0e0e0;
}

.skeleton-list {
    width: 100%;
    height: 80px;
    border-radius: 0.75rem;
    background-color: #e0e0e0;
}

.skeleton-button {
    width: 100%;
    height: 48px;
    margin-top: 1rem;
    border-radius: 2rem;
    background-color: #e0e0e0;
}

/* Animação de shimmer otimizada */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Garantir que o loader seja mostrado ao abrir o modal */
.modal.show .skeleton-loader:not(.d-none) {
    display: flex !important;
}

/* ===== Animations ===== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 
|----------------------------------------------------------------------------
| 2. Estrutura do Modal
|----------------------------------------------------------------------------
*/
.modal-dialog {
    max-width: 600px;
    height: 80vh;
    display: flex;
    align-items: flex-start;
    margin: 1em auto;
    overflow: hidden;
}

.modal-content {
    display: flex;
    flex-direction: column;
    height: 75vh;
    overflow-y: auto;
    position: relative;
    user-select: none;
    scroll-behavior: initial;
    border-radius: 10px;
}

.modal-header,
.modal-footer {
    position: sticky;
    z-index: 10;
    padding: 14px 16px;
}

.modal-header {
    background: #f7654b;
    color: white;
    border-bottom: none;
    top: 0;
    border-radius: 10px 10px 0 0;
}

.modal-footer {
    bottom: 0;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    display: flex;
    flex-direction: row;
    gap: 15px;
    padding: 15px;
    align-items: flex-start;
    max-height: calc(65vh - 40px);
}

/* Esconde elementos vazios */
#saboresContainer:empty,
#adicionaisContainer:empty {
    display: none !important;
}

/* 
|----------------------------------------------------------------------------
| 3. Produto - Imagem e Informações
|----------------------------------------------------------------------------
*/
.produto-imagem {
    order: 1;
    flex-shrink: 0;
    margin: 0 auto 15px;
    align-self: center;
}

    .produto-imagem img {
        max-width: 250px;
        max-height: 240px;
        border-radius: 10px;
        object-fit: cover;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

.produto-info-container {
    order: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 20px;
}

.produto-info-texto #mercadoriaNome {
    font-weight: 800;
}

.adicional-informacao {
    order: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 20px;
}

.produto-info h4 {
    margin: 0 0 5px;
    font-size: 1.6rem;
    font-weight: 600;
    color: #333;
}

.produto-info p {
    margin: 0;
    font-size: 1rem;
    color: #666;
    line-height: 1.4;
}

.produto-preco {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2ecc71;
    white-space: nowrap;
    text-align: left;
}

.grupo-invalido {
    border: 2px solid #ff0000;
    background-color: #ffeeee;
    border-radius: 5px;
    padding: 5px;
}

/* 
|----------------------------------------------------------------------------
| 4. Seletor de Sabores e Adicionais
|----------------------------------------------------------------------------
*/
.box-container {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    margin-top: 12px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

    .box-container label {
        font-weight: bold;
        font-size: 1.1rem;
        color: #333;
        margin-bottom: 8px;
        display: block;
    }

.adicional-item, .sabor-item, .observacao-item {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 5px 0;
    gap: 10px;
}

.adicional-info, .sabor-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 70px;
    word-break: break-word;
}

.adicional-nome, .sabor-nome {
    font-weight: 700;
}

.preco-adicional, .preco-sabor {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
}

.preco-sabor-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.preco-proporcional {
    color: #f7654b;
}

.quantidade-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100px;
    margin-right: 15px;
}

.quantidade-valor, .produto-quantidade-valor {
    font-size: 1.1rem;
    font-weight: bold;
    width: 30px;
    text-align: center;
}

.btn-menos, .btn-mais, .produto-btn-menos, .produto-btn-mais {
    background: #f7654b;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.95rem;
    width: 28px;
    cursor: pointer;
}

    .btn-menos:hover, .btn-mais:hover,
    .produto-btn-menos:hover, .produto-btn-mais:hover {
        background: #e0553b;
    }

    .btn-menos:disabled, .produto-btn-menos:disabled {
        background: #ccc;
        cursor: not-allowed;
    }

.quantidade-preco, .produto-quantidade-preco {
    display: flex;
    align-items: center;
    gap: 4em;
    margin-left: auto;
    min-width: 160px;
    justify-content: flex-end;
}

.grupo-adicional {
    margin-bottom: 2em;
}

    .grupo-adicional h5 {
        font-weight: 600;
    }

.grupo-header {
    transition: all 0.2s ease;
}

    .grupo-header:hover {
        background-color: #f5f5f5;
        border-radius: 8px;
    }

    .grupo-header h6 {
        font-weight: bold;
    }

.btn-toggle-group {
    transition: transform 0.2s;
    color: #555;
}

    .btn-toggle-group:hover {
        transform: scale(1.1);
        color: #000;
    }



/* 
|----------------------------------------------------------------------------
| 5. Botão Principal
|----------------------------------------------------------------------------
*/
.btn-adicionar {
    background: #f7654b;
    color: white;
    font-size: 1.1rem;
    padding: 10px 18px;
    border-radius: 6px;
    width: 100%;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-adicionar:hover {
        background: #e0553b;
    }


.btn-fechar-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1050;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--color-danger);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

/* Garantir que o modal-content tenha posição relativa */
.modal-content {
    position: relative;
}

/* Ajustar o padding do modal-body para não sobrepor o botão */
#modalContent .modal-body {
    padding-top: 60px;
}

/* 
|----------------------------------------------------------------------------
| 6. Responsividade
|----------------------------------------------------------------------------
*/
@media (max-width: 992px) {
    .produto-imagem img {
        max-width: 240px;
        max-height: 220px;
    }

    .produto-info h4 {
        font-size: 1.4rem;
    }

    .produto-preco {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .modal {
        padding: 1.5em 0.8em !important;
    }

    .modal-dialog,
    .modal-content {
        max-height: 80vh;
        height: 100%;
    }

    .modal-body {
        flex-direction: column;
        align-items: center;
        padding: 12px;
        gap: 12px;
        flex-wrap: wrap;
        max-height: calc(72vh - 40px);
    }

    .box-container {
        padding: 12px;
    }

        .box-container label {
            font-size: 0.95rem;
        }

    .sabor-item, .adicional-item {
        padding: 8px;
        font-size: 0.9rem;
    }

    .btn-menos, .btn-mais {
        font-size: 0.85rem;
    }

    .modal-footer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .produto-info-container {
        width: 100%;
        gap: 12px;
    }

    .produto-imagem {
        order: 2;
    }

    .produto-info-container {
        order: 1;
    }
}

@media (max-width: 576px) {
    .modal {
        padding: 1.2em 0.6em !important;
    }

    .modal-dialog,
    .modal-content {
        height: 80vh;
    }

    .modal-body {
        max-height: calc(75vh - 40px);
    }

    .box-container {
        padding: 10px;
    }

        .box-container label {
            font-size: 0.9rem;
        }

    .sabor-item, .adicional-item {
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    .quantidade-valor {
        font-size: 0.95rem;
    }

    .adicional-nome {
        min-width: 100%;
    }

    .produto-imagem img {
        max-width: 200px;
        max-height: 220px;
    }

    .quantidade-preco, .produto-quantidade-preco {
        min-width: 90px;
    }
}

@media (max-width: 465px) {
    .produto-imagem img {
        max-width: 130px;
        max-height: 150px;
    }

        .modal-dialog,
    .modal-content {
        max-height: 75vh;
    }
}

@media (max-width: 400px) {
    .modal {
        padding: 1em 0.5em !important;
    }

    .modal-footer {
        padding-top: calc(10px + env(safe-area-inset-bottom));
    }

    .modal-dialog,
    .modal-content {
        max-height: 88vh;
    }

    .modal-body {
        max-height: calc(78vh - 40px);
        padding: 10px;
    }

    .compact-modal .modal-footer {
        margin-top: 1rem;
        padding-bottom: 1em;
    }
}

@media (max-width: 359px){
    .produto-imagem img {
        max-width: 200px;
        max-height: 180px;
    }

    .produto-imagem {
        order: 1;
    }

    .modal-dialog,
    .modal-content {
        max-height: 80vh;
    }
}

@media (max-width: 340px) {
    .modal {
        padding: 1em 0.5em !important;
    }

    .modal-footer {
        padding-top: calc(10px + env(safe-area-inset-bottom));
    }

    .modal-dialog,
    .modal-content {
        max-height: 80vh;
    }

    .modal-body {
        max-height: calc(78vh - 40px);
        padding: 10px;
    }

    .compact-modal .modal-footer {
        margin-top: 1rem;
        padding-bottom: 1em;
    }
    .produto-imagem {
        order: 1;
    }
}

/* 
|----------------------------------------------------------------------------
| Modal Compacto Responsivo
|----------------------------------------------------------------------------
*/

.modal-content.compact-modal {
    max-height: 80vh; /* Altura máxima reduzida */
    height: auto; /* Altura automática */
}

.compact-modal .modal-body {
    padding: 10px 15px;
    overflow-y: auto; /* Scroll interno */
    max-height: calc(60vh - 100px); /* Considera header e footer */
    flex-grow: 1;
}

@media (max-height: 600px) {
    .modal-content.compact-modal {
        max-height: 90vh;
    }

    .compact-modal .modal-body {
        max-height: calc(90vh - 70px);
    }
}

@media (max-height: 700px) {
    .modal-content.compact-modal {
        max-height: 85vh;
        margin: 0.5em auto;
    }

    .compact-modal .modal-body {
        max-height: calc(85vh - 70px);
    }
}

.compact-modal {
    padding-bottom: env(safe-area-inset-bottom);
}


/* Adicione este CSS ao seu arquivo _ModalPedido.css */

.produto-quantidade.fracionado {
    min-width: 150px; /* Mais espaço para o campo de entrada */
    position: relative;
}

.produto-quantidade-input {
    width: 70px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 1em;
    margin: 0 5px;
}

/* Ajusta o estilo para o campo de entrada */
.produto-quantidade.fracionado .produto-quantidade-input {
    background-color: #f9f9f9;
    transition: border-color 0.2s;
}

    .produto-quantidade.fracionado .produto-quantidade-input:focus {
        border-color: #007bff;
        outline: none;
        box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
    }

/* Indicador de unidade de medida */
.produto-quantidade.fracionado::after {
    content: 'kg';
    display: inline-block;
    margin-left: 5px;
    font-size: 0.9em;
    color: #666;
}

/* Ajusta o posicionamento dos botões */
.produto-quantidade.fracionado .produto-btn-menos,
.produto-quantidade.fracionado .produto-btn-mais {
    vertical-align: middle;
}

/* Adição ao CSS existente para estilizar as observações com checkbox */

/* Alinhamento e estilo dos itens de observação */
.observacao-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 5px 0;
    cursor: pointer; /* Indica que é clicável */
    transition: background-color 0.2s ease;
    user-select: none; /* Impede seleção de texto ao clicar */
}

    .observacao-item:hover {
        background-color: #f9f9f9;
    }

.observacao-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 70px;
    word-break: break-word;
}

    /* Estilo para o texto da observação */
    .observacao-info .observacao-nome {
        font-weight: 500; /* Um pouco menos bold que os outros itens */
        color: #333;
    }

/* Estilo para o container do checkbox */
.observacao-item .form-check {
    margin: 0;
    padding-left: 0;
    display: flex;
    align-items: center;
}

/* Estilo para o checkbox */
.observacao-item .form-check-input {
    margin-top: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Estilo para item selecionado */
.observacao-item[data-observacao-check="true"] {
    background-color: #f7f7f7;
    border-color: #ccc;
}

    .observacao-item[data-observacao-check="true"] .observacao-nome {
        font-weight: 600;
    }

.observacoes-container-pedido {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Responsividade */
@media (max-width: 576px) {
    .observacao-item {
        padding: 8px;
    }

        .observacao-item .observacao-nome {
            font-size: 0.9rem;
        }

        .observacao-item .form-check-input {
            width: 16px;
            height: 16px;
        }
}
