:root { 
    --primary: #C62828;   /* Vermelho Telha */
    --primary-dark: #8E0000;
    --accent: #FF8F00;    
    --bg: #FAFAFA; 
    --surface: #FFFFFF; 
    --text: #37474F; 
    --radius: 12px; 
    --shadow: 0 4px 15px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; outline: none; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); margin: 0; color: var(--text); padding-bottom: 80px; }

/* HEADER */
header { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 50; padding: 0.5rem 0; }
.header-content { max-width: 1200px; margin: 0 auto; padding: 0 15px; display: flex; justify-content: space-between; align-items: center; }
.brand-area { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-img { height: 55px; width: auto; border-radius: 50%; border: 2px solid var(--primary); }
.brand-title { margin: 0; font-size: 1.1rem; color: var(--primary); font-weight: 700; }
.brand-subtitle { font-size: 0.8rem; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; }

.cart-trigger { 
    background: var(--primary); color: white; padding: 10px 18px; border-radius: 50px; 
    font-weight: 600; cursor: pointer; border:none; display: flex; align-items: center; gap: 10px; 
    box-shadow: 0 4px 10px rgba(198, 40, 40, 0.3); transition: transform 0.2s; 
}
.cart-trigger:hover { transform: scale(1.05); }
.counter-badge { background: white; color: var(--primary); padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; font-weight: bold; }

/* PAGINAÇÃO */
.pagination-toolbar { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 20px; background: white; padding: 10px 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.pagination-toolbar select { width: auto; margin: 0; padding: 5px 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; }
.pagination-footer { display: flex; justify-content: center; gap: 5px; margin-top: 30px; flex-wrap: wrap; }
.page-btn { background: white; border: 1px solid #ddd; color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.page-btn:hover:not(:disabled) { background: #f1f1f1; }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* LAYOUT */
.container { max-width: 1200px; margin: 30px auto; padding: 0 15px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.scroll-menu { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 15px; }
.scroll-menu::-webkit-scrollbar { height: 0; }
.filter-btn { background: white; border: 1px solid #eee; padding: 8px 20px; border-radius: 20px; cursor: pointer; color: var(--text); white-space: nowrap; transition: 0.2s; }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ADMIN BAR */
#admin-bar { background: #37474F; color: white; padding: 10px 20px; margin: -30px auto 20px auto; max-width: 1200px; border-radius: 0 0 12px 12px; cursor: pointer; text-align: center; font-weight: 600; }

/* CARD */
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-img-container { height: 160px; background: #eee; overflow: hidden; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.card:hover img { transform: scale(1.05); }
.card-body { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.card-brand { font-size: 0.7rem; text-transform: uppercase; color: #90A4AE; font-weight: 600; }
.card-title { font-size: 1rem; margin: 5px 0; color: var(--text); font-weight: 600; }
.gram-badge { font-size: 0.75rem; background: #ECEFF1; color: #455A64; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-bottom: 5px; width: fit-content;}
.card-price { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-top: auto; }
.add-btn { width: 100%; padding: 12px; border: none; background: var(--text); color: white; font-weight: 600; cursor: pointer; }
.add-btn:hover { background: var(--accent); }

/* ADMIN TABLE */
.admin-toolbar { display: flex; gap: 10px; margin-bottom: 15px; }
#admin-search { flex: 1; margin: 0; padding: 12px; border-radius: 8px; border: 1px solid #ccc; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 10px; }
.admin-table thead th { text-align: left; background: #eceff1; padding: 12px; color: #455A64; border-bottom: 2px solid #ddd; }
.admin-table tbody td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.admin-table tbody tr:hover { background: #fafafa; }
.admin-table img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.admin-actions-cell button { margin-left: 5px; cursor: pointer; border: none; background: none; font-size: 1rem; }

/* MODALS & TABS */
.modal, .drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; display: none; align-items: center; justify-content: center; }
.modal-card.full-modal { width: 95%; max-width: 1000px; height: 90vh; display: flex; flex-direction: column; padding: 0; }
.modal-card { background: white; width: 90%; max-width: 500px; padding: 25px; border-radius: 15px; position: relative; max-height: 90vh; overflow-y: auto; }
.admin-tabs { display: flex; background: #f1f1f1; border-bottom: 1px solid #ddd; overflow-x: auto; }
.tab-btn { flex: 1; padding: 15px; border: none; background: transparent; cursor: pointer; font-weight: 600; color: #666; white-space: nowrap; }
.tab-btn.active { background: white; color: var(--primary); border-bottom: 3px solid var(--primary); }
.tab-content { padding: 20px; overflow-y: auto; flex: 1; background: #fff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* UTILS */
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 400px; max-width: 85%; background: white; z-index: 101; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s; }
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 20px; background: var(--primary); color: white; display:flex; justify-content:space-between; }
.drawer-body { flex:1; overflow-y:auto; padding:20px; }
.drawer-footer { padding:20px; background:#f5f5f5; border-top:1px solid #eee; }
.row-inputs { display: flex; gap: 10px; }
input, select, textarea { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; }
.btn-primary { width: 100%; background: #25D366; color: white; padding: 14px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
.btn-action { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.btn-action.small { padding: 8px 15px; font-size: 0.9rem; }
.btn-danger { background: #d32f2f; color: white; border: none; padding: 10px; border-radius: 6px; width: 100%; margin-top: 20px; cursor: pointer; }
.fab { position: fixed; bottom: 20px; left: 20px; background: #37474F; color: white; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 90; }
.cart-item { display: flex; gap: 10px; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 10px; }
.cart-item img { width: 50px; height: 50px; border-radius: 6px; }

/* Busca no Header */
.search-container { position: relative; flex: 1; max-width: 400px; margin: 0 20px; }
.search-container input { padding: 10px 40px 10px 15px; margin-bottom: 0; border-radius: 25px; border: 1px solid #eee; background: #f8f8f8; }
.search-container i { position: absolute; right: 15px; top: 12px; color: #999; }

/* Controles de Quantidade no Carrinho */
.qty-controls { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.qty-btn { background: #eee; border: none; width: 25px; height: 25px; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* Efeito Skeleton (Carregamento) */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: 8px; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Animação de entrada do Card */
.card { animation: fadeInUp 0.5s ease backwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } 

/* CARROSSEL */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 20px auto;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #eee;
    aspect-ratio: 1200 / 350; /* Mantém a proporção segura */
}

.carousel-slides {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.active { opacity: 1; z-index: 1; }

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Garante que preencha sem esticar */
}

.carousel-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}
.dot.active { background: white; transform: scale(1.2); }

/* ALERTA DO ADMIN */
.alert-box {
    background: #E3F2FD;
    color: #0D47A1;
    padding: 15px;
    border-radius: 8px;
    border-left: 5px solid #2196F3;
    font-size: 0.9rem;
}

/* LISTA DE BANNERS NO ADMIN */
.admin-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.admin-banner-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.admin-banner-item img { width: 100%; height: 80px; object-fit: cover; }
.btn-delete-float {
    position: absolute;
    top: 5px; right: 5px;
    background: red; color: white;
    border: none; border-radius: 50%;
    width: 25px; height: 25px;
    cursor: pointer;
}
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 17px;
}
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }