/*
Theme Name: Trakky
Theme URI: https://trakky.com
Author: Trakky Team
Author URI: https://trakky.com
Description: Tema personalizado para Trakky — e-commerce de consumo masivo. Diseño heredado del SPA React: paleta Navy/Orange/Cream, tipografía Instrument Serif + Inter Tight.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: trakky
Tags: e-commerce, woocommerce, custom
*/

/* =========================================================
   TRAKKY DESIGN SYSTEM
   Paleta: Navy #14142B · Orange #FF5F1F · Cream #FAF8F4
   ========================================================= */

:root {
  /* Brand colors */
  --ink: #14142B;
  --ink-soft: #2A2A3A;
  --navy-2: #1E1E3F;
  --navy-3: #2C2C55;
  --orange: #FF5F1F;
  --orange-2: #FF7A45;
  --orange-soft: #FFF0E8;
  --orange-deep: #E54D0F;
  --cream: #FAF8F4;
  --cream-2: #F4F1EA;
  --line: #EAEAE6;
  --line-2: #F1F1EC;
  --muted: #71717A;
  --muted-2: #A1A1AA;
  --white: #FFFFFF;
  --success: #1F8B4C;
  --warning: #B45309;
  --danger: #B91C1C;

  /* WhatsApp */
  --wa: #25D366;
  --wa-dark: #128C7E;
  --wa-soft: #E7F8EE;

  /* Typography */
  --font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", Cambria, Georgia, serif;

  /* Spacing / Radius */
  --radius: 10px;
  --radius-card: 14px;
  --container: 1360px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(20,20,43,.06), 0 1px 2px rgba(20,20,43,.04);
  --shadow-card-hover: 0 10px 28px -6px rgba(20,20,43,.10), 0 6px 12px -8px rgba(20,20,43,.06);
  --shadow-soft: 0 4px 12px rgba(20,20,43,.06), 0 2px 4px rgba(20,20,43,.04);
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-feature-settings: 'ss01', 'cv11';
  line-height: 1.5;
}
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: 30px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--orange); color: #fff; }

/* ============ CONTAINER ============ */
.container-x { max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container-x { padding: 0 24px; } }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: all .2s ease;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-deep); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-soft); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--line-2); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-dark); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { font-size: 16px; padding: 13px 24px; }
.btn-sm { font-size: 12px; padding: 6px 13px; }
.btn:disabled, .btn.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ============ FORMS ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all .15s ease;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(20,20,43,.1);
}
.field .error { color: var(--danger); font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

/* ============ TYPOGRAPHY ============ */
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 600; color: var(--muted); }

/* Price */
.price-lg { font-size: 24px; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }
@media (min-width: 768px) { .price-lg { font-size: 28px; } }
.price-old { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.price-off { font-size: 14px; font-weight: 600; color: var(--orange); }
.installments { font-size: 13px; color: var(--ink-soft); }

/* ============ BADGES / CHIPS ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chip-hot { background: var(--orange); color: #fff; }
.chip-new { background: var(--ink); color: #fff; }
.chip-free-ship { background: var(--wa-soft); color: var(--wa-dark); }
.chip-discount { background: var(--orange); color: #fff; }
.chip-cream { background: var(--cream-2); color: var(--ink); }

/* ============ TIMELINE ============ */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 16px; padding-bottom: 28px; position: relative; }
.timeline li:not(:last-child)::before {
  content: '';
  position: absolute;
  width: 2px;
  background: var(--line);
  left: 15px; top: 32px; bottom: 0;
}
.timeline li.done:not(:last-child)::before { background: var(--ink); }
.timeline .marker {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px; font-weight: 600;
}
.timeline li.done .marker { background: var(--ink); }
.timeline li.active .marker { background: var(--orange); box-shadow: 0 0 0 5px var(--orange-soft); }
.timeline .content h4 { font-size: 15px; margin: 0 0 2px; }
.timeline .content p { font-size: 14px; color: var(--muted); margin: 0; }

/* ============ TOAST ============ */
.toast-container { position: fixed; bottom: 5rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 768px) { .toast-container { bottom: 1.5rem; right: 1.5rem; } }
.toast {
  background: var(--ink); color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  min-width: 260px;
  animation: slideIn .25s cubic-bezier(.22,.61,.36,1);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ DRAWER ============ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,43,.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw;
  background: #fff; z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 24px -8px rgba(20,20,43,.2);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.65,.05,.36,1);
}
.drawer.open { transform: translateX(0); }
.drawer .drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.drawer .drawer-footer {
  flex-shrink: 0;
  background: #fff;
  box-shadow: 0 -2px 12px rgba(20,20,43,0.06);
}
@media (max-width: 767px) {
  .drawer {
    width: 100%;
    max-width: 100%;
    bottom: calc(62px + env(safe-area-inset-bottom, 0));
  }
}

