/* ============================================================
   layout.css — Estructura general: navbar, toolbar, grid, footer
   ============================================================ */

/* — Reset — */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }
a      { text-decoration: none; }

/* — Navbar — */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--primary-dark);
  height: 68px; padding: 0 28px;
  display: flex; align-items: center; gap: 20px;
  box-shadow: 0 2px 16px rgba(47,111,122,.3);
}

.brand {
  font-family: var(--font-head); font-size: 1.15rem; font-weight: 800;
  color: #fff; letter-spacing: -.02em; white-space: nowrap; flex-shrink: 0;
}
.brand span { color: rgba(255,255,255,.55); font-weight: 400; }

/* Barra de búsqueda */
.search-wrap { flex: 1; max-width: 520px; position: relative; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--text-3); pointer-events: none;
}
#search-input {
  width: 100%;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius-btn);
  padding: 10px 16px 10px 42px;
  color: #fff; font-size: 16px; font-weight: 400;
  outline: none; transition: var(--transition);
}
#search-input::placeholder { color: rgba(255,255,255,.45); }
#search-input:focus {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.35);
  box-shadow: 0 0 0 3px rgba(255,255,255,.1);
}

/* Botón carrito en navbar */
.nav-cart-btn {
  margin-left: auto; flex-shrink: 0;
  background: var(--accent);
  color: #fff; font-family: var(--font-head); font-weight: 700; font-size: .88rem;
  padding: 10px 22px; border-radius: var(--radius-btn);
  display: flex; align-items: center; gap: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow-accent);
  position: relative; white-space: nowrap;
}
.nav-cart-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(244,162,97,.5); }
.nav-cart-btn:active { transform: translateY(0); }
.nav-cart-btn svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }

#cart-badge {
  background: #fff; color: var(--accent);
  border-radius: 50%; width: 20px; height: 20px;
  font-size: .68rem; font-weight: 800;
  display: none; align-items: center; justify-content: center; flex-shrink: 0;
}
#cart-badge.on { display: flex; }

/* — Toolbar (contador + acciones) — */
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
#results-count { font-size: .8rem; color: var(--text-3); font-weight: 500; }

/* — Contenido principal — */
.main { max-width: 1300px; margin: 0 auto; padding: 28px 28px 60px; }

/* — Grid de productos — */
#products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* — Paginación — */
#pagination { display: flex; justify-content: center; gap: 6px; padding: 32px 0 0; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-2);
  font-size: .85rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.page-btn:hover:not(.dots) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.dots { border: none; background: none; cursor: default; }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* — Estados: cargando / sin resultados / error — */
.state-box { text-align: center; padding: 80px 24px; color: var(--text-3); grid-column: 1/-1; }
.state-box strong { display: block; font-family: var(--font-head); font-size: 1rem; color: var(--text-2); margin-bottom: 8px; }
.state-box p { font-size: .85rem; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.no-results { grid-column: 1/-1; text-align: center; padding: 60px 0; color: var(--text-3); }
.no-results strong { display: block; font-size: .95rem; color: var(--text-2); margin-bottom: 4px; }

/* — Botones flotantes (FAB) — */
.fab-group { position: fixed; bottom: 28px; right: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; z-index: 150; }
.fab-wrap  { position: relative; display: flex; align-items: center; }
.fab-label {
  position: absolute; right: 58px;
  background: rgba(31,45,47,.88); color: #fff;
  font-size: .74rem; font-weight: 600;
  padding: 5px 11px; border-radius: 8px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .18s; backdrop-filter: blur(4px);
}
.fab-wrap:hover .fab-label { opacity: 1; }
.fab {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: transform var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.fab:hover  { transform: scale(1.1); box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.fab:active { transform: scale(.96); }
.fab-wa   { background: #25D366; }
.fab-ig   { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.fab-maps { background: #fff; border: 1.5px solid var(--border); }
.fab svg  { width: 24px; height: 24px; flex-shrink: 0; }

/* — Footer — */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.8);
  padding: 44px 28px 110px;
  margin-top: 40px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.footer-brand { font-family: var(--font-head); font-size: 1.4rem; font-weight: 800; color: #fff; margin-bottom: 10px; }
.footer-brand span { color: var(--primary); }
.footer-desc  { font-size: .84rem; line-height: 1.65; color: rgba(255,255,255,.6); max-width: 300px; }
.footer-social { display: flex; gap: 14px; margin-top: 18px; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.8); transition: var(--transition);
}
.footer-social a:hover { background: rgba(255,255,255,.22); color: #fff; }
.footer-social svg { width: 16px; height: 16px; }
.footer-section-title { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 14px; }
.footer-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-size: .84rem; color: rgba(255,255,255,.7); line-height: 1.5; }
.footer-row svg { width: 15px; height: 15px; stroke: var(--primary); flex-shrink: 0; margin-top: 2px; }
.footer-bottom { max-width: 1100px; margin: 32px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .76rem; color: rgba(255,255,255,.35); }

/* — Responsive — */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; gap: 12px; }
  .brand  { font-size: .95rem; }
  .main   { padding: 20px 16px 60px; }
  #products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .footer-inner  { grid-template-columns: 1fr; gap: 28px; }
  .footer { padding: 36px 20px 90px; }
}
@media (max-width: 480px) {
  .nav-cart-btn span.cart-label { display: none; }
}
