/* ============ SURTÍA — DISEÑO CÁLIDO Y MODERNO ============
   Filosofía: crema acogedor + navy de marca + acentos cálidos.
   Redondeado, fotografía de producto en primer plano, mobile-first.
   Menos es más, pero con calidez — nada de brutalismo frío.
=========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- Paleta base (nombres legacy, valores nuevos: reskin automático) ---- */
  --black: #16223C;        /* antes negro puro → ahora navy de marca */
  --white: #FFFFFF;
  --gray-50:  #FCF8F1;
  --gray-100: #F6EEDF;
  --gray-200: #EFE3D2;
  --gray-300: #E0D2BB;
  --gray-400: #C9BBA0;
  --gray-500: #A99A7E;
  --gray-600: #7A6E5C;
  --gray-700: #55503F;
  --gray-800: #2E3550;     /* navy-soft, usado en sidebar admin */
  --gray-900: #16223C;     /* navy — fondo del sidebar admin */

  /* ---- Marca ---- */
  --cream:      #FBF3E7;   /* fondo principal del sitio */
  --navy:       #16223C;
  --navy-2:     #223A63;
  --blue:       #2F86EB;
  --blue-soft:  #E7F0FD;
  --terracotta:      #C1652E;
  --terracotta-soft: #F7E7DA;
  --teal:       #1FBE97;
  --teal-soft:  #E1F7F0;

  /* ---- Acentos funcionales (semántico, separado del acento decorativo) ---- */
  --accent: #2F86EB;
  --success: #1FBE97;
  --warning: #D98C1F;
  --danger: #D6524A;

  /* ---- Tipografía ---- */
  --font-display: 'Baloo 2', 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'Plus Jakarta Sans', -apple-system, sans-serif;

  /* ---- Espaciado ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;
  --space-16: 8rem;

  /* ---- Radios (redondeado, cálido) ---- */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* ---- Sombras (suaves, cálidas, solo elevación real) ---- */
  --shadow-sm: 0 8px 20px -14px rgba(34, 27, 18, 0.35);
  --shadow: 0 14px 30px -16px rgba(34, 27, 18, 0.32);
  --shadow-lg: 0 20px 44px -18px rgba(22, 34, 60, 0.35);

  /* ---- Transiciones ---- */
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ RESET ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--cream);
}

/* ============ TIPOGRAFÍA ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--navy);
}

h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.75rem); }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.15rem; }
h6 { font-size: 1rem; }

p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--gray-700);
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 800; }

.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-wide { letter-spacing: 0.04em; }

/* ============ LAYOUT ============ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section { padding: var(--space-12) 0; }
.section-sm { padding: var(--space-10) 0; }

/* ============ GRID ============ */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ============ FLEX ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============ HEADER ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 243, 231, 0.9);
  border-bottom: 1px solid var(--gray-200);
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 var(--space-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  transition: opacity var(--transition);
}

.logo:hover { opacity: 0.75; }

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Real product photography, used wherever avatar-circle initials used to
   stand in — sits behind an .avatar-circle fallback for a broken image URL */
.product-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
  background: var(--gray-100);
}

/* ============ NAV ============ */
.nav { display: flex; align-items: center; gap: var(--space-2); }

.nav-link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  position: relative;
}

.nav-link:hover { color: var(--navy); background: var(--gray-100); }
.nav-link.active { color: var(--white); background: var(--blue); }

/* Admin sidebar nav links sit on a dark rail — keep them legible there */
#admin-sidebar .nav-link { color: var(--gray-300); }
#admin-sidebar .nav-link:hover { color: var(--white); background: rgba(255,255,255,0.08); }
#admin-sidebar .nav-link.active { color: var(--white); background: var(--blue); }

/* ============ BUTTONS ============ */
button, .btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active, .btn:active { transform: translateY(0); box-shadow: none; }

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--gray-300);
}

.btn-outline:hover {
  background: var(--white);
  border-color: var(--navy);
  color: var(--navy);
}

.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); color: var(--navy); box-shadow: none; }

.btn-sm { padding: var(--space-2) var(--space-4); font-size: 0.8rem; border-radius: var(--radius-pill); }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: 1.05rem; }

/* Warm CTA variant for primary "buy" moments */
.btn-warm { background: var(--terracotta); }
.btn-warm:hover { background: #A8531F; }

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition);
}

.card:hover { border-color: transparent; box-shadow: var(--shadow); transform: translateY(-2px); }
.card.p-0 { padding: 0; overflow: hidden; }

.card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: var(--space-2); color: var(--navy); }
.card-description { color: var(--gray-600); font-size: 0.875rem; margin-bottom: var(--space-4); }

