/* ESTILOS GERAIS */
body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER */
.header-container {
    background-color: #F490A8;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.header-container img {
    max-height: 80px;
    width: auto;
}

/* CONTAINER PRINCIPAL DO PEDIDO */
.pedido-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px;
    box-sizing: border-box;
    flex-grow: 1;
}

h1 {
    color: #343a40;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1.mb-4 {
    font-size: 1.8rem;
}

/* ÍCONE DO CARRINHO NO CABEÇALHO */
.carrinho-icon-header {
    margin-left: 10px;
    font-size: 1.5em;
    cursor: pointer;
    color: #F490A8;
    position: relative;
}

.carrinho-icon-header:hover {
    opacity: 0.8;
}

.carrinho-contador {
    background-color: #dc3545;
    color: white;
    font-size: 0.7em;
    border-radius: 50%;
    padding: 2px 6px;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    display: none;
}

/* INFORMAÇÕES DE LOCAL E TEMPO */
.info-local-pedido {
    font-size: 0.8em;
    margin-top: 5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-local-pedido span {
    margin-right: 5px;
}

/* NAVEGAÇÃO DE ABAS (CATEGORIAS) */
.tab-navigation-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.scroll-arrow {
    background-color: #F490A8;
    color: white;
    border: none;
    padding: 10px 5px;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 5px;
}

.scroll-arrow:hover {
    opacity: 1;
}

.scroll-arrow.left {
    left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.scroll-arrow.right {
    right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.tab-buttons {
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-grow: 1;
    margin: 0 30px;
    padding-bottom: 5px;
}

.tab-buttons::-webkit-scrollbar {
    display: none;
}

.tab-button {
    flex-shrink: 0;
    padding: 12px 15px;
    cursor: pointer;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 5px 5px 0 0;
    text-align: center;
    white-space: nowrap;
    min-width: 120px;
    margin-right: 5px;
}

.tab-button:last-child {
    margin-right: 0;
}

.tab-button.active {
    background-color: #F490A8;
    color: white;
    border-color: #007bff;
}

.tab-content {
    display: none;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 5px 5px;
    background-color: #fff;
}

.tab-content.active {
    display: block;
}

.categoria-titulo {
    margin-top: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
    font-size: 1.5rem;
    color: #555;
}

/* ESTILOS DO PRODUTO */
.produto {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #fefefe;
}

.produto img {
    max-width: 100px;
    height: auto;
    margin-bottom: 10px;
    border-radius: 5px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.produto-info {
    flex-grow: 1;
    width: 100%;
}

.produto-info label {
    margin-bottom: 5px;
    display: block;
    font-weight: bold;
    font-size: 1.1rem;
}

.produto input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* ESTILOS DOS ADICIONAIS - FOCO DA CORREÇÃO */
.adicionais-container {
    width: 100%;
    margin-top: 10px;
    border-top: 1px dashed #e9ecef;
    padding-top: 10px;
    display: none; /* ESCONDIDO POR PADRÃO. JavaScript o torna 'block' */
}

/* CORREÇÃO AQUI: Regra para forçar a visibilidade e garantir que nada seja sobrescrito */
.produto .adicionais-container[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 10px !important;
}

.adicional-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    /* CORREÇÃO AQUI: Garante que o item flex container não seja escondido */
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}

/* CORREÇÃO AQUI: Força a visibilidade e dimensões dos INPUTS E LABELS internos */
.adicional-item input[type="checkbox"],
.adicional-item input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.2);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px !important; /* Força a largura */
    height: 20px !important; /* Força a altura */
    border: 2px solid #007bff;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    /* Garante visibilidade e opacidade */
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important; /* Força ser um elemento de bloco inline */
}

.adicional-item input[type="checkbox"]:checked,
.adicional-item input[type="radio"]:checked {
    background-color: #007bff;
    border-color: #007bff;
}

.adicional-item input[type="checkbox"]:checked::before,
.adicional-item input[type="radio"]:checked::before {
    content: '\2713'; /* Símbolo de check */
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    visibility: visible !important; /* Garante que o pseudo-elemento checkmark seja visível */
    opacity: 1 !important;
}

.adicional-item input[type="radio"] {
    border-radius: 50%;
}

.adicional-item input[type="radio"]:checked::before {
    content: ''; /* Remove o checkmark padrão para radios */
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
    visibility: visible !important; /* Garante que o pseudo-elemento de bolinha seja visível */
    opacity: 1 !important;
}

.adicional-item label {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: #333;
    /* Garante visibilidade e opacidade */
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important; /* Garante que a label seja um elemento de bloco inline */
}

/* BOTÃO ADICIONAR AO CARRINHO */
.produto .btn-success {
    width: 100%;
    padding: 10px;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* CARRINHO LATERAL (SIDEBAR) */
.carrinho-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
    transition: right 0.3s ease-in-out;
    z-index: 1050;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
}

.carrinho-sidebar.open {
    right: 0;
}

/* OVERLAY (FUNDO ESCURECIDO) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

/* CORPO DA PÁGINA QUANDO CARRINHO ESTÁ ABERTO */
body.carrinho-aberto {
    overflow: hidden;
}

/* BOTÃO FECHAR CARRINHO */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    color: #343a40;
}

