/* ============================================================
   GLOBAL — Tokens de marca, header y footer compartidos.
   Se carga en TODAS las páginas del sitio.
============================================================ */

/* ---- Tokens de marca ---- */
:root {
  --primary:      #7C5CBF;
  --primary-dark: #6747a8;
  --primary-soft: #EDE6FB;
  --secondary:    #FF6B6B;
  --accent:       #FFD93D;
  --bg:           #FAFAFA;
  --bg-alt:       #F3EFFF;
  --dark:         #1A1A2E;
  --text:         #1A1A2E;
  --text-soft:    #666680;
  --white:        #fff;
  --line:         #ECE8F5;
  --r-card:       16px;
  --r-pill:       50px;
  --sh-sm:        0 2px 10px rgba(26,26,46,.06);
  --sh-md:        0 10px 28px rgba(26,26,46,.10);
  --sh-lg:        0 18px 44px rgba(124,92,191,.20);
}

/* ---- Reset mínimo ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---- Contenedor ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ---- Botones base (usados en header y en todas las páginas) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 15px;
  border-radius: var(--r-pill); padding: 12px 26px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 18px rgba(124,92,191,.35);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-cta {
  background: #FF6B6B; color: #fff;
  box-shadow: 0 6px 18px rgba(255,107,107,.35);
}
.btn-cta:hover { background: #E55A5A; transform: translateY(-2px); }
.btn-sm { padding: 9px 20px; font-size: 14px; }

/* ============================================================
   HEADER
============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: box-shadow .25s ease, border-color .25s ease;
}
/* Botón "Crear mi cuento" del header (clase .btn-cta): idéntico al de la
   home en TODAS las páginas — color, forma (8px) y tamaño. !important para
   ganar a .btn / .btn-sm globales y a los estilos de Blocksy. */
.site-header .btn-cta,
.site-header .btn-primary {
  background: #FF6B6B !important;
  background-image: none !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 12px 24px !important;
  font-family: 'Nunito', sans-serif !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  box-shadow: 0 4px 15px rgba(255,107,107,.3) !important;
}
.site-header .btn-cta:hover,
.site-header .btn-primary:hover {
  background: #E55A5A !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,107,107,.4) !important;
}
.site-header.scrolled {
  box-shadow: var(--sh-sm);
  border-color: var(--line);
}

.nav-container {
  display: flex; align-items: center;
  justify-content: space-between;
  height: 72px; gap: 24px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Nunito', sans-serif; font-size: 22px; font-weight: 800;
  color: #FF6B6B; text-decoration: none; flex-shrink: 0;
}
.logo .logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, #FF6B6B, #1A1A2E);
  box-shadow: var(--sh-sm);
}

.site-nav {
  display: flex; align-items: center; gap: 28px;
}
.site-nav a {
  font-weight: 600; font-size: 15px;
  color: var(--text-soft); text-decoration: none;
  transition: color .2s; position: relative;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: #FF6B6B; font-weight: 700; }
.site-nav a.active::after {
  content: ''; position: absolute;
  left: 0; right: 0; bottom: -26px;
  height: 3px; border-radius: 3px;
  background: #FF6B6B;
}

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

/* Icono de carrito con contador */
.cart-link {
  position: relative; display: inline-flex; align-items: center;
  font-size: 22px; line-height: 1; text-decoration: none;
  padding: 4px; transition: transform .15s;
}
.cart-link:hover { transform: scale(1.08); }
.cart-badge {
  position: absolute; top: -5px; right: -7px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  background: #FF6B6B; color: #fff; border-radius: 10px;
  font-family: 'Nunito', sans-serif; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 2px 6px rgba(255,107,107,.4);
}
.cart-badge[hidden] { display: none; }

.menu-toggle {
  display: none; background: none; border: none;
  font-size: 26px; color: var(--text); cursor: pointer;
  padding: 4px; line-height: 1;
}

/* Oculto en escritorio; solo visible dentro del drawer móvil */
.nav-close { display: none; }

/* Overlay oscuro para menú móvil */
.nav-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,26,46,.5); z-index: 8999;
}
.nav-overlay.show { display: block; }

/* ============================================================
   HEADER — RESPONSIVE
============================================================ */
@media (max-width: 900px) {
  .site-nav > a.btn { display: none; } /* CTA oculto en tablet (horizontal) */
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  /* NOTA: el drawer móvil completo se define inline en header.php
     (#cm-mobile-nav-css) para que sea inmune a la caché de CSS y
     tenga la última palabra en la cascada. No dupliques esas reglas aquí. */
}

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
  background: var(--dark); color: #cfcfe0;
  padding: 56px 0 28px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand .footer-logo {
  font-family: 'Nunito', sans-serif; font-size: 22px;
  font-weight: 800; color: #fff; text-decoration: none;
  display: inline-block; margin-bottom: 12px;
}
.footer-brand .footer-desc {
  font-size: 14px; color: #9b9bb5;
  max-width: 300px; line-height: 1.7;
}
.footer-brand .social-icons {
  display: flex; gap: 12px; margin-top: 16px; font-size: 20px;
}
.footer-col h4 {
  font-family: 'Nunito', sans-serif;
  color: #fff; font-size: 15px; margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 14px; color: #9b9bb5; transition: color .2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: 36px; padding-top: 20px;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 13px; color: #7a7a96;
}
.payment-icons { font-size: 20px; letter-spacing: 4px; }

