/* estilos.css — Versión unificada ALTA MONTAÑA BIKE SHOP */

:root {
  --color-primario: #cc0000;
  --color-secundario: #00cc66;
  --color-fondo: #f4f4f4;
  --color-texto: #333;
  --color-blanco: #fff;
  --color-negro: #000;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--color-fondo);
  color: var(--color-texto);
}

/* ── Header (topbar con logo + cuenta) ── */
header.site-header {
  background-color: var(--color-negro);
  color: var(--color-blanco);
  padding: 0.9em 1.5em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6em;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
}

@media (max-width: 600px) {
  .logo-img { height: 36px; }
}

#headerCuenta {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.9em;
}

#headerCuenta a#nav-login {
  color: var(--color-blanco);
  text-decoration: none;
  font-weight: bold;
}

#headerCuenta a#nav-login:hover { color: var(--color-primario); }

#headerCuenta .cuenta-activa {
  display: none;
  align-items: center;
  gap: 0.5em;
  background: rgba(255,255,255,0.08);
  padding: 0.35em 0.8em;
  border-radius: 20px;
}

#headerCuenta .cuenta-activa.visible { display: flex; }

#headerCuenta .cuenta-activa i { color: var(--color-primario); }

#headerCuenta .link-panel-admin {
  color: var(--color-blanco);
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95em;
  display: none;
  align-items: center;
  gap: 0.3em;
  border-right: 1px solid rgba(255,255,255,0.25);
  padding-right: 0.6em;
}

#headerCuenta .link-panel-admin.visible { display: inline-flex; }
#headerCuenta .link-panel-admin:hover { color: var(--color-primario); }

#headerCuenta .cuenta-email {
  font-weight: bold;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Ícono de carrito con badge ── */
.carrito-link {
  position: relative;
  color: var(--color-blanco);
  font-size: 1.3em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  animation: carritoBalanceo 3.5s ease-in-out infinite;
}

.carrito-link:hover { color: var(--color-primario); }

.carrito-badge {
  display: none;
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--color-primario);
  color: var(--color-blanco);
  font-size: 0.62em;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@keyframes carritoBalanceo {
  0%, 80%, 100% { transform: rotate(0deg); }
  82% { transform: rotate(-12deg); }
  85% { transform: rotate(10deg); }
  88% { transform: rotate(-8deg); }
  91% { transform: rotate(5deg); }
  94% { transform: rotate(0deg); }
}


#headerCuenta .btn-cerrar-sesion {
  background: var(--color-primario);
  color: var(--color-blanco);
  border: none;
  padding: 0.3em 0.7em;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: bold;
  cursor: pointer;
}

#headerCuenta .btn-cerrar-sesion:hover { background: #a80000; }

/* ── Nav ── */
nav {
  background-color: var(--color-primario);
  text-align: center;
  padding: 1em 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav a {
  color: var(--color-blanco);
  margin: 0 1.2em;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s;
}

nav a:hover { color: var(--color-secundario); }

/* ── Hero ── */
.hero {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-blanco);
  text-align: center;
  position: relative;
  background-size: cover;
  background-position: center;
  background-color: #6e6e6e; /* gris de respaldo mientras no haya foto */
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.hero h1 { position: relative; z-index: 1; margin: 0; }

/* ── Grid de productos ── */
.products {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 2em;
  gap: 2em;
}

.product {
  background-color: var(--color-blanco);
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 1em;
  width: 250px;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  transition: transform 0.3s ease, border-color 0.3s;
  text-align: center;
}

.product:hover {
  transform: translateY(-5px);
  border-color: var(--color-primario);
}

.product img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #f8f8f8;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.2s;
}

.product img:hover { transform: scale(1.04); }

.product h3 {
  margin: 0.6em 0 0.3em;
  font-size: 1em;
}

.precio {
  font-weight: bold;
  color: var(--color-secundario);
  font-size: 1.1em;
  margin: 0.3em 0;
}

/* ── Botones ── */
.button {
  display: inline-block;
  background-color: var(--color-secundario);
  color: var(--color-blanco);
  padding: 0.5em 1em;
  margin: 0.3em;
  border-radius: 5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.3s;
}