/* TABELA DO CARRINHO */
.carrinho-container h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #343a40;
}

.carrinho-container table {
    width: 100%;
    border-collapse: collapse;
}

.carrinho-container th,
.carrinho-container td {
    padding: 10px 5px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carrinho-container th:nth-child(1),
.carrinho-container td:nth-child(1) {
    width: 50px;
}

.carrinho-container th:nth-child(2),
.carrinho-container td:nth-child(2) {
    width: 40%;
}

.carrinho-container th:nth-child(3),
.carrinho-container td:nth-child(3) {
    width: 80px;
    white-space: normal;
}

.carrinho-container th:nth-child(4),
.carrinho-container td:nth-child(4) {
    width: 20%;
}

.carrinho-container th:nth-child(5),
.carrinho-container td:nth-child(5) {
    width: 80px;
}

.carrinho-container th:nth-child(6),
.carrinho-container td:nth-child(6) {
    width: 70px;
}

.carrinho-quantidade {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.carrinho-quantidade button {
    padding: 5px 10px;
    margin: 0;
    font-size: 1rem;
    border: 1px solid #007bff;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.carrinho-quantidade button:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.carrinho-quantidade span {
    min-width: 25px;
    text-align: center;
    display: block;
    margin: 5px 0;
}

.carrinho-container button {
    padding: 5px 8px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.carrinho-container button:hover {
    background-color: #c82333;
}

/* TOTAIS DO PEDIDO */
#total-pedido,
#taxa-entrega {
    margin-top: 15px;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: right;
    color: #28a745;
}

#taxa-entrega {
    color: #6c757d;
    font-size: 1rem;
}

/* INFORMAÇÕES DE ENDEREÇO E PAGAMENTO */
.endereco-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.endereco-info input,
.endereco-info textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
}

.forma-pagamento {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.form-check-inline {
    margin-right: 15px;
    margin-bottom: 10px;
}

.form-check-label {
    cursor: pointer;
}

.form-check-input {
    cursor: pointer;
}

.btn-block {
    margin-top: 20px;
    padding: 12px;
    font-size: 1.3rem;
    border-radius: 8px;
}

/* RODAPÉ */
.footer-container {
    background-color: #F490A8;
    color: white;
    padding: 15px;
    text-align: center;
    margin-top: auto;
}

.footer-container p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* BOTÃO FLUTUANTE DO CARRINHO */
.carrinho-flutuante-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #F490A8;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.carrinho-flutuante-btn:hover {
    background-color: #EE557A;
}

.carrinho-flutuante-btn .carrinho-contador {
    font-size: 0.8em;
    top: -8px;
    right: -8px;
}

/* MEDIA QUERIES (RESPONSIVIDADE) */
@media (max-width: 768px) {
    .carrinho-sidebar {
        width: 80%;
        right: -80%;
    }

    .carrinho-sidebar.open {
        right: 0;
    }
}

@media (max-width: 575.98px) {
    .tab-button {
        font-size: 0.9rem;
        padding: 10px 8px;
    }

    .produto {
        padding: 10px;
    }

    .produto img {
        max-width: 100%;
    }

    .carrinho-container th,
    .carrinho-container td {
        font-size: 0.8rem;
        padding: 8px 3px;
    }

    /* Esconde adicionais na tabela em telas muito pequenas */
    .carrinho-container th:nth-child(4),
    .carrinho-container td:nth-child(4) {
        display: none;
    }

    /* Ajusta a largura das colunas restantes quando 'Adicionais' está oculto */
    .carrinho-container th:nth-child(2),
    .carrinho-container td:nth-child(2) {
        width: 50%;
    }

    .carrinho-container th:nth-child(5),
    .carrinho-container td:nth-child(5) {
        width: 90px;
    }

    .carrinho-quantidade button {
        padding: 3px 6px;
        font-size: 0.9rem;
    }

    .carrinho-sidebar {
        width: 100%;
        right: -100%;
    }

    .carrinho-sidebar.open {
        right: 0;
    }

    .carrinho-flutuante-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: 15px;
        right: 15px;
    }

    .carrinho-flutuante-btn .carrinho-contador {
        top: -5px;
        right: -5px;
    }

    .carrinho-icon-header {
        font-size: 1.2em;
    }
}