/* ============================================================
   Wabi Style — Global CSS
   ============================================================ */

/* ── Fuentes ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&display=swap');

/* Clash Display via CDN alternativo (Fontshare) */
@import url('https://api.fontshare.com/v2/css?f[]=clash-display@400,500,600,700&display=swap');

/* ── Variables CSS ────────────────────────────────────── */
:root {
  --wabi-bg: #F9F9F8;
  --wabi-surface: #FFFFFF;
  --wabi-black: #171717;
  --wabi-accent: #BC2435;
  --wabi-gray: #737373;
  --wabi-light-gray: #E5E5E5;
  --wabi-border: #E8E8E8;
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans', sans-serif;
  background-color: var(--wabi-bg);
  color: var(--wabi-black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Textura de ruido sutil */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
}

body.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-root {
  flex: 1 1 auto;
  min-height: 0;
}

::selection { background-color: var(--wabi-accent); color: white; }

/* Headings → Clash Display */
h1, h2, h3, h4, .font-clash { font-family: 'Clash Display', 'Inter', sans-serif; }

a { color: inherit; text-decoration: none; }

.link-underline { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Animaciones de Entrada ─────────────────────────────*/
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}

@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.view-enter { animation: fadeUp 0.5s ease forwards; }
.fade-in    { animation: fadeIn 0.4s ease forwards; }

/* ── Skeleton Loaders ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    #E8E8E8 25%,
    #F0F0F0 50%,
    #E8E8E8 75%
  );
  background-size: 468px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 2px;
}

.skeleton-text  { height: 1em; margin-bottom: 0.5em; border-radius: 2px; }
.skeleton-img   { width: 100%; border-radius: 0; }
.skeleton-btn   { height: 44px; border-radius: 2px; }
.skeleton-card  {
  background: var(--wabi-surface);
  border: 1px solid var(--wabi-light-gray);
  overflow: hidden;
}

.boot-loading,
.route-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-loading {
  min-height: 60vh;
}

.route-loading {
  padding: 10rem 1.5rem;
}

.boot-loading-inner {
  text-align: center;
}

.boot-loading-dot {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  margin: 0 auto 1rem;
}

.boot-loading-text {
  font-size: 0.875rem;
  color: var(--wabi-gray);
}

.route-loading-stack {
  width: 16rem;
}

.route-loading-line {
  height: 1rem;
  margin-bottom: 0.75rem;
}

.route-loading-line-lg {
  height: 1.5rem;
}

.route-loading-line-75 {
  width: 75%;
}

.route-loading-line-full {
  width: 100%;
}

.route-loading-line-83 {
  width: 83.333333%;
}

/* ── Toast Notifications ──────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--wabi-black);
  color: white;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-width: 280px;
  max-width: 380px;
  border-left: 3px solid var(--wabi-accent);
  box-shadow: var(--shadow-md);
  animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: all;
  cursor: pointer;
}

.toast.toast--success { border-left-color: #16a34a; }
.toast.toast--error   { border-left-color: #BC2435; }
.toast.toast--info    { border-left-color: #2563eb; }
.toast.toast--exit    { animation: slideInUp 0.3s ease reverse forwards; }

.toast-icon { flex-shrink: 0; width: 18px; height: 18px; }
.toast-msg  { flex: 1; line-height: 1.4; }

/* ── Cookie Banner ────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: var(--wabi-black);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  animation: slideInUp 0.4s ease forwards;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#cookie-banner p { font-size: 13px; line-height: 1.6; flex: 1; color: rgba(255,255,255,0.8); }
#cookie-banner a { color: white; text-decoration: underline; }

.cookie-btns { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn-accept {
  background: var(--wabi-accent);
  color: white;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
}
.cookie-btn-accept:hover { opacity: 0.85; }
.cookie-btn-reject {
  background: transparent;
  color: rgba(255,255,255,0.6);
  padding: 10px 16px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: color var(--transition);
}
.cookie-btn-reject:hover { color: white; }

@media (max-width: 640px) {
  #cookie-banner { flex-direction: column; align-items: flex-start; }
  .cookie-btns { width: 100%; }
  .cookie-btn-accept, .cookie-btn-reject { flex: 1; text-align: center; }
}

/* ── Cart Drawer ──────────────────────────────────────── */
#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

#cart-overlay.open { opacity: 1; pointer-events: all; }

#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--wabi-surface);
  z-index: 8001;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

#cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--wabi-light-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.cart-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--wabi-light-gray);
  background: var(--wabi-bg);
}

.cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--wabi-border);
}

.cart-item-img {
  width: 72px;
  height: 90px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--wabi-light-gray);
}

.cart-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cart-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--wabi-light-gray);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  font-size: 16px;
  line-height: 1;
}

.cart-qty-btn:hover { background: var(--wabi-bg); }

/* ── Navbar ───────────────────────────────────────────── */
#navbar {
  position: sticky;
  top: 0;
  z-index: 7000;
  background: rgba(249,249,248,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--wabi-border);
  transition: box-shadow var(--transition);
}

#navbar.scrolled { box-shadow: var(--shadow-sm); }

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo img { height: 44px; }

.nav-links {
  display: flex;
  gap: 36px;
  align-items: center;
}

.nav-link {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wabi-gray);
  transition: color var(--transition);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--wabi-accent);
  transition: width var(--transition);
}

.nav-link:hover, .nav-link.active { color: var(--wabi-black); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 16px; }

.cart-badge-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--wabi-black);
  transition: color var(--transition);
}

.cart-badge-btn:hover { color: var(--wabi-accent); }

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--wabi-accent);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--wabi-black);
}

/* Mobile nav */
#mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--wabi-surface);
  z-index: 6999;
  padding: 80px 32px 40px;
  flex-direction: column;
  gap: 32px;
}

#mobile-menu.open { display: flex; }

.mobile-nav-link {
  font-family: 'Clash Display', sans-serif;
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--wabi-black);
  transition: color var(--transition);
}

.mobile-nav-link:hover { color: var(--wabi-accent); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-link-account { display: none; }
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary { background: var(--wabi-black); color: white; }
.btn-primary:hover { background: var(--wabi-accent); }
.btn-accent  { background: var(--wabi-accent); color: white; }
.btn-accent:hover { opacity: 0.88; }
.btn-outline { background: transparent; color: var(--wabi-black); border: 1px solid var(--wabi-black); }
.btn-outline:hover { background: var(--wabi-black); color: white; }
.btn-ghost   { background: transparent; color: var(--wabi-gray); border: 1px solid var(--wabi-border); }
.btn-ghost:hover { color: var(--wabi-black); border-color: var(--wabi-black); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-full    { width: 100%; }

/* ── Forms ────────────────────────────────────────────── */
.wabi-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--wabi-gray);
  padding: 12px 4px;
  font-size: 14px;
  font-family: 'Noto Sans', sans-serif;
  color: var(--wabi-black);
  outline: none;
  transition: border-color var(--transition);
  border-radius: 0;
}

.wabi-input:focus { border-color: var(--wabi-black); }
.wabi-input::placeholder { color: var(--wabi-gray); font-weight: 300; }
.wabi-input.error { border-color: var(--wabi-accent); }

.wabi-input-box {
  width: 100%;
  background: var(--wabi-surface);
  border: 1px solid var(--wabi-light-gray);
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Noto Sans', sans-serif;
  color: var(--wabi-black);
  outline: none;
  transition: border-color var(--transition);
  border-radius: 0;
}

.wabi-input-box:focus { border-color: var(--wabi-black); }

.wabi-select {
  width: 100%;
  background: var(--wabi-surface);
  border: 1px solid var(--wabi-light-gray);
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Noto Sans', sans-serif;
  color: var(--wabi-black);
  outline: none;
  appearance: none;
  cursor: pointer;
  border-radius: 0;
}

.wabi-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wabi-gray);
  margin-bottom: 8px;
}

.field-group { margin-bottom: 24px; }

.form-error {
  font-size: 12px;
  color: var(--wabi-accent);
  margin-top: 4px;
  display: none;
}

/* ── Product Cards ────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--wabi-border);
}

.product-card {
  background: var(--wabi-surface);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition);
}

.product-card:hover .product-card-img { transform: scale(1.04); }
.product-card-img-wrap { overflow: hidden; aspect-ratio: 4/5; background: var(--wabi-bg); }
.product-card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }

.product-card-info { padding: 16px 20px 20px; }
.product-card-name { font-family: 'Clash Display', sans-serif; font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.product-card-price { font-size: 14px; color: var(--wabi-gray); }
.product-card-price-compare { text-decoration: line-through; color: var(--wabi-light-gray); margin-right: 6px; }
.product-card-price-main { color: var(--wabi-black); font-weight: 500; }

.out-of-stock-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--wabi-black);
  color: white;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 4px 10px;
}

/* ── Size / Color Selectors ───────────────────────────── */
.size-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--wabi-light-gray);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 52px;
  user-select: none;
}

