/* =========================================
   1. FONTES E VARIÁVEIS (IDENTIDADE VISUAL)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Emilys+Candy&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg-color: #edece4; 
    --card-color: #f5cece; 
    --text-color: #965b4c; 
    --white: #ffffff;
    --btn-color: #965b4c;
    --success: #25d366;
    --danger: #d9534f;
    --edit: #5bc0de;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding-bottom: 220px; /* Espaço para o carrinho flutuante */
    overflow-x: hidden;
}

/* =========================================
   2. ESTRUTURA BASE E HEADER
   ========================================= */
.container, .admin-container { 
    width: 100%; 
    max-width: 480px; 
    margin: 0 auto; 
    padding: 20px; 
}

header { 
    text-align: center; 
    margin-bottom: 40px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

h1 { font-family: 'Emilys Candy', cursive; font-size: 3.2rem; font-weight: 900; color: var(--text-color); }
.subtitle { font-size: 1.1rem; letter-spacing: 4px; text-transform: uppercase; font-weight: 800; margin-top: 10px; }

.bunny-icon { width: 60px !important; height: 60px !important; margin-top: 15px; display: block; }

/* =========================================
   3. CATEGORIAS (SITE PRINCIPAL)
   ========================================= */
.category-menu { 
    display: flex; 
    gap: 12px; 
    overflow-x: auto; 
    padding: 10px 5px; 
    margin-bottom: 25px; 
    scrollbar-width: none; 
    -webkit-overflow-scrolling: touch;
}
.category-menu::-webkit-scrollbar { display: none; }

.cat-btn { 
    background: transparent; 
    border: 2px solid var(--text-color); 
    color: var(--text-color); 
    padding: 8px 20px; 
    border-radius: 25px; 
    font-weight: 800; 
    cursor: pointer; 
    white-space: nowrap; 
    transition: 0.3s;
}
.cat-btn.active { background: var(--text-color); color: var(--card-color); }

/* =========================================
   4. CARDS DE PRODUTO (REVISADO ANTI-ENCAVALO)
   ========================================= */
.product-card { 
    background-color: var(--card-color); 
    border-radius: 25px; 
    padding: 20px; 
    margin-bottom: 20px; 
    display: flex; 
    align-items: flex-start; 
    gap: 15px; 
}

/* Lógica de Esgotado nos Cards */
.product-card.esgotado-card { opacity: 0.6; filter: grayscale(1); }

.product-img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 2px solid var(--text-color); flex-shrink: 0; }
.product-info-wrapper { flex: 1; min-width: 0; }

.product-header-row { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    align-items: baseline; 
    gap: 5px; 
    margin-bottom: 8px; 
}

.product-title { font-family: 'Emilys Candy', cursive; font-size: 1.5rem; font-weight: 900; word-break: break-word; }
.product-price { font-size: 1.3rem; font-weight: 800; white-space: nowrap; }
.product-desc { font-size: 0.85rem; font-weight: 600; margin-bottom: 12px; opacity: 0.9; }

.add-btn { background: var(--btn-color); color: white; border: none; padding: 12px; border-radius: 15px; width: 100%; font-weight: 800; cursor: pointer; }
.add-btn:disabled { background: #bbb !important; cursor: not-allowed; }

.qty-controls { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.4); border-radius: 12px; padding: 5px; }
.qty-btn { background: var(--text-color); color: white; border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-weight: 800; }

/* =========================================
   5. INFORMAÇÕES (RODAPÉ DO SITE - 4 COLUNAS PC)
   ========================================= */
.info-section { margin-top: 60px; text-align: center; }
.info-title { font-family: 'Emilys Candy', cursive; font-size: 2.8rem; margin-bottom: 30px; }

.info-card { 
    background-color: var(--card-color) !important; 
    border-radius: 30px !important; 
    padding: 30px !important; 
    margin-bottom: 20px !important; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
}
.info-card h3 { font-family: 'Emilys Candy', cursive; font-size: 1.8rem; margin-bottom: 12px; }
.info-card p { font-weight: 700; line-height: 1.6; }

/* =========================================
   6. PAINEL ADMIN (ESTILIZAÇÃO COMPLETA)
   ========================================= */
.admin-card { 
    background-color: var(--card-color) !important; 
    border-radius: 25px !important; 
    padding: 25px !important; 
    margin-bottom: 25px !important; 
    text-align: center;
}

.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; font-weight: 800; margin-bottom: 8px; font-size: 0.9rem; }

.form-group input, .form-group select, .form-group textarea { 
    width: 100% !important; padding: 12px !important; border-radius: 12px !important; border: none !important; 
    background-color: var(--white) !important; color: var(--text-color) !important; font-family: 'Nunito' !important; font-weight: 700;
}