.button:hover { background-color: #00994d; }
.button.btn-red { background-color: var(--color-primario); }
.button.btn-red:hover { background-color: #a80000; }

.button.btn-whatsapp {
  background-color: #25D366;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}
.button.btn-whatsapp:hover { background-color: #1ebc59; }
.button.btn-whatsapp:disabled { opacity: 0.6; cursor: not-allowed; }

.button.btn-agregar-carrito {
  background-color: var(--color-primario);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}
.button.btn-agregar-carrito:hover { background-color: #a80000; }
.button.btn-agregar-carrito:disabled { opacity: 0.7; cursor: not-allowed; }

.stock-disponible {
  font-size: 0.8em;
  color: #777;
  margin: 0.2em 0 0.5em;
}

.compra-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  flex-wrap: wrap;
  margin-top: 0.3em;
}

.input-cantidad {
  width: 56px;
  padding: 0.4em;
  border: 1px solid #ccc;
  border-radius: 5px;
  text-align: center;
  font-size: 0.9em;
}

/* ── Selector de color (puntitos) — admin.html ── */
.paleta-colores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin-top: 0.4em;
}

.punto-color {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #ddd;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}

.punto-color:hover { transform: scale(1.12); }

.punto-color[data-nombre="Blanco"] { border-color: #ccc; }

.punto-color.seleccionado {
  border-color: #1a1a2e;
  box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.18);
}

.punto-color.seleccionado::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,0.85);
}

.color-seleccionado-texto {
  font-size: 0.85em;
  color: #666;
  margin: 0.5em 0 0;
}

/* ── Puntitos de color mini — tarjetas y ficha de producto ── */
.colores-mini {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
  margin-left: 0.4em;
}

.punto-mini {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.18);
  display: inline-block;
}

.ficha-tecnica .colores-mini { margin-left: 0.3em; }

/* ── Precio con descuento ── */
.precio-con-descuento {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  flex-wrap: wrap;
}

.precio-original {
  font-size: 0.8em;
  color: #999;
  text-decoration: line-through;
  font-weight: normal;
}

.precio-final {
  color: var(--color-primario);
  font-weight: bold;
}

.badge-descuento {
  background-color: var(--color-primario);
  color: #fff;
  font-size: 0.72em;
  font-weight: bold;
  padding: 0.15em 0.5em;
  border-radius: 10px;
  white-space: nowrap;
}

/* ── Buscador ── */
.buscador-wrap {
  max-width: 480px;
  margin: 1.2em auto;
  padding: 0 1em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: var(--color-blanco);
  border: 1px solid #ccc;
  border-radius: 30px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.buscador-wrap i { color: #999; }

.buscador-wrap input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.8em 0;
  font-size: 1em;
  background: transparent;
}

/* ── Footer ── */
footer {
  background-color: var(--color-negro);
  color: var(--color-blanco);
  text-align: center;
  padding: 1.5em;
  margin-top: 3em;
}

.social-links a {
  margin: 0 1em;
  color: var(--color-blanco);
  text-decoration: none;
  font-size: 1.4em;
}

.social-links a:hover { color: var(--color-secundario); }

/* ── WhatsApp flotante ── */
.whatsapp-float {
  position: fixed;
  width: 60px;
  height: 60px;
  bottom: 40px;
  left: 40px;
  background-color: #25d366;
  color: var(--color-blanco);
  border-radius: 50px;
  text-align: center;
  font-size: 30px;
  box-shadow: 2px 2px 3px #999;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  text-decoration: none;
  animation: whatsappPulso 2.5s ease-in-out infinite;
}

.whatsapp-float:hover { background-color: #128C7E; transform: scale(1.1); }

@keyframes whatsappPulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,211,102,.5), 2px 2px 3px #999; }
  50% { box-shadow: 0 0 0 12px rgba(37,211,102,0), 2px 2px 3px #999; }
}

/* ── Índice: secciones fullscreen ── */
.fullscreen-section {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2em;
  color: var(--color-blanco);
  text-align: center;
  background-size: cover;
  background-position: center;
  position: relative;
}

.fullscreen-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 0;
}

.fullscreen-section > * { position: relative; z-index: 1; }

.destacado {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: rgba(0,0,0,0.7);
  border-radius: 10px;
}

.destacado h1, .destacado h2 { margin: 0 0 0.5em; }

.buscador-global {
  margin: 1em auto 0.5em;
  max-width: 420px;
}

.resultados-busqueda-global {
  max-width: 420px;
  margin: 0 auto 1em;
  text-align: left;
}

.resultados-busqueda-global:empty { display: none; }

.resultado-item {
  display: flex;
  align-items: center;
  gap: 0.8em;
  background: var(--color-blanco);
  border-radius: 8px;
  padding: 0.5em 0.8em;
  margin-bottom: 0.4em;
  text-decoration: none;
  color: var(--color-negro);
  transition: background-color 0.2s;
}

.resultado-item:hover { background-color: #f0f0f0; }

.resultado-item img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}

.resultado-item .resultado-info { flex: 1; min-width: 0; }

.resultado-item .resultado-nombre {
  font-weight: bold;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resultado-item .resultado-precio {
  font-size: 0.82em;
  color: var(--color-secundario);
}

.resultado-sin-coincidencias {
  background: var(--color-blanco);
  color: #888;
  border-radius: 8px;
  padding: 0.6em 0.8em;
  font-size: 0.85em;
  text-align: center;
}

/* ── Carrusel ── */
.carrusel-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.carrusel-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carrusel-slide.active { opacity: 1; }

/* ── Login ── */
.login-container {
  max-width: 420px;
  margin: 80px auto 3em;
  padding: 2.5em;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  text-align: center;
}

.login-container h2 { color: var(--color-primario); margin-bottom: 1.5em; }

.form-group { margin-bottom: 1.4em; text-align: left; }
.form-group label { display: block; margin-bottom: 0.4em; font-weight: bold; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8em;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1em;
}

.form-group textarea { height: 110px; resize: vertical; }

.btn-login {
  width: 100%;
  padding: 0.85em;
  background-color: var(--color-primario);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-login:hover { background-color: #a80000; }
.error-message { color: var(--color-primario); margin-top: 1em; font-weight: bold; }

/* ── Carrito page ── */
main.carrito-main {
  max-width: 1050px;
  margin: 2em auto;
  padding: 1em;
  display: flex;
  flex-wrap: wrap;
  gap: 2em;
}

.carrito-section, .pago-section {
  flex: 1;
  min-width: 300px;
  background: white;
  padding: 1.5em;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.producto-carrito {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.8em 0;
  border-bottom: 1px solid #eee;
}

.producto-info { flex: 2; }
.producto-cantidad { display: flex; align-items: center; }
.btn-cant {
  background: #eee; border: none; border-radius: 4px;
  padding: 3px 10px; cursor: pointer; font-size: 1em;
}
.btn-cant:hover { background: #ddd; }
.producto-precio { flex: 1; text-align: right; color: var(--color-secundario); font-weight: bold; }
.producto-acciones { margin-left: 8px; }

.total {
  font-size: 1.2em;
  font-weight: bold;
  text-align: right;
  margin-top: 1em;
  padding-top: 1em;
  border-top: 2px solid #eee;
}

.btn-eliminar {
  background: var(--color-primario);
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 5px;
  cursor: pointer;
}

.btn-eliminar:hover { background: #990000; }

.metodo-pago { margin-bottom: 1.5em; padding-bottom: 1.5em; border-bottom: 1px solid #eee; }
.metodo-pago h3 { margin-bottom: 0.5em; }
.tarjeta-iconos { display: flex; gap: 10px; margin: 0.5em 0 1em; font-size: 2em; color: #555; }

.volver {
  display: inline-block;
  margin-top: 1.5em;
  text-decoration: none;
  background: var(--color-secundario);
  color: #fff;
  padding: 0.75em 1.5em;
  border-radius: 6px;
  transition: background 0.3s;
}

.volver:hover { background: #00994d; }

/* ── Página de Producto ── */
.producto-detalle {
  max-width: 900px;
  margin: 2em auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,.1);
  overflow: hidden;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.producto-imagen {
  flex: 1;
  min-width: 280px;
}

.producto-imagen img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #f8f8f8;
  border-radius: 8px;
  cursor: zoom-in;
  transition: transform 0.2s;
}

.producto-imagen img:hover { transform: scale(1.02); }

.producto-info-detalle {
  flex: 1;
  min-width: 280px;
  padding: 2em;
}

.producto-info-detalle h1 { margin-top: 0; color: var(--color-texto); }

.producto-info-detalle .precio {
  font-size: 1.6em;
  margin: 0.5em 0 1em;
}

.ficha-tecnica {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.95em;
}

.ficha-tecnica td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
}

.ficha-tecnica td:first-child {
  font-weight: bold;
  color: #555;
  width: 40%;
}

.btn-wa {
  display: inline-block;
  background: #25d366;
  color: white;
  padding: 0.7em 1.5em;
  border-radius: 6px;
  text-decoration: none;
  margin-top: 0.5em;
  font-weight: bold;
  transition: background 0.3s;
}

.btn-wa:hover { background: #128C7E; }

/* ── Panel Admin ── */
.admin-container {
  max-width: 960px;
  margin: 2em auto;
  padding: 0 1em 3em;
}

.admin-tabs {
  display: flex;
  gap: 0;
  background: #eee;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  margin-bottom: 0;
}

.admin-tab {
  flex: 1;
  padding: 0.9em;
  background: #ddd;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95em;
  transition: background 0.2s;
}

.admin-tab.active { background: var(--color-primario); color: white; }
.admin-tab:hover:not(.active) { background: #ccc; }

.admin-panel {
  background: white;
  padding: 2em;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,.08);
  display: none;
}

.admin-panel.active { display: block; }

.btn-guardar {
  width: 100%;
  padding: 0.9em;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.05em;
  cursor: pointer;
  transition: background 0.3s;
  margin-top: 0.5em;
}

.btn-guardar:hover { background: #1e8449; }

.imagen-preview {
  max-width: 200px;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 8px;
  display: none;
  border: 1px solid #ddd;
}

/* Tabla de productos en admin */
.tabla-productos {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.tabla-productos th {
  background: var(--color-primario);
  color: white;
  padding: 10px 8px;
  text-align: left;
}

.tabla-productos td {
  padding: 8px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.tabla-productos tr:hover { background: #fafafa; }

.tabla-productos img {
  width: 55px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
}

.button-secundario {
  background-color: #777 !important;
}
.button-secundario:hover { background-color: #5a5a5a !important; }

/* ── Elementos visibles solo cuando el administrador tiene sesión iniciada ── */
.solo-admin { display: none !important; }
body.es-admin .solo-admin { display: inline-block !important; }

.btn-editar-catalogo {
  background-color: #1d63d8 !important;
}
.btn-editar-catalogo:hover { background-color: #124a9e !important; }

.tabla-productos input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* ── Modal genérico (usado por el descuento masivo) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
}

.modal-caja {
  background: var(--color-blanco);
  border-radius: 10px;
  padding: 1.5em;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-caja h3 { margin-top: 0; color: var(--color-primario); }

.preview-descuento-masivo {
  background: #f7f7f7;
  border-radius: 6px;
  padding: 0.6em 0.9em;
  margin-top: 0.5em;
  min-height: 1px;
}

.preview-descuento-masivo li { margin-bottom: 0.2em; }

.badge-cat {
  background: var(--color-secundario);
  color: white;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.8em;
}

.loading-spinner {
  text-align: center;
  padding: 3em;
  color: #888;
  font-size: 1.1em;
}

.loading-spinner i { font-size: 2em; display: block; margin-bottom: 0.5em; animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 650px) {
  nav a { margin: 0 0.5em; font-size: 0.85em; }
  .product { width: 90%; }
  .producto-detalle { flex-direction: column; }
  .admin-tabs { flex-direction: column; }
  .tabla-productos { font-size: 0.78em; }
}

/* ── Lightbox para ver imágenes en grande ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

#lightbox.abierto { display: flex; }

#lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  animation: lightboxEntrada 0.2s ease;
}

@keyframes lightboxEntrada {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

#lightboxCerrar {
  position: fixed;
  top: 18px;
  right: 24px;
  color: #fff;
  font-size: 2.2em;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightboxCerrar:hover { background: var(--color-primario); }

/* ── Badge de código en buscador global ── */
.resultado-codigo {
  font-size: 0.72em;
  background: #eee;
  color: #555;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  margin-left: 0.3em;
  font-family: monospace;
  vertical-align: middle;
}

/* ── Código visible en tarjeta de producto ── */
.producto-codigo-badge {
  font-size: 0.72em;
  font-family: monospace;
  color: #888;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0.15em 0.5em;
  display: inline-block;
  margin: 0.1em 0 0.3em;
  letter-spacing: 0.04em;
}