.size-pill:hover:not(.disabled) { border-color: var(--wabi-black); }
.size-pill.active { border-color: var(--wabi-black); background: var(--wabi-black); color: white; }
.size-pill.disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  outline: 2px solid transparent;
  outline-offset: 3px;
}

.color-swatch:hover:not(.disabled) { outline-color: var(--wabi-gray); }
.color-swatch.active { outline: 2px solid var(--wabi-black); outline-offset: 3px; }
.color-swatch.disabled { opacity: 0.35; cursor: not-allowed; }
.color-swatch.disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 45%, white 45%, white 55%, transparent 55%);
}

/* ── Status Badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 2px;
}

.badge-pendiente  { background: #fef3c7; color: #92400e; }
.badge-pagado     { background: #d1fae5; color: #065f46; }
.badge-preparacion { background: #dbeafe; color: #1e40af; }
.badge-enviado    { background: #e0e7ff; color: #3730a3; }
.badge-devuelto   { background: #fee2e2; color: #991b1b; }
.badge-cancelado  { background: #f3f4f6; color: #4b5563; }

/* ── Admin Sidebar ────────────────────────────────────── */
#admin-layout {
  display: flex;
  min-height: 100vh;
}

#admin-sidebar {
  width: 240px;
  background: var(--wabi-black);
  color: white;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar-logo {
  padding: 28px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.admin-nav-item:hover { color: white; background: rgba(255,255,255,0.05); }
.admin-nav-item.active { color: var(--wabi-accent); border-left: 2px solid var(--wabi-accent); }

#admin-content {
  flex: 1;
  overflow-x: hidden;
}

/* ── Tables ───────────────────────────────────────────── */
.wabi-table { width: 100%; border-collapse: collapse; }
.wabi-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wabi-gray);
  padding: 12px 16px;
  border-bottom: 1px solid var(--wabi-border);
  background: var(--wabi-bg);
}

.wabi-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--wabi-border);
  vertical-align: middle;
}

.wabi-table tr:hover td { background: var(--wabi-bg); }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--wabi-surface);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp 0.3s ease;
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--wabi-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body   { padding: 28px; }
.modal-footer { padding: 20px 28px; border-top: 1px solid var(--wabi-border); display: flex; justify-content: flex-end; gap: 12px; }

/* ── Empty States ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--wabi-gray);
}

.empty-state-icon { width: 48px; height: 48px; margin: 0 auto 20px; opacity: 0.3; }
.empty-state h3   { font-family: 'Clash Display', sans-serif; font-size: 1.25rem; color: var(--wabi-black); margin-bottom: 8px; }
.empty-state p    { font-size: 14px; line-height: 1.6; }

/* ── Accordion (FAQ) ──────────────────────────────────── */
.accordion-item { border-bottom: 1px solid var(--wabi-border); }
.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--wabi-black);
  gap: 16px;
}

.accordion-trigger .icon { transition: transform var(--transition); flex-shrink: 0; }
.accordion-trigger.open .icon { transform: rotate(45deg); }
.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-body.open { max-height: 500px; }
.accordion-body-inner { padding: 0 0 20px; font-size: 14px; line-height: 1.8; color: var(--wabi-gray); }

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0;
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wabi-border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  color: var(--wabi-gray);
  transition: all var(--transition);
}

.page-btn:hover, .page-btn.active { border-color: var(--wabi-black); color: var(--wabi-black); background: var(--wabi-bg); }
.page-btn.active { background: var(--wabi-black); color: white; border-color: var(--wabi-black); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Utility ──────────────────────────────────────────── */
.divider      { height: 1px; background: var(--wabi-border); margin: 40px 0; }
.section-lead { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--wabi-accent); display: block; margin-bottom: 12px; }
.text-balance { text-wrap: balance; }

/* ── Responsive helpers ───────────────────────────────── */
@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  #admin-sidebar { display: none; }
  #admin-sidebar.mobile-open { display: flex; position: fixed; z-index: 9000; }
}