/* ============ MOBILE BOTTOM NAV ============ */
@media (max-width: 767px) {
  body { padding-bottom: 62px; }
}
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--line); z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  display: none;
}
@media (max-width: 767px) { .bottom-nav { display: block; } }
.bottom-nav-inner { display: grid; grid-template-columns: repeat(4, 1fr); max-width: var(--container); margin: 0 auto; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 10px 0;
  font-size: 11px; font-weight: 500; color: var(--muted);
  position: relative;
}
.bottom-nav a.active { color: var(--orange); }
.bottom-nav a.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 2px; background: var(--orange); border-radius: 2px;
}

/* ============ CARDS ============ */
.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all .25s ease;
  display: flex; flex-direction: column;
  position: relative;
}
.product-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.product-card .pcard-media {
  position: relative;
  aspect-ratio: 1;
  background: var(--cream-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 12px;
}
.product-card .pcard-media img { width: 100%; height: 100%; object-fit: contain; }
.product-card .pcard-badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.product-card .pcard-free { position: absolute; bottom: 10px; left: 10px; z-index: 2; }
.product-card .pcard-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .pcard-name { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.product-card .pcard-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.product-card .pcard-price { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.product-card .pcard-old { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.product-card .pcard-footer { padding: 0 12px 12px; }

/* ============ STATS / ADMIN PANELS ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: #fff; padding: 24px; border-radius: var(--radius-card); border: 1px solid var(--line); }
.stat-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.stat-card .value { font-size: 30px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -0.02em; }
.stat-card .trend { font-size: 12px; font-weight: 500; color: var(--success); }
.stat-card .trend.down { color: var(--danger); }

.panel { background: #fff; border-radius: var(--radius-card); border: 1px solid var(--line); overflow: hidden; margin-bottom: 24px; }
.panel-header { padding: 16px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-header h3 { margin: 0; font-size: 16px; font-family: var(--font-sans); }
.panel-body { padding: 24px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.table th { background: var(--cream); font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.table tbody tr:hover { background: var(--cream); }
.table td.right, .table th.right { text-align: right; }
.table .thumb { width: 44px; height: 44px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; background: var(--cream-2); }
.table .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

/* Badges (admin + orders) */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-success { background: rgba(31,139,76,.1); color: var(--success); }
.badge-warning { background: rgba(180,83,9,.1); color: var(--warning); }
.badge-danger { background: rgba(185,28,28,.1); color: var(--danger); }
.badge-info { background: var(--orange-soft); color: var(--orange); }
.badge-muted { background: var(--line-2); color: var(--muted); }
.badge-orange { background: var(--orange); color: #fff; }
.badge-navy { background: var(--ink); color: #fff; }

/* Layout basics */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 16px; }

/* ============ ANIMATIONS ============ */
@keyframes slideIn { from { transform: translate(20px,10px); opacity: 0; } to { transform: translate(0,0); opacity: 1; } }

/* ============ HELPERS ============ */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }
.text-muted { color: var(--muted); }
.text-orange { color: var(--orange); }
.text-success { color: var(--success); }
.font-display { font-family: var(--font-display); }

/* ============ WOOCOMMERCE BASE OVERRIDES ============ */
.woocommerce ul.products { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none; }
@media (min-width: 768px) { .woocommerce ul.products { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .woocommerce ul.products { grid-template-columns: repeat(4, 1fr); } }
.woocommerce ul.products li.product { width: 100% !important; margin: 0 !important; float: none !important; }
.woocommerce a.button, .woocommerce button.button {
  border-radius: var(--radius) !important;
  background: var(--orange) !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 10px 18px !important;
}
.woocommerce a.button:hover, .woocommerce button.button:hover { background: var(--orange-deep) !important; }

/* Cart table */
.woocommerce table.shop_table { border: 1px solid var(--line); border-radius: var(--radius-card); }
.woocommerce table.shop_table th { background: var(--cream); }
.woocommerce .quantity .qty { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px; width: 70px; }

/* Checkout multistep */
.tk-step-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.tk-step { display: flex; align-items: center; gap: 8px; }
.tk-step .dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--line-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.tk-step.active .dot { background: var(--orange); color: #fff; }
.tk-step.done .dot { background: var(--ink); color: #fff; }
.tk-step:not(:last-child)::after {
  content: ''; width: 40px; height: 2px; background: var(--line);
}
.tk-step.done:not(:last-child)::after { background: var(--ink); }
.tk-step-steps .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.tk-step.active .label, .tk-step.done .label { color: var(--ink); }
