/* Fuentes auto-hospedadas (sin render-blocking ni petición a Google) */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800; /* variable */
  font-display: swap;
  src: url("/fonts/archivo-latin.woff2") format('woff2');
}
@font-face {
  font-family: 'Questrial';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/questrial-latin.woff2") format('woff2');
}

/* PhoneRelax — estética de phonerelax.com (Shopify): azul marino, magenta, tarjetas redondeadas */
:root {
  --navy: #0E1B4D;
  --magenta: #D60BC6;
  --pink: #E8308A;
  --bg: #ffffff;
  --card-bg: #f7f7f9;
  --border: rgba(14, 27, 77, 0.12);
  --muted: #5c6180;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  color: var(--navy);
  background: var(--bg);
  line-height: 1.6;
}
h1, h2, h3, .brand { font-family: 'Questrial', 'Archivo', sans-serif; letter-spacing: 0.02em; }
a { color: var(--navy); }

/* Cabecera */
.site-header {
  background: var(--navy);
  color: #fff;
}
/* El contenido de la cabecera se alinea con el margen del contenido (mismo ancho que .container) */
.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
}
.brand { text-decoration: none; line-height: 1; }
.brand span {
  display: block;
  color: #fff;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.06em;
}
.site-nav { display: flex; align-items: center; gap: 26px; }
.site-nav a { color: #fff; text-decoration: none; font-size: 15px; }
.site-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.site-nav .cart-link { font-weight: 700; }
.cart-badge {
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  margin-left: 4px;
}

/* Hero */
.hero { position: relative; }
.hero img { width: 100%; height: 420px; object-fit: cover; display: block; }
.hero-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 42px;
  max-width: 560px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(14, 27, 77, 0.18);
}
.hero-card h1 { margin: 0; font-size: 26px; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.section { margin: 48px auto; }
.section > h2 { font-size: 30px; margin-bottom: 22px; }

/* Tarjetas de producto y de pasos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.card img { width: 100%; height: 260px; object-fit: contain; background: #fff; border-radius: 10px; }
.card h3 { margin: 14px 0 4px; font-size: 18px; }
.card .price { font-weight: 700; margin-bottom: 12px; }
.card p.step { color: var(--muted); font-size: 14.5px; }
.card .actions { margin-top: auto; }

/* Botones */
.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #16256b; }
.btn-magenta { background: var(--magenta); color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-danger-link { background: none; border: none; color: #b3261e; cursor: pointer; padding: 0; font-size: 14px; }
.btn-block { display: block; width: 100%; }

/* Producto */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 36px; }
.product-page img { width: 100%; border-radius: var(--radius); background: var(--card-bg); object-fit: contain; max-height: 480px; }
.product-page .price { font-size: 26px; font-weight: 700; }
input[type=number].qty-input { width: 80px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
@media (max-width: 760px) { .product-page { grid-template-columns: 1fr; } .hero img { height: 300px; } }

/* Tablas (carrito, pedidos) */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.table .num { text-align: right; }
.total-row td { font-weight: 700; font-size: 17px; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}
.errors { background: #fdecec; border: 1px solid #f5c2c0; border-radius: 8px; padding: 10px 16px; margin-bottom: 16px; color: #8c1d18; }

/* Avisos */
.flash { padding: 12px 24px; text-align: center; font-size: 15px; }
.flash.notice { background: #e7f6ec; color: #14532d; }
.flash.alert { background: #fdecec; color: #8c1d18; }

/* Estado del pedido (timeline) */
.status-steps { display: flex; gap: 0; margin: 26px 0; }
.status-step { flex: 1; text-align: center; position: relative; color: var(--muted); }
.status-step::before {
  content: '';
  display: block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #d9dbe7;
  margin: 0 auto 8px;
}
.status-step.done { color: var(--navy); font-weight: 700; }
.status-step.done::before { background: var(--magenta); }
.badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
.badge.creado { background: #fff3cd; color: #7a5b00; }
.badge.enviado { background: #dbeafe; color: #1e3a8a; }
.badge.recibido { background: #dcfce7; color: #14532d; }
.badge.pendiente { background: #fdecec; color: #8c1d18; }
.badge.pagado { background: #dcfce7; color: #14532d; }

/* Pie */
.site-footer {
  background: var(--navy);
  color: #cdd3ea;
  margin-top: 64px;
  padding: 28px 24px;
  text-align: center;
  font-size: 14px;
}
.site-footer a { color: #fff; }

/* Admin */
.admin-header { background: var(--navy); color: #fff; }
.admin-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-header a { color: #fff; margin-right: 18px; text-decoration: none; }
.admin-header .active { text-decoration: underline; text-underline-offset: 6px; }
.admin-main { max-width: 1120px; margin: 28px auto; padding: 0 24px; }
.filter-tabs { margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.filter-tabs a {
  text-decoration: none;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
}
.filter-tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Carrusel del hero */
.carousel-slide { display: none; }
.carousel-slide.active { display: block; }
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.carousel-controls button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--navy);
  font-size: 22px;
  line-height: 1;
  padding: 4px 10px;
}
.carousel-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--navy) !important;
  padding: 0 !important;
  background: transparent;
}
.carousel-dot.active { background: var(--navy) !important; }

/* Bloque de vídeo (PhoneRelax para eventos) */
.video-block {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9.8;
  background: var(--card-bg);
}
.video-block img, .video-block iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  display: block;
}

/* Imágenes de los pasos de «¿Cómo funciona?» */
.card img.step-img { height: 300px; object-fit: contain; background: #fff; border-radius: 10px; }

/* Enlace al panel (solo con sesión de admin iniciada) */
.site-nav .admin-link {
  border: 1.5px solid var(--pink);
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--pink);
  font-weight: 700;
}
.site-nav .admin-link:hover { background: var(--pink); color: #fff; text-decoration: none; }

/* El carrusel va en el bloque central, con esquinas redondeadas */
.carousel .hero img { border-radius: var(--radius); }
.carousel .carousel-controls { border-bottom: 0; }

/* Botón flotante de WhatsApp */
.whatsapp-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.whatsapp-float:hover { transform: scale(1.08); }

/* Botón de quitar línea del carrito (papelera) */
.btn-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #d8b4b0;
  background: #fff;
  color: #b3261e;
  cursor: pointer;
}
.btn-trash:hover { background: #b3261e; border-color: #b3261e; color: #fff; }

/* Producto agotado: visible pero sin poder comprarse */
.btn-soldout {
  background: #e6e7ee;
  color: var(--muted);
  cursor: not-allowed;
  font-weight: 700;
}

/* Tarjetas de producto blancas: el fondo blanco de las fotos se funde y parecen transparentes */
.card.product-card, .card.step-card { background: #fff; border: 1px solid var(--border); }
.product-page img { background: #fff; border: 1px solid var(--border); }

/* Botón de play del bloque de vídeo */
.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--navy);
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(14, 27, 77, 0.3);
}
.video-play:hover { transform: translate(-50%, -50%) scale(1.06); }

/* Blog */
.blog-card img { height: 200px; object-fit: cover; }
.read-more { color: var(--magenta); font-weight: 700; text-decoration: none; }
.article { max-width: 760px; }
.article h1 { font-size: 34px; margin-bottom: 4px; }
.article-date { color: var(--muted); font-size: 14px; }
.article-cover { width: 100%; border-radius: var(--radius); margin: 18px 0; }
.article-body img { max-width: 100%; border-radius: 10px; }
.article-body h2, .article-body h3 { margin-top: 28px; }

select.form-select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; }

/* Galería de la ficha de producto */
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumb {
  width: 84px;
  height: 84px;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumb.active { border-color: var(--magenta); }
.product-description { margin: 10px 0 18px; }
.product-description img { max-width: 100%; border-radius: 10px; }
.product-description ul { padding-left: 20px; }

/* Gestión de imágenes de producto en el admin */
.admin-images { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.admin-image {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  background: #fff;
}
.admin-image img { width: 130px; height: 130px; object-fit: contain; display: block; margin-bottom: 6px; }
.add-image-form { display: flex; gap: 10px; max-width: 560px; }
.add-image-form input { flex: 1; }
trix-editor.trix-content { background: #fff; border: 1px solid var(--border); border-radius: 8px; min-height: 220px; }

.vat-note { color: var(--muted); font-size: 14px; margin-top: -6px; }

/* Campos con error: borde y etiqueta en rojo (Rails los envuelve en .field_with_errors) */
.field_with_errors input, .field_with_errors select, .field_with_errors textarea {
  border-color: #b3261e;
  background: #fdf3f2;
}
.field_with_errors label { color: #b3261e; }
.field_with_errors { display: contents; }

.shipping-note { color: var(--muted); font-size: 14px; margin-top: 8px; }

.site-footer .footer-contact { line-height: 1.9; }

/* Datos de contacto con mapa al lado */
.contact-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
.contact-details p { line-height: 2.1; margin: 0; }
.contact-map {
  width: 100%;
  height: 300px;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(14, 27, 77, 0.12);
}
@media (max-width: 760px) { .contact-details { grid-template-columns: 1fr; } }

/* Búsqueda y paginación del admin de pedidos */
.orders-search { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.orders-search-input { flex: 1; min-width: 260px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14.5px; }
.orders-search-select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14.5px; background: #fff; }
.pagy-nav-wrap { margin-top: 20px; text-align: center; }
.pagy-nav-wrap nav { display: inline-flex; gap: 6px; }
.pagy-nav-wrap a, .pagy-nav-wrap .current, .pagy-nav-wrap .gap {
  display: inline-block;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
}
.pagy-nav-wrap .current { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagy-nav-wrap a[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.badge.pagado { background: #dcfce7; color: #14532d; }

.admin-image-actions { display: flex; gap: 8px; justify-content: center; align-items: center; }
.btn-move { padding: 2px 10px !important; font-size: 14px; }

/* Badge rojo de pedidos pendientes de preparar (barra del admin) */
.nav-badge {
  background: #e5484d;
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: 2px;
}

/* Usuario y botón de salir en la barra del admin */
.admin-header-user { display: flex; align-items: center; gap: 14px; }
.admin-header-user span { color: #cdd3ea; }
.btn-exit {
  background: transparent;
  color: #ffb4ab;
  border: 1.5px solid rgba(255, 180, 171, 0.6);
  padding: 6px 16px;
  font-size: 14px;
}
.btn-exit:hover { background: #e5484d; border-color: #e5484d; color: #fff; }

/* --- Migas de pan (breadcrumbs) --- */
.breadcrumbs { margin: 4px 0 18px; font-size: 14px; }
.breadcrumbs ol {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; margin: 0; padding: 0;
}
.breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--magenta); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--navy); font-weight: 600; }

/* --- Preguntas frecuentes (FAQ) --- */
.faq .faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); margin-bottom: 12px; padding: 0 18px;
}
.faq .faq-item summary {
  cursor: pointer; list-style: none; padding: 16px 0;
  font-weight: 600; color: var(--navy); position: relative; padding-right: 28px;
}
.faq .faq-item summary::-webkit-details-marker { display: none; }
.faq .faq-item summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 22px; color: var(--magenta); line-height: 1;
}
.faq .faq-item[open] summary::after { content: "–"; }
.faq .faq-item p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; }

/* --- Selector de idioma --- */
.lang-switch { display: inline-flex; gap: 6px; align-items: center; margin-left: 10px; font-size: 14px; }
.lang-switch a { color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.lang-switch a:hover { color: var(--magenta); background: rgba(214,11,198,0.08); }
.lang-switch .lang-current { color: var(--navy); font-weight: 700; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; }

/* --- Galería de personalización (ejemplos reales con marca del cliente) --- */
.personalizacion-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.personalizacion-card { margin: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.personalizacion-card img { width: 100%; height: 300px; object-fit: cover; display: block; }
.personalizacion-card figcaption { padding: 12px 14px; font-weight: 600; color: var(--navy); font-size: 15px; text-align: center; }

/* --- Prueba social: centros que ya confían en PhoneRelax --- */
.trusted-by { text-align: center; }
.trusted-title { text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.trusted-logos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; }
.trusted-logos li { font-weight: 700; color: var(--navy); font-size: 17px; opacity: 0.85; }
