/* ═══════════════════════════════════════════════════════════
   PrimaveraShop — Folha de Estilos Principal v3
   Cores dinâmicas injectadas via <style> no PHP (--primary, etc.)
   ═══════════════════════════════════════════════════════════ */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --bg:            #f8fafc;
  --white:         #ffffff;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg:     0 10px 40px rgba(0,0,0,.14);
  --hero-start:    #1e3a8a;
  --hero-end:      #0e7490;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a     { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img   { display: block; max-width: 100%; }

/* ─── LAYOUT ─── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section   { padding: 32px 24px 60px; max-width: 1280px; margin: 0 auto; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 9px; font-size: .92rem;
  font-weight: 700; cursor: pointer; border: none;
  transition: background .18s, transform .1s;
  text-decoration: none; line-height: 1; font-family: inherit;
}
.btn:hover  { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #059669; color: #fff; }
.btn-outline  { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover  { background: var(--primary-light); }
.btn-sm   { padding: 7px 14px; font-size: .85rem; }
.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: .9rem; font-weight: 500;
  padding: 7px 10px; border-radius: 8px; transition: background .18s; font-family: inherit;
}
.btn-link:hover { background: var(--primary-light); text-decoration: none; }

/* ─── NAVBAR ─── */
.navbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.navbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 16px; height: 64px;
}
.navbar-brand {
  font-size: 1.2rem; font-weight: 800; color: var(--primary);
  text-decoration: none; letter-spacing: -.4px;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
.navbar-brand svg { width: 26px; height: 26px; flex-shrink: 0; }
.navbar-logo { max-height: 44px; max-width: 180px; object-fit: contain; }
.navbar-logo-fallback { display: flex; align-items: center; gap: 8px; }
.navbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-greeting   { font-size: .88rem; color: var(--text-muted); white-space: nowrap; }
.btn-cart {
  position: relative; background: var(--primary); color: #fff;
  border: none; border-radius: 50px; padding: 9px 18px;
  font-size: .88rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  transition: background .18s; white-space: nowrap; font-family: inherit;
}
.btn-cart:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.cart-badge {
  background: var(--warning); color: #fff;
  border-radius: 50%; width: 19px; height: 19px;
  font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: -5px; right: -5px;
} 

/* ─── HERO SIMPLES ─── */
.hero {
  background: linear-gradient(135deg, var(--hero-start) 0%, var(--primary) 50%, var(--hero-end) 100%);
  color: #fff; text-align: center; padding: 56px 24px;
}
.hero-logo { max-height: 80px; margin: 0 auto 18px; object-fit: contain; }
.hero h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: 10px; }
.hero p  { font-size: 1.05rem; opacity: .85; max-width: 500px; margin: 0 auto; }

/* ─── CARROSSEL ─── */
.carousel {
  position: relative; width: 100%; height: 300px;
  overflow: hidden; background: #0f172a;
}
.carousel-track {
  display: flex; height: 100%;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.carousel-slide {
  min-width: 100%; height: 100%;
  background-size: cover; background-position: center;
  position: relative; flex-shrink: 0;
}
.carousel-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.18) 0%, rgba(0,0,0,.62) 100%);
}
.carousel-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0 60px 52px;
  max-width: 800px;
}
.carousel-titulo {
  font-size: 2.2rem; font-weight: 800; color: #fff;
  line-height: 1.2; margin-bottom: 10px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.carousel-desc {
  font-size: 1.05rem; color: rgba(255,255,255,.88);
  max-width: 560px; line-height: 1.6;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
}
/* Botões seta */
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.18); backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  z-index: 10;
}
.carousel-btn:hover { background: rgba(255,255,255,.32); transform: translateY(-50%) scale(1.08); }
.carousel-prev { left: 18px; }
.carousel-next { right: 18px; }
/* Dots */
.carousel-dots {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.carousel-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.45); border: none; cursor: pointer;
  transition: background .2s, transform .2s; padding: 0;
}
.carousel-dot.active { background: #fff; transform: scale(1.3); }

/* ─── FILTERS BAR ─── */
.filters-bar {
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 64px; z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.filters-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 9px; padding: 0 12px;
  min-width: 200px; flex: 1; max-width: 320px;
  transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--primary); background: var(--white); }
