:root {
  --bg: #0b0e13;
  --bg-2: #11151d;
  --card: #151a22;
  --primary: #e11d2a;
  --primary-hover: #b3141f;
  --secondary: #0a2a6b;
  --secondary-hover: #0d327f;
  --text: #eef0f3;
  --muted: #9aa0ab;
  --border: #262c37;
  --error: #f87171;
  --success: #34d399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #141a26, var(--bg));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* La landing pública usa layout de bloque, no centrado */
body.landing-body {
  display: block;
  padding: 0;
}

/* ===== Tema Pura Tracción 4x4 (bandera CR + off-road) ===== */
.topbar { border-top: 4px solid var(--primary); }
.cr-stripe { height: 6px; background: linear-gradient(90deg, var(--secondary) 0 33%, #fff 33% 66%, var(--primary) 66% 100%); }
.hero-tagline { font-style: italic; color: var(--muted); margin-top: 12px; font-weight: 600; }
.hero-banner h1 .hl { color: var(--primary); }
.badge-order {
  display: inline-block; background: var(--primary); color: #fff;
  font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px; font-size: .8rem; margin-bottom: 14px;
}
.btn-whatsapp { background: #25d366 !important; color: #06331b !important; border-color: #25d366 !important; }
.btn-whatsapp:hover { background: #1eb257 !important; }
.trust-badges {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  max-width: 1100px; margin: 24px auto 0; padding: 0 20px;
}
.trust-badges .tb {
  background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--secondary);
  border-radius: 12px; padding: 14px; font-weight: 700; font-size: .9rem; text-align: center; color: var(--text);
}
.trust-badges .tb span { display: block; font-size: 1.5rem; margin-bottom: 6px; }
@media (max-width: 720px){ .trust-badges { grid-template-columns: repeat(2, 1fr); } }
/* Acentos bandera Costa Rica */
.features .feature-link:nth-of-type(odd) { border-top: 4px solid var(--primary); }
.features .feature-link:nth-of-type(even) { border-top: 4px solid var(--secondary); }
.cat-subhead { border-left: 5px solid var(--secondary); padding-left: 12px; }
.hero-banner { border-top: 5px solid var(--secondary); }
.cta { border-top: 4px solid var(--primary); }
/* Fondo blanco detras del logo para que resalte */
.topbar-brand img, .footer-logo, .brand, .brand-sm {
  background: #fff;
  padding: 6px 12px;
  border-radius: 12px;
}


.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}
.topbar .btn-secondary { color: #0b0e13; border-color: #cfd3da; background: #fff; }
.topbar .btn-secondary:hover { background: #f1f2f4; }
.topbar-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: #0b0e13;
  white-space: nowrap;
}
.topbar-title .hl-red { color: var(--primary); }
.topbar-title .hl-blue { color: var(--secondary); }
.topbar-actions, .topbar-right { flex-shrink: 0; }
.topbar .btn-inline { width: auto; white-space: nowrap; flex-shrink: 0; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  background: #fff; color: #0b0e13; border: 1px solid #cfd3da;
  border-radius: 10px; padding: 6px 12px; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
@media (max-width: 900px){ .topbar-title { display: none; } }
@media (max-width: 640px){
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar-brand img { height: 50px; }
  .nav-toggle { display: inline-flex; order: 4; }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .topbar .topbar-actions { display: none; width: 100%; flex-direction: column; gap: 8px; order: 5; }
  .topbar .topbar-actions.open { display: flex; }
  .topbar .btn-inline { width: 100%; justify-content: center; padding: 11px 14px; font-size: .95rem; }
  .cart-btn { order: 3; flex: 1 1 auto; }
}

.topbar-brand img {
  height: 66px;
  display: block;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.btn-inline {
  width: auto;
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  text-decoration: none;
}

.landing {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.hero {
  text-align: center;
  padding: 30px 0 40px;
}

.hero-logo {
  max-width: 320px;
  width: 80%;
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.hero-sub {
  color: var(--muted);
  margin-bottom: 22px;
  font-size: 1.05rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 20px 0;
}

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}

.feature h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.feature p {
  color: var(--muted);
  font-size: 0.92rem;
}

.cta {
  text-align: center;
  margin-top: 36px;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.cta p {
  margin-bottom: 16px;
  color: var(--text);
}

.cta-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
  text-align: center;
}

.card .subtitle {
  color: var(--muted);
  text-align: center;
  margin-bottom: 28px;
  font-size: 0.92rem;
}

/* Logo de marca */
.brand {
  display: block;
  width: auto;
  max-width: 260px;
  height: auto;
  margin: 0 auto 20px;
}

.brand-sm {
  display: block;
  width: auto;
  max-width: 170px;
  height: auto;
  margin: 0 auto 16px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
}

.field .hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.section-title {
  margin: 26px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 1.05rem;
  color: var(--text);
}

.admin-card {
  text-align: left;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-actions .btn {
  width: auto;
}

.table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.users-table th,
.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.users-table th {
  color: var(--muted);
  font-weight: 600;
}

.users-table select {
  padding: 6px 8px;
  width: auto;
}

.edit-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

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

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 8px 0 20px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.social-link.instagram {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.social-link.facebook {
  background: #1877f2;
}

.social-link:hover {
  opacity: 0.9;
}

.btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.link-row {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

.link-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.link-row a:hover {
  text-decoration: underline;
}

.message {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  text-align: center;
  display: none;
}

.message.error {
  display: block;
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.message.success {
  display: block;
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Dashboard */
.dashboard {
  max-width: 640px;
  text-align: center;
}

.dashboard .user-email {
  color: var(--primary);
  font-weight: 600;
}

.dashboard .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  margin-top: 20px;
}

.btn-secondary:hover {
  background: #0f172a;
}

/* Navegación superior por secciones */
.topnav {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.topnav a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.topnav a:hover {
  color: var(--text);
  background: #0f172a;
}

.topnav a.active {
  color: #fff;
  background: var(--primary);
}

/* Home: bloques informativos */
.home-block {
  text-align: left;
  margin: 20px 0;
  padding: 18px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.home-block h2 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.home-block p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Ficha médica */
.field-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.field-inline .field {
  flex: 1;
  min-width: 140px;
}

.radio-group {
  display: flex;
  gap: 18px;
  padding: 4px 0;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.radio-group input {
  width: auto;
  accent-color: var(--primary);
}

.age-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.notice {
  margin: 8px 0 20px;
  padding: 12px 14px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.checkbox-field input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--primary);
}

.checkbox-field label {
  font-size: 0.9rem;
  color: var(--text);
}

/* Accesos rápidos (dashboard) */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.quick-links .btn-inline {
  text-decoration: none;
}

/* Textarea con el mismo estilo que los inputs */
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Lista de direcciones */
.address-list,
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.address-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.address-item .btn-inline {
  padding: 8px 12px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Órdenes */
.order-item {
  padding: 14px 16px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.order-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pendiente  { background: rgba(148,163,184,.18); color: #cbd5e1; }
.status-en_proceso { background: rgba(99,102,241,.18);  color: #a5b4fc; }
.status-enviado    { background: rgba(56,189,248,.18);  color: #7dd3fc; }
.status-entregado  { background: rgba(52,211,153,.18);  color: #6ee7b7; }
.status-cancelado  { background: rgba(248,113,113,.18); color: #fca5a5; }

/* ===== Estilo tienda (catálogo / landing) ===== */
.hero-banner {
  background:
    linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.85)),
    linear-gradient(120deg, #17171b 0%, #2a0a0c 55%, var(--primary) 130%);
  border-bottom: 3px solid var(--primary);
  padding: 64px 20px;
  text-align: center;
}

.hero-banner-inner { max-width: 820px; margin: 0 auto; }

.hero-banner .since {
  display: inline-block;
  font-size: .8rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 16px;
}

.hero-banner h1 {
  font-size: 2.6rem;
  line-height: 1.05;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.hero-banner p { color: var(--muted); font-size: 1.05rem; margin-bottom: 22px; }

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn-inline, .cta-actions .btn-inline {
  flex: 0 1 240px;
  justify-content: center;
  text-align: center;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0;
}

.tagline {
  text-align: center;
  letter-spacing: 3px;
  font-size: .8rem;
  color: var(--muted);
  margin: 8px 0 24px;
  text-transform: uppercase;
}

.feature-link { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.feature-link:hover { border-color: var(--primary); transform: translateY(-2px); }

/* Buscador y filtros */
.finder {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.finder-results { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.finder-title { font-size: 1rem; margin-bottom: 4px; }

.fit-card, .product-card {
  background: #0f0f12;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.fit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(225,29,42,.15);
  color: #fca5a5;
  margin-right: 6px;
}
.pill-alt { background: rgba(148,163,184,.15); color: #cbd5e1; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.product-card { display: flex; flex-direction: column; }
.product-top { margin-bottom: 8px; }
.product-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.product-card .subtitle { text-align: left; margin-bottom: 8px; font-size: .85rem; }
.product-type { font-size: .78rem; color: var(--muted); margin-bottom: 12px; }
.product-card .wa-btn { margin-top: auto; }

.wa-btn { background: #25d366; color: #06331b; }
.wa-btn:hover { background: #1eb257; }

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  color: #0b0e13;
  padding: 32px 20px 20px;
  margin-top: 48px;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.footer-logo { height: 66px; }
.footer-contact strong { color: #0b0e13; }
.footer-contact p { margin: 2px 0; font-size: .9rem; color: #444; }
.footer-contact a { color: var(--primary); text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }
.footer-copy { text-align: center; color: #555; font-size: .8rem; margin-top: 18px; }

/* ===== Imagen de producto ===== */
.product-media {
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-media img { max-width: 100%; max-height: 100%; object-fit: contain; }
.add-btn { margin-top: auto; }

/* ===== Barra superior con carrito ===== */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.cart-btn { white-space: nowrap; }

/* ===== Panel del carrito ===== */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 40;
}
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,.5);
}
.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.cart-head h2 { font-size: 1.15rem; }
.cart-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer;
}
.cart-close:hover { color: var(--text); }
.cart-items { flex: 1; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; background: #0f0f12; border: 1px solid var(--border); border-radius: 10px;
}
.cart-item-info { min-width: 0; }
.cart-item-info .subtitle { text-align: left; font-size: .8rem; }
.qty { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: #17171b; color: var(--text);
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.qty-btn:hover { border-color: var(--primary); }
.qty-del { border: none; background: none; }
.qty-n { min-width: 22px; text-align: center; font-weight: 700; }
.cart-foot { padding: 18px 20px; border-top: 1px solid var(--border); }
.cart-note { font-size: .82rem; color: var(--muted); margin-bottom: 12px; text-align: center; }

/* ===== Showcase en landing ===== */
.showcase {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; margin: 28px 0;
}
.showcase img {
  width: 320px; max-width: 100%; background: #fff; border-radius: 12px; padding: 10px;
}
.showcase-text { flex: 1; min-width: 220px; }
.showcase-text h2 { margin-bottom: 8px; }
.showcase-text p { color: var(--muted); margin-bottom: 16px; }

/* Asegura que el carrito quede oculto cuando tiene el atributo hidden
   (el display:flex del drawer anulaba el hidden por defecto). */
.cart-drawer[hidden], .cart-overlay[hidden] { display: none !important; }

/* Chips de tipo de locker */
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #0f0f12; color: var(--muted);
  font-size: .88rem; font-weight: 600; transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Subtitulos de grupos del catalogo */
.cat-subhead {
  font-size: 1.15rem;
  margin: 22px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}

/* Divisor dentro de la seccion de filtros unificada */
.filter-divider { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