/* ============ AVATAR / PRODUCT PHOTO PLACEHOLDER ============ */
/* Colorful gradient circle standing in for real product photography */
.avatar-circle {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-circle--sm { width: 56px; height: 56px; font-size: 1.35rem; }
.avatar-circle--lg { width: 120px; height: 120px; font-size: 2.75rem; }

.avatar-circle--1 { background: linear-gradient(135deg, #F1CE9C, var(--terracotta)); }
.avatar-circle--2 { background: linear-gradient(135deg, #CFE0C6, #6E9C58); }
.avatar-circle--3 { background: linear-gradient(135deg, #C9DCEE, var(--blue)); }
.avatar-circle--4 { background: linear-gradient(135deg, #E7D3E4, #A97DA0); }

/* ============ PRODUCT CARD ============ */
.product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition);
  cursor: pointer;
}

.product-card:hover { border-color: transparent; box-shadow: var(--shadow); transform: translateY(-3px); }

.product-image {
  aspect-ratio: 1;
  background: var(--gray-50);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  transition: background var(--transition);
}

.product-info { padding: 0; }

.product-category {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: var(--space-2);
}

.product-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.product-price { font-size: 1.2rem; font-weight: 800; color: var(--navy); }

.product-stock { font-size: 0.75rem; color: var(--gray-500); margin-top: var(--space-2); }
.product-stock.low { color: var(--warning); }

/* ============ FORMS ============ */
.form-group { margin-bottom: var(--space-5); }

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-2);
}

input, select, textarea {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  transition: all var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

input::placeholder { color: var(--gray-400); }

textarea { resize: vertical; min-height: 120px; }

/* ============ BADGE ============ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--terracotta);
  color: var(--white);
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
}

.badge-outline {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 34, 60, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  z-index: 100;
  animation: fadeIn 0.2s;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-title { font-size: 1.4rem; font-weight: 700; color: var(--navy); }

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.modal-close:hover { color: var(--white); background: var(--navy); }

.modal-body { padding: var(--space-6); }

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  background: var(--navy);
  color: var(--white);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 200;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--teal); }
.toast-error { background: var(--danger); }

/* ============ TABLE ============ */
table { width: 100%; border-collapse: collapse; }

thead { border-bottom: 2px solid var(--navy); }

th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-3);
  color: var(--navy);
}

td {
  padding: var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.875rem;
  color: var(--gray-700);
}

tr:hover td { background: var(--gray-50); }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: var(--space-16) var(--space-6); }
.empty-icon { font-size: 3.5rem; margin-bottom: var(--space-4); opacity: 0.35; color: var(--navy); }
.empty-title { font-size: 1.4rem; font-weight: 700; margin-bottom: var(--space-2); color: var(--navy); }
.empty-description { color: var(--gray-600); margin-bottom: var(--space-6); }

/* ============ NEW BRAND COMPONENTS ============ */

/* Dark hero panel — used on the homepage, and anywhere a "marketing moment" is needed */
.hero-panel {
  background: linear-gradient(160deg, var(--navy-2), var(--navy));
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6) calc(var(--space-10));
  position: relative;
  overflow: hidden;
  color: var(--white);
}

.hero-panel::after {
  content: '';
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 75% 20%, rgba(47, 134, 235, 0.28), transparent 55%),
    radial-gradient(circle at 20% 85%, rgba(31, 190, 151, 0.22), transparent 55%);
  pointer-events: none;
}

.hero-panel > * { position: relative; }

.hero-panel h1 { color: var(--white); margin-bottom: var(--space-3); }
.hero-panel p { color: rgba(255,255,255,0.72); }

/* Search pill that overlaps the hero panel's bottom edge */
.search-pill {
  position: relative;
  margin-top: -28px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 2;
}

.search-pill input {
  border: none;
  padding: 0;
  font-size: 0.95rem;
}
.search-pill input:focus { box-shadow: none; }
.search-pill svg { flex-shrink: 0; color: var(--gray-400); }

/* Trust strip — three short reassurances under the hero */
.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }

.trust-strip .trust-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-2);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-600);
}

.trust-strip .trust-item .ic { display: block; font-size: 1.3rem; margin-bottom: var(--space-2); }

@media (max-width: 640px) {
  .trust-strip { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
  .trust-strip .trust-item { padding: var(--space-3) var(--space-1); font-size: 0.65rem; }
}

/* Category chip row */
.chip-row { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-1); }

.chip {
  flex: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--gray-200);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover { border-color: var(--navy); }
.chip.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* Floating quick-add button, sits on a product photo/avatar */
.addfab {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.addfab:hover { background: var(--blue); transform: scale(1.08); }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ UTILITIES ============ */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-black { color: var(--navy); }
.text-gray { color: var(--gray-600); }
.text-white { color: var(--white); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

.bg-black { background: var(--navy); }
.bg-white { background: var(--white); }
.bg-gray { background: var(--gray-100); }

.w-full { width: 100%; }
.w-auto { width: auto; flex: none; }
.h-full { height: 100%; }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-auto { margin-top: auto; }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.pt-6 { padding-top: var(--space-6); }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

.pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  :root { font-size: 15px; }
  .container { padding: 0 var(--space-4); }
}

@media (max-width: 640px) {
  :root { font-size: 14px; }

  .header-content { height: 60px; padding: 0 var(--space-4); }
  .nav { gap: 0; }
  .nav-link { padding: var(--space-2) var(--space-3); font-size: 0.813rem; }

  .section { padding: var(--space-10) 0; }

  .modal { margin: var(--space-4); }

  .toast { right: var(--space-4); top: var(--space-4); min-width: auto; max-width: calc(100vw - var(--space-8)); }

  .hero-panel { padding: var(--space-6) var(--space-4) var(--space-8); border-radius: var(--radius-lg); }
}

/* ============ ACCESSIBILITY ============ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

*:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ PRINT ============ */
@media print {
  .header, .nav, button, .btn { display: none; }
}