.search-box input {
  border: none; background: transparent; padding: 9px 0;
  font-size: .9rem; width: 100%; outline: none; color: var(--text); font-family: inherit;
}
.search-clear { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: .85rem; padding: 2px 4px; border-radius: 4px; }
.search-clear:hover { color: var(--danger); background: #fee2e2; }
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: .78rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; text-transform: uppercase; letter-spacing: .4px; }
.filter-select {
  padding: 8px 28px 8px 10px; border: 1.5px solid var(--border);
  border-radius: 9px; font-size: .88rem; color: var(--text); background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  outline: none; transition: border-color .18s; font-family: inherit;
}
.filter-select:focus { border-color: var(--primary); }
.btn-clear-all {
  font-size: .82rem; font-weight: 600; color: var(--danger);
  border: 1.5px solid #fecaca; background: var(--white); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap; transition: background .18s;
}
.btn-clear-all:hover { background: #fee2e2; text-decoration: none; color: var(--danger); }

/* Badge de filtro activo */
.filter-active-info { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.filter-active-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: 50px; padding: 4px 10px; font-size: .8rem; font-weight: 600;
}
.filter-badge-remove { color: var(--primary); font-size: .75rem; margin-left: 2px; }
.filter-badge-remove:hover { color: var(--danger); }
.filter-count { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }

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

/* ─── PRODUCT CARD ─── */
.product-card {
  background: var(--white); border-radius: 14px;
  box-shadow: var(--shadow);
  /* SEM overflow:hidden — tooltip não é cortado */
  display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 36px rgba(0,0,0,.12); }

.product-img-wrap {
  position: relative; width: 100%; height: 196px;
  background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 100%);
  border-radius: 14px 14px 0 0; flex-shrink: 0;
}
.product-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 14px 14px 0 0; transition: transform .3s;
}
.product-card:hover .product-img-wrap img { transform: scale(1.04); }
.product-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px 14px 0 0;
}
.cat-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(37,99,235,.82); color: #fff;
  font-size: .7rem; font-weight: 700; padding: 3px 9px;
  border-radius: 50px; backdrop-filter: blur(4px);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}

/* ─── Botão ℹ + Tooltip Global ─── */
.info-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.info-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); border: 2px solid rgba(255,255,255,.6);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  transition: transform .15s, background .15s; padding: 0; flex-shrink: 0;
}
.info-btn:hover { transform: scale(1.12); }
.info-btn:focus { outline: 2px solid var(--primary-dark); outline-offset: 2px; }

.global-tooltip {
  display: none; position: absolute; z-index: 9999;
  width: 260px; max-width: calc(100vw - 24px);
  background: #1e293b; color: #fff;
  font-size: .83rem; line-height: 1.55; padding: 11px 14px;
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.28);
  pointer-events: auto; word-break: break-word;
}
.global-tooltip::after {
  content: ''; position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: #1e293b;
}
.global-tooltip.tip-below::after {
  top: auto; bottom: 100%;
  border-top-color: transparent; border-bottom-color: #1e293b;
}

