/* GERAL E VARIAVEIS */
:root {
    --primary-color: #EA1D2C;
    --secondary-color: #F7F7F7;
    --text-color: #3f3f40;
    --light-gray: #f2f2f2;
    --dark-gray: #a6a6a6;
    --white: #fff;
    --green: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--secondary-color);
    color: var(--text-color);
    overflow-x: hidden; /* CORREÇÃO 6: Impede que o carrinho "vaze" na tela */
}

/* HEADER */
.header-container {
    width: 100%;
    min-height: 200px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 20px 5%;
    position: relative;
}

.header-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
    z-index: 1;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 2;
    width: 100%;
}

.logo-negocio-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--white);
    object-fit: cover;
    flex-shrink: 0;
}

.header-title, .header-description { color: var(--white); }
.header-title { font-size: 2rem; }
.header-details { flex-grow: 1; }

/* CORREÇÃO 2: Estilo do botão de carrinho no topo */
.header-cart-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--white);
    color: var(--primary-color);
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    position: relative;
}
.header-cart-button i { font-size: 1.2rem; }

.cart-counter-span {
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* OPÇÕES DO MENU */
.menu-options-container {
    padding: 20px 5%;
    background-color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.category-nav { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 15px; -ms-overflow-style: none; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-btn { padding: 8px 20px; border-radius: 20px; border: 1px solid var(--dark-gray); background-color: var(--secondary-color); cursor: pointer; font-size: 0.9rem; white-space: nowrap; transition: all 0.2s ease-in-out; }
.category-btn:hover, .category-btn.active { background-color: var(--primary-color); color: var(--white); border-color: var(--primary-color); }
.search-container { margin-top: 15px; position: relative; }
#search-input { width: 100%; padding: 12px 15px 12px 40px; border-radius: 8px; border: 1px solid #ddd; font-size: 1rem; }
.search-container i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--dark-gray); }

/* GRID DE ITENS DO MENU */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 25px; padding: 25px 5%; }
.menu-item-card { background-color: var(--white); border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: hidden; display: flex; flex-direction: column; }
.item-header { display: flex; }
.item-image { width: 120px; height: 120px; object-fit: cover; flex-shrink: 0; }
.item-info { padding: 15px; display: flex; flex-direction: column; }
.item-name { font-size: 1.1rem; font-weight: 500; }
.item-description { font-size: 0.85rem; color: #666; flex-grow: 1; margin: 5px 0 10px 0; }
.item-price { font-size: 1.1rem; font-weight: bold; }
.item-controls { padding: 0 15px 15px 15px; display: flex; flex-direction: column; gap: 15px; }
.card-quantity-control { display: flex; align-items: center; justify-content: space-between; width: 120px; align-self: flex-end; }
.card-quantity-control button { width: 30px; height: 30px; border: 1px solid #ddd; background-color: #f7f7f7; font-size: 1.2rem; border-radius: 50%; cursor: pointer; }
.card-quantity-control span { font-size: 1.2rem; font-weight: bold; }
.card-observation-input { width: 100%; padding: 10px; border-radius: 5px; border: 1px solid #ddd; resize: none; font-size: 0.9rem; }
.card-add-btn { width: 100%; padding: 12px; background-color: var(--primary-color); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: background-color 0.2s; }
.card-add-btn:hover { background-color: #c21a25; }
.item-unavailable { opacity: 0.6; background-color: #f9f9f9; }
.item-unavailable .item-name::after { content: " (Indisponível)"; color: var(--primary-color); font-size: 0.8rem; font-weight: normal; }
.item-unavailable .item-controls { display: none; }

/* CARRINHO FLUTUANTE */
.cart-sidebar { position: fixed; top: 0; right: -100%; width: 380px; height: 100%; background-color: white; box-shadow: -4px 0 10px rgba(0,0,0,0.1); z-index: 1001; display: flex; flex-direction: column; transition: right 0.4s ease-in-out; }
.cart-sidebar.open { right: 0; }
.cart-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--light-gray); }
.cart-header h3 { font-size: 1.2rem; }
.cart-close-btn { font-size: 1.5rem; background: none; border: none; cursor: pointer; }
.cart-items { flex-grow: 1; overflow-y: auto; padding: 10px 20px; }
.cart-item { display: flex; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--light-gray); }
.cart-item img { width: 60px; height: 60px; border-radius: 5px; object-fit: cover; }
.cart-item-info { flex-grow: 1; margin: 0 10px; }
.cart-item-name { font-weight: 500; }
.cart-item-price { color: #888; }
.cart-item-subtotal { font-weight: bold; }
.cart-item-obs { font-size: 0.8rem; color: #666; font-style: italic; }
.cart-item-actions { display: flex; align-items: center; gap: 5px; }
.cart-item-actions button { border: 1px solid #ddd; background: #f7f7f7; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }
.cart-footer { padding: 20px; border-top: 1px solid var(--light-gray); }
.cart-total { display: flex; justify-content: space-between; font-size: 1.2rem; margin-bottom: 15px; }
.checkout-btn { width: 100%; padding: 15px; background-color: var(--green); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: background-color 0.2s; }
.checkout-btn:disabled { background-color: var(--dark-gray); cursor: not-allowed; }

/* BOTÃO FLUTUANTE DO CARRINHO */
.cart-float-button { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background-color: var(--primary-color); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 999; }
/* Usando a mesma classe para o contador */
#cart-float-button .cart-counter-span { position: absolute; top: -5px; right: -5px; }

/* MODAL DE CHECKOUT */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1002; }
.modal-content { background-color: white; padding: 25px; border-radius: 10px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close-btn { position: absolute; top: 15px; right: 15px; background: transparent; border: none; font-size: 1.8rem; cursor: pointer; color: #888; }
.checkout-step { margin: 20px 0; padding-bottom: 20px; border-bottom: 1px solid var(--light-gray); }
.checkout-step h4 { margin-bottom: 15px; }
.checkout-step input[type="text"], .checkout-step input[type="tel"] { width: 100%; padding: 12px; border-radius: 5px; border: 1px solid #ddd; margin-bottom: 10px; }
.radio-option { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

/* CORREÇÃO 3: Botão primário para o modal */
.btn-primary {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary:hover { background-color: #c21a25; }

/* RESPONSIVIDADE */
@media (max-width: 768px) {
    .menu-grid { grid-template-columns: 1fr; }
    
    /* CORREÇÃO 5: Centraliza e ajusta o topo no mobile */
    .header-content {
        flex-direction: column;
        text-align: center;
        padding-bottom: 0;
    }
    .logo-negocio-img {
        width: 80px;
        height: 80px;
    }
    .header-title {
        font-size: 1.5rem;
    }
    .header-description {
        font-size: 0.9rem;
    }

    /* CORREÇÃO 2: Esconde o botão do carrinho no topo em mobile */
    .header-cart-button {
        display: none;
    }

    /* Ajuste no carrinho para mobile */
    .cart-sidebar {
        width: 100%;
    }
}