/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0a0a0a; --surface: #1a1a1a; --text: #f0f0f0; --text-muted: #9ca3af;
    --primary: #f5a623; --primary-light: #2a2000; --primary-dark: #d48f00;
    --accent: #25D366; --danger: #ef4444; --border: #333;
    --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1); --font: 'Inter', system-ui, sans-serif;
}
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar { background: #0047AB; color: #fff; padding: 0 16px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; display: flex; align-items: center; }
.logo-img { height: 40px; width: auto; }
.topbar-search { flex: 1; max-width: 400px; }
.topbar-search input { width: 100%; padding: 8px 14px; border: none; border-radius: 8px; background: rgba(255,255,255,.1); color: #fff; font-size: .9rem; outline: none; }
.topbar-search input::placeholder { color: rgba(255,255,255,.6); }
.topbar-search input:focus { background: rgba(255,255,255,.2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn-whatsapp-top { display: flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; padding: 7px 14px; border-radius: 8px; font-size: .85rem; font-weight: 600; transition: .2s; }
.btn-whatsapp-top:hover { filter: brightness(1.1); }

/* ── Main ────────────────────────────────────────────────── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 24px 16px 60px; min-height: calc(100vh - 160px); }

/* ── Hero Banner ─────────────────────────────────────────── */
.hero-banner { position: relative; width: 100%; overflow: hidden; border-radius: var(--radius); margin-bottom: 8px; }
.hero-slides { position: relative; width: 100%; aspect-ratio: 2.33; }
.hero-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.hero-slide.active { opacity: 1; }
.hero-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 2; }
.hero-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; background: transparent; cursor: pointer; padding: 0; transition: .3s; }
.hero-dot.active { background: #fff; }

.loja-hero { text-align: center; padding: 40px 0 24px; }
.loja-hero h1 { font-size: 2rem; font-weight: 400; color: var(--text-muted); }
.loja-hero h1 strong { color: var(--primary); font-weight: 800; }
.loja-hero p { color: var(--text-muted); margin-top: 6px; }

/* ── Categories ──────────────────────────────────────────── */
.cat-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 28px; }
.cat-pill { padding: 6px 16px; border-radius: 20px; font-size: .85rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); transition: .2s; }
.cat-pill:hover, .cat-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.search-result-info { text-align: center; margin-bottom: 20px; color: var(--text-muted); font-size: .9rem; }
.search-result-info a { color: var(--primary); margin-left: 8px; }

/* ── Product Grid ────────────────────────────────────────── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.product-grid.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.product-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: .3s; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.product-img { position: relative; aspect-ratio: 1; background: #222; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: contain; padding: 16px; transition: .3s; }
.product-card:hover .product-img img { transform: scale(1.05); }
.no-img { color: var(--text-muted); font-size: .85rem; }
.badge-destaque { position: absolute; top: 10px; left: 10px; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; }
.badge-desconto { position: absolute; top: 10px; right: 10px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; }

.product-info { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-cat { font-size: .7rem; text-transform: uppercase; color: var(--primary); font-weight: 600; letter-spacing: .5px; }
.product-title { font-size: .95rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-prices { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.price-old { font-size: .8rem; color: var(--text-muted); text-decoration: line-through; }
.price-current { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); }
.price-installment { display: block; font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.product-stock { font-size: .75rem; color: #16a34a; font-weight: 600; }
.product-voltagem { font-size: .7rem; color: var(--primary); font-weight: 600; background: var(--primary-light); padding: 2px 8px; border-radius: 4px; display: inline-block; }
.produto-voltagem { font-size: .85rem; color: var(--primary); font-weight: 600; background: var(--primary-light); padding: 4px 12px; border-radius: 6px; display: inline-block; margin-top: 4px; }
.product-sku { font-size: .7rem; color: var(--text-muted); margin-top: auto; }

/* ── Product Detail ──────────────────────────────────────── */
.breadcrumb { display: flex; gap: 6px; font-size: .8rem; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }

.produto-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
@media (max-width: 768px) { .produto-page { grid-template-columns: 1fr; gap: 24px; } }

.galeria-main { background: var(--surface); border-radius: var(--radius); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: var(--shadow); }
.galeria-main img { max-width: 90%; max-height: 90%; object-fit: contain; }
.no-img-big { color: var(--text-muted); font-size: 1.2rem; }
.galeria-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.galeria-thumbs img { width: 64px; height: 64px; object-fit: contain; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface); padding: 4px; transition: .2s; flex-shrink: 0; }
.galeria-thumbs img:hover, .galeria-thumbs img.active { border-color: var(--primary); }

