/* ============================================================
   KINGCHIA — DESIGN SYSTEM
   Variables, tokens, componentes reutilizables
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@700;900&display=swap');

/* ──────────────────────────────────────────────
   CSS Custom Properties (Tokens)
────────────────────────────────────────────── */
:root {
  /* Colores base */
  --bg:          #F4F6FA;
  --bg-alt:      #E9ECF3;
  --card:        #FFFFFF;
  --text:        #1A1D2E;
  --text-sec:    #6B7280;
  --border:      #C8CAD0;

  /* Paleta KingChia — Azul / Cyan */
  --accent:       #3D68A8;
  --accent-hover: #2D5290;
  --accent-light: #D6E4F7;
  --accent-glow:  rgba(61,104,168,0.18);
  --accent-mid:   #07BCEB;

  /* Highlight / secundario cyan */
  --cyan:         #07BCEB;
  --cyan-hover:   #06A8D4;
  --cyan-light:   #D0F4FC;
  --cyan-glow:    rgba(7,188,235,0.18);

  /* Neutro brand */
  --silver:       #BCBCC0;
  --silver-light: #EAEAEC;

  /* Semáforo */
  --success:      #16A34A;
  --success-bg:   #DCFCE7;
  --warning:      #D97706;
  --warning-bg:   #FEF3C7;
  --danger:       #DC2626;
  --danger-bg:    #FEE2E2;
  --info:         #07BCEB;
  --info-bg:      #D0F4FC;

  /* Líneas de producto */
  --linea-eco-bg:  #FEF3C7;
  --linea-eco-txt: #92400E;
  --linea-std-bg:  #D6E4F7;
  --linea-std-txt: #2D5290;
  --linea-pre-bg:  #D0F4FC;
  --linea-pre-txt: #0588A8;

  /* Admin dark sidebar — azul marino oscuro */
  --sidebar-bg:      #0D1B35;
  --sidebar-hover:   #162444;
  --sidebar-active:  #3D68A8;
  --sidebar-text:    rgba(255,255,255,0.72);
  --sidebar-text-ac: #ffffff;
  --sidebar-border:  rgba(255,255,255,0.08);

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(26,29,46,0.06), 0 1px 2px rgba(26,29,46,0.04);
  --shadow-md:  0 4px 12px rgba(61,104,168,0.10), 0 2px 6px rgba(26,29,46,0.05);
  --shadow-lg:  0 12px 40px rgba(61,104,168,0.12), 0 4px 12px rgba(26,29,46,0.07);
  --shadow-xl:  0 24px 60px rgba(26,29,46,0.18);

  /* Radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transiciones */
  --tr-fast:   0.15s ease;
  --tr-base:   0.2s ease;
  --tr-slow:   0.35s cubic-bezier(0.16,1,0.3,1);

  /* Tipografía */
  --font-body:    'Outfit', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sec); }