/* Footer responsive */
@media (max-width: 992px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 576px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: center; text-align: center; }
}

/* ============================================================
   PÁGINA GENÉRICA (WooCommerce / páginas estándar)
   Wraps el contenido entre header y footer.
============================================================ */
.page-main {
  padding: 48px 0 80px;
  min-height: 60vh;
}

/* ============================================================
   PÁGINAS LEGALES (privacidad, términos)
============================================================ */
.legal-page { padding: 56px 0 80px; min-height: 60vh; }
.legal-page .container { max-width: 820px; }
.legal-page h1 {
  font-family: 'Nunito', sans-serif; font-size: 2rem; font-weight: 800;
  color: var(--dark); margin-bottom: 6px;
}
.legal-page .legal-updated {
  color: var(--text-soft); font-size: 14px; margin-bottom: 36px;
}
.legal-page h2 {
  font-family: 'Nunito', sans-serif; font-size: 1.25rem; font-weight: 700;
  color: var(--dark); margin: 32px 0 12px;
}
.legal-page p { color: var(--text-soft); line-height: 1.7; margin-bottom: 12px; }
.legal-page ul { padding-left: 20px; margin: 0 0 12px; }
.legal-page li { color: var(--text-soft); line-height: 1.7; margin-bottom: 6px; }
.legal-page strong { color: var(--text); }
.legal-page a { color: var(--primary); text-decoration: underline; }

/* ============================================================
   CART DRAWER
============================================================ */
.cart-drawer {
  position: fixed; inset: 0;
  z-index: 9500;
  pointer-events: none;
}
.cart-drawer.cd-open { pointer-events: auto; }

/* Overlay semitransparente */
.cd-overlay {
  position: absolute; inset: 0;
  background: rgba(26,26,46,.55);
  opacity: 0; transition: opacity .3s ease;
}
.cd-open .cd-overlay { opacity: 1; }

/* Panel lateral */
.cd-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(26,26,46,.15);
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
}
.cd-open .cd-panel { transform: translateX(0); }

/* Cabecera */
.cd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.cd-title {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 17px; color: var(--dark);
}
.cd-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-soft);
  background: var(--bg); border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.cd-close:hover { background: var(--line); color: var(--dark); }

/* Cuerpo scrollable */
.cd-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.cd-body:empty::after {
  content: 'Tu carrito está vacío.';
  display: block; text-align: center;
  margin-top: 40px; color: var(--text-soft); font-size: 14px;
}

/* Item */
.cd-item {
  display: grid; grid-template-columns: 64px 1fr auto;
  gap: 12px; align-items: start;
}
.cd-item-img {
  width: 64px; height: 64px; border-radius: 8px;
  object-fit: cover; background: var(--bg-alt);
  flex-shrink: 0;
}
.cd-item-img-placeholder {
  width: 64px; height: 64px; border-radius: 8px;
  background: var(--bg-alt); display: flex; align-items: center;
  justify-content: center; font-size: 26px; flex-shrink: 0;
}
.cd-item-info { min-width: 0; }
.cd-item-title {
  font-family: 'Nunito', sans-serif; font-weight: 700;
  font-size: 14px; color: var(--dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.cd-item-meta { font-size: 12px; color: var(--text-soft); margin-bottom: 5px; }
.cd-item-price { font-weight: 700; font-size: 14px; color: var(--primary); }
.cd-item-remove {
  font-size: 18px; color: var(--text-soft); line-height: 1;
  padding: 2px 4px; border-radius: 4px;
  transition: color .15s, background .15s; flex-shrink: 0;
}
.cd-item-remove:hover { color: var(--secondary); background: #fff0f0; }

/* Pie fijo */
.cd-foot {
  padding: 16px 20px 24px; border-top: 1px solid var(--line);
  flex-shrink: 0; display: flex; flex-direction: column; gap: 10px;
}
.cd-total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; color: var(--dark);
}
.cd-total-row strong { font-size: 20px; font-family: 'Nunito', sans-serif; }
.cd-btn-checkout {
  display: block; width: 100%; padding: 13px;
  text-align: center; border-radius: var(--r-pill);
  background: var(--primary); color: #fff;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 18px rgba(124,92,191,.35);
  transition: background .2s, transform .2s;
}
.cd-btn-checkout:hover { background: var(--primary-dark); transform: translateY(-1px); }
.cd-btn-continue {
  width: 100%; padding: 10px;
  border: 2px solid var(--line); border-radius: var(--r-pill);
  font-size: 14px; color: var(--text-soft);
  transition: border-color .15s, color .15s;
}
.cd-btn-continue:hover { border-color: var(--primary); color: var(--primary); }
