/* ============================================================
   tienda.css — Sistemas JM Tienda Online
   Paleta: Rojo #CC0000 | Negro #111 | Blanco #fff | Gris #f5f5f5
   Bootstrap 4.4.1 base
   ============================================================ */

:root {
  --red:    #CC0000;
  --red-dk: #aa0000;
  --black:  #111111;
  --white:  #ffffff;
  --gray:   #f5f5f5;
  --gray-2: #e9e9e9;
  --text:   #333333;
  --muted:  #888888;
  --border: #dddddd;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,.14);
}

/* ── Reset base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; color: var(--text); background: #fafafa; }
a { color: var(--red); }
a:hover { color: var(--red-dk); text-decoration: none; }

img { max-width: 100%; }

/* ── Barra superior ──────────────────────────────────────── */
.topbar-strip {
  background: var(--black);
  color: #ccc;
  padding: 5px 0;
  font-size: 12px;
}
.topbar-strip a { color: #ccc; }
.topbar-strip a:hover { color: #fff; }

/* ── Navbar ──────────────────────────────────────────────── */
.tienda-navbar {
  background: var(--black) !important;
  border-bottom: 3px solid var(--red);
  padding: 10px 0;
}
.tienda-navbar .navbar-toggler {
  border-color: rgba(255,255,255,.3);
}
.tienda-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(255,255,255,0.8)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Brand */
.brand-mark {
  width: 42px; height: 42px;
  background: var(--red);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.brand-sjm {
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -0.5px;
}
.brand-name {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.brand-tagline {
  color: #aaa;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Nav links */
.tienda-navbar .nav-link {
  color: rgba(255,255,255,.85) !important;
  font-size: 14px;
  padding: 6px 12px !important;
  transition: color .2s;
}
.tienda-navbar .nav-link:hover { color: #fff !important; }
.tienda-navbar .dropdown-menu {
  border: none;
  box-shadow: var(--shadow-hover);
  border-top: 3px solid var(--red);
  margin-top: 0;
}
.tienda-navbar .dropdown-item { font-size: 14px; padding: 8px 16px; }
.tienda-navbar .dropdown-item:hover { background: var(--gray); color: var(--red); }

/* Búsqueda navbar */
.navbar-search .form-control {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
}
.navbar-search .form-control::placeholder { color: rgba(255,255,255,.5); }
.navbar-search .form-control:focus {
  background: rgba(255,255,255,.15);
  border-color: var(--red);
  box-shadow: none;
  color: #fff;
}

/* Botón carrito */
.cart-nav-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  background: var(--red);
  border-radius: var(--radius);
  color: #fff;
  font-size: 16px;
  transition: background .2s;
  margin-left: 8px;
}
.cart-nav-btn:hover { background: var(--red-dk); color: #fff; }
.cart-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: #fff;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--black);
}

/* ── Carrito drawer (sidebar) ────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: 0; right: -380px;
  width: 360px;
  height: 100%;
  background: #fff;
  z-index: 1055;
  box-shadow: -4px 0 30px rgba(0,0,0,.2);
  transition: right .3s ease;
  display: flex; flex-direction: column;
}
.cart-drawer.open { right: 0; }
.cart-drawer-header {
  background: var(--black);
  color: #fff;
  padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.cart-drawer-header .btn-link { font-size: 22px; line-height: 1; padding: 0; }
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.cart-drawer-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.cart-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1050;
}
.cart-overlay.show { display: block; }

/* Item en drawer */
.drawer-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.drawer-item img {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.drawer-item-info { flex: 1; }
.drawer-item-name { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.drawer-item-price { font-size: 13px; color: var(--red); font-weight: 700; }

/* ── Hero Banner ─────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--black) 0%, #1a0000 60%, #3a0000 100%);
  color: #fff;
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(204,0,0,.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 30px;
  margin-bottom: 16px;
}
.hero-banner h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero-banner .lead { color: rgba(255,255,255,.75); }

/* ── Sección genérica ────────────────────────────────────── */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 4px;
}
.section-title span { color: var(--red); }
.section-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.section-divider {
  width: 48px; height: 3px;
  background: var(--red);
  border-radius: 2px;
  margin-bottom: 8px;
}

/* ── Cards de categorías ─────────────────────────────────── */
.cat-card {
  display: flex; flex-direction: column; align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  transition: all .25s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.cat-card:hover {
  border-color: var(--red);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  color: var(--text);
}
.cat-icon {
  width: 64px; height: 64px;
  background: #fff0f0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
  border: 2px solid #ffd0d0;
  transition: all .25s;
}
.cat-card:hover .cat-icon {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.cat-card h6 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.cat-card small { color: var(--muted); font-size: 12px; }

/* ── Cards de productos ──────────────────────────────────── */
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .25s;
  height: 100%;
  display: flex; flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #e0e0e0;
  transform: translateY(-2px);
}
.product-img-wrap {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: var(--gray);
}
.product-img-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 16px;
  transition: transform .3s;
}
.product-card:hover .product-img-wrap img {
  transform: scale(1.04);
}
.badge-featured {
  position: absolute; top: 10px; left: 10px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 30px;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-stock-low {
  position: absolute; top: 10px; right: 10px;
  background: #ff6b00; color: #fff;
  font-size: 10px; padding: 3px 8px; border-radius: 30px;
}
.badge-on-demand {
  position: absolute; top: 10px; right: 10px;
  background: #0066cc; color: #fff;
  font-size: 10px; padding: 3px 8px; border-radius: 30px;
}
.product-body {
  padding: 14px 16px;
  flex: 1;
  display: flex; flex-direction: column;
}
.product-brand {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 4px;
}
.product-name {
  font-size: 14px; font-weight: 600; line-height: 1.4;
  color: var(--text); margin-bottom: 8px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-rating { margin-bottom: 8px; }
.product-rating .stars { color: #f5a623; font-size: 12px; }
.product-rating small { color: var(--muted); font-size: 11px; }
.product-price-wrap { margin-bottom: 12px; }
.product-price {
  font-size: 20px; font-weight: 800;
  color: var(--red);
}
.product-compare {
  font-size: 13px; color: var(--muted);
  text-decoration: line-through; margin-left: 6px;
}
.product-discount {
  display: inline-block;
  background: #e8f5e9; color: #2e7d32;
  font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  margin-left: 6px;
}
.btn-add-cart {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  transition: background .2s;
}
.btn-add-cart:hover { background: var(--red-dk); }
.btn-add-cart:disabled { background: #ccc; cursor: not-allowed; }

/* ── Página de producto ──────────────────────────────────── */
.product-gallery .main-img {
  width: 100%; height: 420px;
  object-fit: contain;
  background: var(--gray);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}
.product-gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.product-gallery .thumb {
  width: 72px; height: 72px;
  object-fit: contain;
  background: var(--gray);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px;
  transition: border-color .2s;
}
.product-gallery .thumb.active { border-color: var(--red); }
.product-gallery .thumb:hover { border-color: var(--red); }

.product-detail-name { font-size: 1.6rem; font-weight: 800; line-height: 1.3; }
.product-detail-brand { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.product-detail-price { font-size: 2rem; font-weight: 800; color: var(--red); }
.product-detail-compare { font-size: 1rem; color: var(--muted); text-decoration: line-through; }

.qty-control { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: fit-content; }
.qty-control button {
  background: var(--gray);
  border: none;
  width: 36px; height: 40px;
  font-size: 18px; font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.qty-control button:hover { background: var(--red); color: #fff; }
.qty-control input { width: 50px; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 40px; font-size: 16px; }
.qty-control input:focus { outline: none; }

/* ── Tabs de descripción ─────────────────────────────────── */
.product-tabs .nav-tabs .nav-link {
  color: var(--text); font-size: 14px;
  border: none; border-bottom: 2px solid transparent;
  padding: 10px 16px;
}
.product-tabs .nav-tabs .nav-link.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 700;
}

/* ── Carrito (página) ────────────────────────────────────── */
.cart-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.cart-item-img { width: 72px; height: 72px; object-fit: contain; border-radius: 6px; background: var(--gray); padding: 4px; }

/* ── Checkout ────────────────────────────────────────────── */
.checkout-steps { display: flex; gap: 0; margin-bottom: 32px; }
.checkout-step {
  flex: 1; text-align: center; padding: 12px;
  background: var(--gray); border-right: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.checkout-step:last-child { border-right: none; }
.checkout-step.active { background: var(--red); color: #fff; font-weight: 700; }
.checkout-step.done { background: #e8f5e9; color: #2e7d32; }

.order-summary-card {
  background: var(--gray);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Formulario checkout ─────────────────────────────────── */
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(204,0,0,.15); }
.form-group label { font-size: 13px; font-weight: 600; color: #555; margin-bottom: 4px; }

/* ── Confirmación de orden ───────────────────────────────── */
.order-success { text-align: center; padding: 60px 20px; }
.order-success-icon { font-size: 64px; color: #28a745; margin-bottom: 20px; }
.order-number-badge {
  display: inline-block;
  background: var(--black);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  padding: 8px 24px;
  border-radius: 8px;
  letter-spacing: 1px;
  margin: 12px 0;
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--black);
  color: #aaa;
  margin-top: 60px;
}
.footer-brand { display: flex; align-items: center; margin-bottom: 12px; }
.brand-mark-footer {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--red);
  color: #fff; font-weight: 900; font-size: 12px;
  border-radius: 6px;
}
.footer-desc { font-size: 13px; line-height: 1.6; color: #888; }
.footer-contact p { font-size: 13px; margin-bottom: 4px; color: #888; }
.footer-title {
  color: #fff; font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 16px;
}
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: #888; font-size: 13px; }
.footer-links a:hover { color: var(--red); }
.footer-hr { border-color: rgba(255,255,255,.08); }
.footer-copy { color: #555; font-size: 12px; }

/* ── Admin Layout ────────────────────────────────────────── */
.admin-body { background: #f0f2f5; }

.admin-wrapper { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 230px;
  background: var(--black);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,.65);
  font-size: 14px;
  text-decoration: none;
  transition: all .2s;
}
.sidebar-nav li a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-nav li.active a { color: #fff; background: var(--red); }
.sidebar-nav li.active a:hover { background: var(--red-dk); }
.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  padding: 12px 16px 4px;
}

.admin-main { flex: 1; min-width: 0; }

.admin-header {
  background: #fff;
  height: 56px;
  padding: 0 20px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.admin-topbar {
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.admin-topbar h4 { color: var(--black); font-weight: 700; }

/* Stats en dashboard */
.stat-icon-box {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Tabla de admin */
.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  border-top: none;
}

/* Preview SERP en admin */
.serp-preview { border-left: 3px solid var(--red); }
.serp-url { color: #1a0dab; font-size: 13px; }
.serp-title { color: #1a0dab; font-size: 18px; font-weight: 500; }
.serp-desc { color: #545454; font-size: 13px; }

/* Barra de progreso SEO */
.progress { height: 3px; }
.progress-bar { background: var(--red); }
.progress-bar.bar-ok { background: #28a745; }
.progress-bar.bar-warn { background: #ffc107; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  background: none;
  padding: 12px 0;
  font-size: 13px;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); }
.breadcrumb-item.active { color: var(--muted); }
.breadcrumb-item a { color: var(--red); }

/* ── Alertas flash ───────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1080; }
.toast-sjm {
  background: var(--black); color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  font-size: 14px;
  margin-bottom: 8px;
  border-left: 4px solid var(--red);
  animation: slideInRight .3s ease;
}
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Botón WhatsApp flotante ─────────────────────────────── */
.whatsapp-float {
  position: fixed; bottom: 24px; left: 24px;
  width: 52px; height: 52px;
  background: #25D366;
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  z-index: 1000;
  transition: transform .2s;
  text-decoration: none;
}
.whatsapp-float:hover { transform: scale(1.1); color: #fff; }

/* ── Paginación ──────────────────────────────────────────── */
.pagination .page-link { color: var(--red); }
.pagination .page-item.active .page-link {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-banner h1 { font-size: 1.7rem; }
  .product-detail-price { font-size: 1.6rem; }
  .admin-sidebar { display: none; }
  .admin-sidebar.mobile-open { display: flex; position: fixed; z-index: 1050; width: 220px; height: 100%; flex-direction: column; }
  .cart-drawer { width: 100%; right: -100%; }
}

/* ── Utilidades ──────────────────────────────────────────── */
.text-red     { color: var(--red) !important; }
.bg-red       { background: var(--red) !important; }
.border-red   { border-color: var(--red) !important; }
.btn-red      { background: var(--red); color: #fff; border: none; }
.btn-red:hover{ background: var(--red-dk); color: #fff; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.rounded-lg   { border-radius: var(--radius) !important; }

/* Btn xs para tablas */
.btn-xs { padding: 2px 8px; font-size: 12px; }

/* Stock badge en tablas */
.stock-badge-ok  { background: #e8f5e9; color: #2e7d32; font-size: 11px; }
.stock-badge-low { background: #fff3e0; color: #e65100; font-size: 11px; }
.stock-badge-out { background: #fce4e4; color: #b71c1c; font-size: 11px; }