/* ──────────────────────────────────────────────
   Tipografía
────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 13px; }
.text-base{ font-size: 15px; }
.text-lg  { font-size: 17px; }
.text-xl  { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black  { font-weight: 900; }
.text-muted  { color: var(--text-sec); }
.text-accent { color: var(--accent); }
.uppercase   { text-transform: uppercase; letter-spacing: 0.06em; }

/* ──────────────────────────────────────────────
   Botones
────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 18px; border-radius: var(--radius-md);
  font-weight: 600; font-size: 14px; cursor: pointer;
  border: 2px solid transparent; transition: all var(--tr-base);
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 4px 14px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-alt); color: var(--text); border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--text-sec); background: var(--bg); }

.btn-outline {
  background: transparent; color: var(--text); border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-ghost {
  background: transparent; color: var(--text-sec); border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-icon {
  padding: 9px; border-radius: var(--radius-md); width: 38px; height: 38px;
}
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; font-weight: 700; }

.btn-whatsapp {
  background: #25D366; color: #fff; border-color: #25D366;
}
.btn-whatsapp:hover { background: #1da851; }

/* ──────────────────────────────────────────────
   Formularios
────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--border); border-radius: var(--radius-md);
  font-size: 14px; color: var(--text); background: #fff;
  transition: border-color var(--tr-base), box-shadow var(--tr-base);
  outline: none; appearance: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: #B8B0A6; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input.error, .form-select.error { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-sec); }
.form-error { font-size: 12px; color: var(--danger); }
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.form-select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2378716C'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle {
  position: relative; width: 44px; height: 24px; border-radius: var(--radius-full);
  background: var(--border); transition: background var(--tr-base); flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform var(--tr-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(20px); }

/* ──────────────────────────────────────────────
   Badges y Chips
────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }
.badge-muted   { background: var(--bg-alt); color: var(--text-sec); }

.badge-linea-eco { background: var(--linea-eco-bg); color: var(--linea-eco-txt); }
.badge-linea-std { background: var(--linea-std-bg); color: var(--linea-std-txt); }
.badge-linea-pre { background: var(--linea-pre-bg); color: var(--linea-pre-txt); }

/* ──────────────────────────────────────────────
   Cards
────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ──────────────────────────────────────────────
   Tabla
────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.table th {
  text-align: left; padding: 11px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-sec);
  border-bottom: 2px solid var(--border); white-space: nowrap;
  background: var(--bg);
}
.table td {
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--tr-fast); }
.table tbody tr:hover { background: var(--bg); }

/* ──────────────────────────────────────────────
   Modal
────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,0.55);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease both;
}
.modal {
  background: var(--card); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 640px;
  max-height: 92vh; display: flex; flex-direction: column;
  animation: scaleIn 0.25s cubic-bezier(0.16,1,0.3,1) both;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
  background: var(--bg); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ──────────────────────────────────────────────
   Toast
────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; pointer-events: auto;
  box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  animation: slideUpToast 0.3s cubic-bezier(0.16,1,0.3,1) both;
}
.toast-success { background: #111; color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast .toast-icon { font-size: 16px; flex-shrink: 0; }

/* ──────────────────────────────────────────────
   Utilidades Layout
────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.grid { display: grid; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ──────────────────────────────────────────────
   Animaciones
────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideUpToast {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in    { animation: fadeIn 0.3s ease both; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease both; }
.animate-scale-in   { animation: scaleIn 0.3s cubic-bezier(0.16,1,0.3,1) both; }

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

/* ──────────────────────────────────────────────
   Responsive helpers
────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}

/* ──────────────────────────────────────────────
   Cinta de Imágenes Continua (Marquee)
   ────────────────────────────────────────────── */
.promo-marquee {
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 20px;
  overflow: hidden;
  position: relative;
}
.promo-marquee-inner {
  background: linear-gradient(135deg, #0D1B35 0%, #162444 100%);
  border-radius: var(--radius-lg);
  padding: 16px 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
}
.promo-marquee-track {
  display: flex;
  width: max-content;
  gap: 16px;
  animation: marquee-scroll 30s linear infinite;
  padding-left: 16px;
}
.promo-marquee:hover .promo-marquee-track {
  animation-play-state: paused;
}
.promo-marquee-item {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--tr-base);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.promo-marquee-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--tr-base);
}
.promo-marquee-item:hover {
  border-color: var(--cyan);
  box-shadow: 0 8px 20px rgba(7,188,235,0.3);
  transform: translateY(-2px);
}
.promo-marquee-item:hover img {
  transform: scale(1.08);
}

@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Animación de destello para producto seleccionado */
.highlight-flash {
  animation: flash-border 2s ease-in-out;
}
@keyframes flash-border {
  0%, 100% {
    box-shadow: none;
    border-color: var(--border);
  }
  20%, 80% {
    box-shadow: 0 0 20px rgba(7,188,235,0.8);
    border-color: var(--cyan);
    transform: scale(1.02);
  }
}

@media (max-width: 600px) {
  .promo-marquee-item {
    width: 90px;
    height: 90px;
  }
  .promo-marquee-inner {
    padding: 12px 0;
  }
}