/* ─── Card body ─── */
.product-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; min-height: 24px; }
.product-body { padding: 14px 16px; display: flex; flex-direction: column; flex: 1; }
.product-ref  { font-size: .72rem; color: var(--text-muted); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.product-name { font-size: .97rem; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 10px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price    { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; margin-top: auto; }
.product-price-na { font-size: .85rem; color: var(--text-muted); margin-bottom: 12px; margin-top: auto; font-style: italic; }
.btn-add {
  width: 100%; padding: 10px; border: none; border-radius: 9px;
  background: var(--primary); color: #fff;
  font-size: .9rem; font-weight: 700; cursor: pointer;
  transition: background .18s, transform .1s;
  display: flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit;
}
.btn-add:hover  { background: var(--primary-dark); }
.btn-add:active { transform: scale(.97); }

/* ─── PAGINATION ─── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--white); color: var(--text);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: all .18s; padding: 0 12px;
}
.page-btn:hover  { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-active     { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.page-disabled   { opacity: .38; pointer-events: none; }
.page-ellipsis   { color: var(--text-muted); padding: 0 4px; line-height: 38px; }
.pagination-info { text-align: center; margin-top: 12px; font-size: .84rem; color: var(--text-muted); }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 3.5rem; margin-bottom: 16px; }
.empty-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ─── ALERTS ─── */
.alert        { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: .92rem; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success{ background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert code   { font-size: .82rem; background: rgba(0,0,0,.06); padding: 2px 6px; border-radius: 4px; }

/* ─── FORM ─── */
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 9px; font-size: .95rem; color: var(--text);
  outline: none; transition: border-color .2s; font-family: inherit; background: var(--white);
}
.form-control:focus { border-color: var(--primary); }

/* ─── CART PANEL ─── */
.cart-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 190; backdrop-filter: blur(2px); }
.cart-overlay.open { display: block; }
.cart-panel {
  position: fixed; top: 0; right: -420px; width: 420px; max-width: 96vw;
  height: 100vh; background: var(--white); z-index: 200;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 40px rgba(0,0,0,.15);
  transition: right .3s cubic-bezier(.4,0,.2,1);
}
.cart-panel.open { right: 0; }
.cart-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.cart-header h2 { font-size: 1.15rem; font-weight: 800; }
.cart-close     { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 6px; border-radius: 8px; transition: background .18s; }
.cart-close:hover { background: var(--bg); color: var(--text); }
.cart-items     { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-empty     { color: var(--text-muted); text-align: center; padding: 40px 0; font-size: .95rem; }
.cart-item      { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: .93rem; font-weight: 700; margin-bottom: 2px; word-break: break-word; }
.cart-item-ref  { font-size: .78rem; color: var(--text-muted); margin-bottom: 8px; }
.cart-item-qty  { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qty-btn { width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--white); cursor: pointer; font-size: 1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; transition: all .15s; }
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: .95rem; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-obs-input { width: 100%; padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .82rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .18s; }
.cart-item-obs-input:focus { border-color: var(--primary); }
.btn-remove-item { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 6px; transition: all .15s; flex-shrink: 0; }
.btn-remove-item:hover { color: var(--danger); background: #fee2e2; }
.cart-footer { padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ─── MODAL ─── */
.modal { background: var(--white); border-radius: 16px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close  { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.1rem; padding: 4px; }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── TOAST ─── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 10px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; max-width: 320px; }
.toast.success { background: var(--success); color: #fff; }
.toast.danger  { background: var(--danger);  color: #fff; }
.toast.info    { background: var(--primary);  color: #fff; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── FOOTER ─── */
footer { background: var(--white); border-top: 1px solid var(--border); text-align: center; padding: 24px; color: var(--text-muted); font-size: .88rem; margin-top: 40px; }

/* ─── AUTH PAGES ─── */
.auth-page  { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card  { background: var(--white); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: .95rem; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .9rem; color: var(--text-muted); }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .carousel        { height: 360px; }
  .carousel-content{ padding: 0 40px 36px; }
  .carousel-titulo { font-size: 1.6rem; }
  .product-grid    { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (max-width: 640px) {
  .carousel        { height: 280px; }
  .carousel-content{ padding: 0 20px 28px; }
  .carousel-titulo { font-size: 1.25rem; }
  .carousel-desc   { font-size: .9rem; }
  .carousel-btn    { width: 38px; height: 38px; }
  .hero h1         { font-size: 1.5rem; }
  .navbar-inner    { padding: 0 16px; gap: 10px; }
  .nav-greeting    { display: none; }
  .filters-inner   { padding: 10px 16px; gap: 8px; }
  .search-box      { max-width: 100%; flex: 1 1 100%; }
  .filter-label    { display: none; }
  .product-grid    { grid-template-columns: 1fr 1fr; gap: 12px; }
  .section         { padding: 20px 16px 48px; }
  .cart-panel      { width: 100%; max-width: 100%; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
}
@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr; }
}


/* ─── PWA INSTALL BUTTON ─── */
.pwa-install-btn{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9500;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}
.pwa-install-btn:hover{ background: var(--primary-dark); }
.pwa-install-btn.hidden{ display:none; }

/* ─── RESPONSIVE (ENTERPRISE) ─── */
@media (max-width: 1024px){
  .container, .section{ padding-left: 16px; padding-right: 16px; }
  .navbar-inner{ padding: 0 16px; }
}
@media (max-width: 768px){
  .navbar-inner{ gap: 10px; }
  .navbar-actions{ gap: 8px; }
  .nav-greeting{ display:none; }
  .navbar-logo{ max-width: 140px; }
  .btn-cart{ padding: 9px 14px; }
  .filters{ grid-template-columns: 1fr; }
  .section{ padding-top: 18px; }
  .modal{ max-width: 94vw; }
  .toast-container{ right: 12px; bottom: 12px; }
}
@media (max-width: 480px){
  .navbar-inner{ height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .navbar-actions{ margin-left: 0; width: 100%; justify-content: space-between; }
  .btn{ padding: 10px 14px; }
  .btn-cart{ width: 100%; justify-content: center; }
  .product-img-wrap{ height: 170px; }
  .product-grid{ gap: 14px; }
}