.admin-btn { 
    background-color: var(--text-color); color: var(--white); border: none; padding: 14px; 
    border-radius: 12px; font-weight: 800; cursor: pointer; width: 100%; font-family: 'Nunito'; margin-top: 10px;
}
.admin-btn.danger { background-color: var(--danger) !important; }
.admin-btn.success { background-color: var(--success) !important; }

/* Listas do Admin (Categorias e Produtos) */
.item-list-row, .product-item { 
    display: flex !important; justify-content: space-between !important; align-items: center !important; 
    background: rgba(255,255,255,0.4) !important; padding: 12px 15px !important; border-radius: 15px !important; 
    margin-bottom: 10px !important; text-align: left;
}

.btn-row, .item-actions { display: flex; gap: 8px; }

.btn-tool, .btn-action { 
    padding: 8px 12px !important; border: none !important; border-radius: 8px !important; 
    font-weight: 800 !important; font-size: 0.8rem !important; cursor: pointer !important; 
    color: #fff !important; width: auto !important; margin: 0 !important;
}
.btn-edit { background-color: var(--edit) !important; }
.btn-del { background-color: var(--danger) !important; }

/* =========================================
   7. NOVO CARRINHO FLUTUANTE (ESTILO iFOOD)
   ========================================= */
.cart-bar { 
    position: fixed !important; 
    bottom: 20px !important; 
    left: 20px !important; 
    right: 20px !important; 
    width: calc(100% - 40px) !important; 
    max-width: 440px; 
    margin: 0 auto;
    background-color: var(--card-color) !important; 
    border: 2px solid var(--text-color) !important; 
    padding: 20px !important; 
    border-radius: 30px !important; 
    display: none; flex-direction: column; gap: 15px; 
    z-index: 9999 !important; 
    box-shadow: 0 10px 30px rgba(150, 91, 76, 0.25) !important; 
}

.cart-bar.visible { display: flex !important; }
.cart-notes-input { width: 100%; padding: 12px; border: none !important; border-radius: 15px; background: var(--white) !important; font-family: inherit; font-weight: 600; }
.cart-total strong { font-size: 1.6rem; font-weight: 800; color: var(--text-color); }
.checkout-btn { background-color: var(--btn-color) !important; color: var(--white) !important; padding: 14px 22px; border-radius: 18px; font-weight: 800; text-decoration: none; display: flex; gap: 8px; justify-content: center; }

/* =========================================
   8. MODAIS (FIXO E CENTRALIZADO)
   ========================================= */
.modal-overlay { 
    position: fixed !important; top: 0 !important; left: 0 !important; 
    width: 100vw !important; height: 100vh !important; 
    background: rgba(0, 0, 0, 0.8) !important; 
    display: none; justify-content: center; align-items: center; 
    z-index: 10000 !important; 
}
.modal-overlay.open { display: flex !important; }
.modal-content { 
    width: 90% !important; 
    max-width: 450px !important; /* Trava largura do modal no PC */
    margin-bottom: 0 !important; 
    animation: scaleUp 0.3s forwards; 
}
@keyframes scaleUp { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =========================================
   9. AJUSTES PARA PC E CELULAR (RESPONSIVIDADE)
   ========================================= */

/* Ajustes específicos para Celular */
@media (max-width: 767px) {
    h1 { font-size: 2.4rem; }
    .product-card { padding: 15px; gap: 10px; }
    .product-img { width: 70px; height: 70px; }
    .product-title { font-size: 1.2rem; }
    .product-price { font-size: 1.1rem; }
    
    /* Faz o carrinho ocupar a largura toda no rodapé do celular */
    .cart-bar { 
        bottom: 0 !important; 
        left: 0 !important; 
        right: 0 !important; 
        width: 100% !important; 
        max-width: none !important; 
        border-radius: 20px 20px 0 0 !important; 
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
    }
}

/* Ajustes para PC */
@media (min-width: 768px) {
    .container { max-width: 1200px; }
    .admin-container { max-width: 900px; } 

    #product-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
    
    .info-cards-wrapper { 
        display: grid; 
        grid-template-columns: repeat(4, 1fr); 
        gap: 20px; 
    }
    .info-card { margin-bottom: 0 !important; min-height: 250px; display: flex; flex-direction: column; justify-content: center; }

    .cart-bar { 
        width: 600px !important; 
        max-width: 600px !important; 
        left: 50% !important; 
        transform: translateX(-50%) !important; 
        bottom: 30px !important; 
        border-radius: 25px !important; 
    }
}