.produto-detalhes { display: flex; flex-direction: column; gap: 12px; }
.produto-cat { font-size: .75rem; text-transform: uppercase; color: var(--primary); font-weight: 600; letter-spacing: .5px; }
.produto-titulo { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.produto-sku { font-size: .8rem; color: var(--text-muted); }

.produto-preco-box { background: var(--primary-light); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.preco-de { font-size: .85rem; color: var(--text-muted); text-decoration: line-through; }
.preco-por { font-size: 1.8rem; font-weight: 800; color: var(--primary-dark); }
.preco-parcela { display: block; font-size: .95rem; color: var(--text-muted); margin-top: 4px; }
.preco-parcela strong { color: var(--primary-dark); }
.preco-economia { font-size: .8rem; color: var(--accent); font-weight: 600; }

.estoque-badge { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: .8rem; font-weight: 600; }
.estoque-ok { background: #14532d; color: #86efac; }
.estoque-out { background: #7f1d1d; color: #fca5a5; }

.btn-comprar { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--accent); color: #fff; padding: 14px 24px; border-radius: var(--radius); font-size: 1.05rem; font-weight: 700; transition: .2s; border: none; cursor: pointer; width: 100%; }
.btn-comprar:hover { filter: brightness(1.1); transform: translateY(-1px); }

.produto-descricao { margin-top: 12px; }
.produto-descricao h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.descricao-text { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

.relacionados { margin-top: 40px; }
.relacionados h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; }

/* ── FAB WhatsApp ────────────────────────────────────────── */
.fab-whatsapp { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(37,211,102,.4); z-index: 999; transition: .2s; }
.fab-whatsapp:hover { transform: scale(1.1); }

/* ── Footer ──────────────────────────────────────────────── */
.footer { background: #111; color: rgba(255,255,255,.6); padding: 20px 16px; text-align: center; font-size: .8rem; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: center; gap: 16px; align-items: center; }
.footer-link { color: rgba(255,255,255,.8); }
.footer-link:hover { color: #fff; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }

/* ── Login ────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--primary); }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow-md); }
.login-card h1 { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-card p { color: var(--text-muted); font-size: .85rem; margin-bottom: 24px; }
.login-card input { display: block; width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; font-size: .9rem; outline: none; }
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.btn-login { width: 100%; padding: 10px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: .2s; }
.btn-login:hover { background: var(--primary-dark); }
.login-error { background: #7f1d1d; color: #fca5a5; padding: 8px 12px; border-radius: 6px; font-size: .85rem; margin-bottom: 12px; }

/* ── Admin ────────────────────────────────────────────────── */
.admin-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.admin-header h2 { font-size: 1.4rem; font-weight: 700; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-number { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 500; letter-spacing: .5px; }
.stat-ok .stat-number { color: #16a34a; }
.stat-warn .stat-number { color: #f59e0b; }
.stat-star .stat-number { color: var(--primary); }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--border); font-weight: 600; font-size: .75rem; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.td-thumb { width: 50px; }
.admin-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #222; }
.admin-thumb-empty { width: 44px; height: 44px; background: #222; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .75rem; }
.td-titulo { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-inativo { opacity: .5; }

.inline-input { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: .8rem; text-align: center; }
.inline-input:focus { border-color: var(--primary); outline: none; }
.qty-control { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.qty-btn { width: 28px; height: 28px; border: none; background: var(--primary-light); color: var(--primary); font-size: 1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s; }
.qty-btn:hover { background: var(--primary); color: #fff; }
.qty-value { min-width: 32px; text-align: center; font-size: .85rem; font-weight: 600; padding: 0 4px; }

.badge-toggle { border: none; padding: 3px 10px; border-radius: 4px; font-size: .75rem; font-weight: 600; cursor: pointer; transition: .2s; }
.badge-ativo { background: #14532d; color: #86efac; }
.badge-inativo { background: #7f1d1d; color: #fca5a5; }
.badge-destaque-btn { background: var(--border); color: var(--text-muted); font-size: .9rem; padding: 2px 6px; }
.badge-destaque-on { background: #422006; color: #fbbf24; }

.td-acoes { white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer; transition: .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-xs { padding: 2px 6px; font-size: .8rem; background: none; border: none; cursor: pointer; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.form-group input, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; outline: none; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.sku-row { display: flex; gap: 8px; }
.sku-row input { flex: 1; }

.fetch-status { font-size: .8rem; margin-top: 6px; }
.fetch-ok { color: #16a34a; font-weight: 600; }
.fetch-err { color: var(--danger); }

.form-actions { display: flex; gap: 8px; margin-top: 20px; }

.img-preview-row { display: flex; gap: 8px; flex-wrap: wrap; }
.img-thumb-preview { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; background: #222; padding: 4px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .topbar-inner { gap: 10px; }
    .topbar-search { display: none; }
    .logo { font-size: 1.1rem; }
    .loja-hero h1 { font-size: 1.4rem; }
    .loja-hero { padding: 24px 0 16px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-info { padding: 10px 12px 14px; }
    .product-title { font-size: .85rem; }
    .price-current { font-size: 1rem; }
    .produto-titulo { font-size: 1.2rem; }
    .preco-por { font-size: 1.4rem; }
    .admin-header { flex-direction: column; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
