.page {
  position: relative;
  min-height: 100px;
}
.marca-agua-bg {
  position: absolute;
  top: 24px;
  left: 55%;
  right: 16px;
  width: auto;
  height: 60%;
  background: url('../imagenes/LOGO_DISTRIBUCIONES_HEROLD.png') right center no-repeat;
  background-size: contain;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

/* Watermark centered only for Nosotros/Contacto pages */
.page.page-nosotros .marca-agua-bg,
.page.page-contacto .marca-agua-bg {
  display: none;
}

.page.page-nosotros,
.page.page-contacto {
  padding: 20px 20px 32px;
}

.page.page-nosotros .contenido-pagina,
.page.page-contacto .contenido-pagina {
  position: relative;
}

.page.page-nosotros .nosotros .container,
.page.page-contacto .contacto-wrapper {
  position: relative;
  overflow: hidden;
}

.page.page-nosotros .nosotros .container::before,
.page.page-contacto .contacto-wrapper::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  background: url('../imagenes/LOGO_DISTRIBUCIONES_HEROLD.png') center center no-repeat;
  background-size: contain;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.page.page-nosotros .nosotros .container > *,
.page.page-contacto .contacto-wrapper > * {
  position: relative;
  z-index: 1;
}
.contenido-pagina {
  position: relative;
  z-index: 1;
}
.marca-agua {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 40px;
  pointer-events: none;
}
.marca-agua img {
  opacity: 0.18;
  max-width: 70%;
  height: auto;
  filter: grayscale(10%) blur(0.5px);
}
@media print {
  .marca-agua img {
    opacity: 0.18 !important;
    filter: grayscale(10%) blur(0.5px) !important;
    max-width: 70% !important;
  }
}
body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 16px;
  /* Dejar espacio para la toolbar fija en la parte superior */
  padding-top: 78px;
}

.header {
  text-align: center;
  margin-bottom: 8px;
}
.header h1 { margin: 0; }

.controls-row { display: flex; justify-content: center; margin-bottom: 14px; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Fixed top toolbar (black background, white text) */
.toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  color: #000;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  border-bottom: 1px solid #e6e6e6;
}

.toolbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  position: relative;
}

/* Client login icon on right side of toolbar */
.client-login img, #clientLogin img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  cursor: pointer;
  border-radius: 4px;
}

/* Icon for maintenance menu */
.menu-icon-mantenimiento { height:22px; width:auto; vertical-align:middle; }

/* Logout button small icon */
.logout-btn { display:inline-flex; align-items:center; gap:6px; padding:6px 8px; }
.logout-btn .logout-icon { height:18px; width:auto; display:inline-block; }

.logo img { height: 48px; display:block; }

.main-menu { position: absolute; left: 50%; transform: translateX(-50%); }
.main-menu ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; align-items: center; }
.main-menu li { position: relative; }
.main-menu a { color: #000; text-decoration: none; font-weight: 700; letter-spacing: 0.02em; transition: color 150ms ease, opacity 120ms ease; }
.main-menu a:hover, .main-menu a:focus { color: #c62828; opacity: 1; outline: none; }
.main-menu a.active { color: #c62828; }
.main-menu .has-submenu > a::after { content: '▾'; margin-left: 6px; font-size: 11px; }
.main-menu .submenu { display: none; position: absolute; top: 100%; left: 0; background: #fff; padding: 8px 0; margin: 0; list-style: none; box-shadow: 0 4px 10px rgba(0,0,0,0.12); border: 1px solid #e6e6e6; min-width: 180px; z-index: 200; }
.main-menu .submenu li { padding: 0; }
.main-menu .submenu a { display: block; padding: 8px 14px; font-weight: 600; white-space: nowrap; }
.main-menu .has-submenu:hover .submenu, .main-menu .has-submenu:focus-within .submenu { display: block; }

.toolbar-right { display: flex; align-items: center; gap: 12px; }

/* Session indicator inside toolbar (moved from header) */
.toolbar .toolbar-session {
  display: none; /* shown by JS when admin */
  color: #000;
  margin-left: 12px;
  vertical-align: middle;
}
.toolbar .toolbar-session .logout-btn {
  margin-left: 8px;
  padding: 6px 10px;
  background: transparent;
  color: #000;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 4px;
  cursor: pointer;
}
.toolbar .toolbar-session span#sessionUser { font-weight: 700; margin-left:6px; }

/* Ensure content isn't hidden under the fixed toolbar */
.page-container { margin-top: 80px; padding-top: 8px; }


.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.productos-note,
.barriles-note {
  display: none;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #444444;
  line-height: 1.5;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin: 20px 0 30px 0;
  white-space: normal;
}

.barriles-note .bn-row { display: flex; justify-content: center; gap: 14px; margin: 2px 0; }
.barriles-note .bn-label { min-width: 240px; text-align: left; }
.barriles-note .bn-price { min-width: 80px; text-align: right; }
.barriles-note .bn-full { text-align: center; }
.barriles-note .bn-row strong { font-weight: 500; }

.controls input[type="text"] {
  padding: 6px 8px;
  font-size: 14px;
  width: 260px;
}

.controls button {
  padding: 6px 10px;
  font-size: 14px;
}

.page-container {
  margin-top: 16px;
  padding-top: 8px;
}

.page {
  width: 210mm;
  height: auto;
  border: 1px solid #e6e6e6;
  padding: 12mm;
  margin: 0 auto 16px auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  background: white;
  display: block;
  box-sizing: border-box;
}

.page .title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

/* Navigation tabs */
.nav { display:flex; gap:8px; justify-content:center; margin-bottom:8px; }
.nav .tab { padding:6px 12px; border:1px solid #ddd; background:#fff; cursor:pointer; }
.nav .tab.active { background:#f0f0f0; border-bottom:2px solid #888; }

/* Maintenance UI */
.maint-tabs { display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.maint-tab { padding:8px 14px; border:1px solid #ddd; background:#f9f9f9; cursor:pointer; border-radius:6px; font-weight:700; }
.maint-tab.active { background:#111; color:#fff; border-color:#111; }
.maint-actions { display:flex; gap:8px; }
.maint-form .form-grid { display:grid; grid-template-columns:1fr 2fr; gap:8px 16px; max-width:900px; }
.maint-form .form-grid label { align-self:center; }
.maint-form .form-grid input, .maint-form .form-grid textarea, .maint-form .form-grid select { width:100%; }
.msg { margin-top:8px; color: #006600; }
.msg.error { color: #a00; }

.page .meta {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
}

/* Estado agotado / no disponible */
.page.page-inactive .meta .img img,
.page.page-inactive .thumb img {
  filter: grayscale(100%);
  opacity: 0.45;
}
.page.page-inactive .price-row,
.page.page-inactive .price-row .field-label,
.price-row.price-inactive { color: #777; }
.status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #c62828;
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.22);
  z-index: 2;
  letter-spacing: 0.01em;
}
.availability-note {
  margin: 6px 0 4px;
  font-weight: 700;
  color: #c62828;
  font-size: 15px;
}
.page.page-inactive .zoom-icon { opacity: 0.8; }

.page .meta .img {
  width: 260px;
  height: 260px;
  background: #f6f6f6;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eee;
  position: relative;
}

.page .meta .img img {
  max-width: 100%;
  max-height: 100%;
}

.thumbs-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.thumbs-row .thumb {
  width: 120px;
  height: 120px;
  background: #f6f6f6;
  border: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.thumbs-row .thumb img { max-width: 100%; max-height: 100%; }

/* Pointer cursor for Servicios menu */
.main-menu a#menuServicios { cursor: pointer; }

/* Zoomable main image */
.img.zoomable { position: relative; cursor: zoom-in; overflow: hidden; }
.img.zoomable img { transition: transform 0.2s ease; }
.img.zoomable:hover img { transform: scale(1.05); }
.zoom-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-icon:hover { background: rgba(0,0,0,0.75); }

/* Image modal */
.img-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1600;
  align-items: center;
  justify-content: center;
}
.img-modal.active { display: flex; }
.img-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.img-modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
}
.img-modal-content img {
  max-width: 90vw;
  max-height: 90vh;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  background: #fff;
}
.img-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.img-modal-close:hover { background: #222; }

.page .meta .info {
  flex: 1;
}

.field-label { font-weight: 700; }
.field-row { margin-bottom: 8px; }

.page .section { margin-top: 12px; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

/* Prevent page content from being split across PDF pages */
.page { break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid; }
.page { page-break-after: always; }


@media print {
  @page { size: A4; margin: 20mm; }
  body { margin: 0; }
  .controls, .pagination, .toolbar { display: none !important; }
  .page { display: block !important; box-shadow: none; margin: 0 0 20px 0; }
  .page { page-break-after: always; }
}
@media print { .toolbar .toolbar-session { display:none !important; } }

/* Nosotros page */
.nosotros {
  padding: 16px 0 40px;
  background: #f8f8f8;
}
.nosotros .container {
  max-width: 960px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 28px 24px 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.nosotros h1 {
  font-size: 32px;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}
.nosotros .claim {
  font-size: 18px;
  margin: 0 0 18px 0;
  color: #c62828;
  font-weight: 700;
}
.nosotros .intro {
  font-size: 17px;
  margin: 0 0 18px 0;
  color: #333;
}
.nosotros h2 {
  margin: 28px 0 10px 0;
  font-size: 22px;
}
.nosotros p {
  line-height: 1.6;
  margin: 0 0 14px 0;
  color: #333;
}
.nosotros ul {
  margin: 8px 0 18px 20px;
  padding: 0;
  line-height: 1.6;
  color: #333;
}
.nosotros li { margin-bottom: 6px; }
.nosotros address {
  font-style: normal;
  line-height: 1.6;
  margin: 6px 0 16px 0;
  color: #333;
}
.nosotros .contacto { line-height: 1.8; }
.nosotros .btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(37,211,102,0.28);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.nosotros .btn-whatsapp:hover,
.nosotros .btn-whatsapp:focus {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37,211,102,0.32);
}
.nosotros a { color: #c62828; }

@media (max-width: 640px) {
  .nosotros { padding: 32px 12px 48px; }
  .nosotros .container { padding: 24px 18px; }
  .nosotros h1 { font-size: 26px; }
  .nosotros h2 { font-size: 19px; margin-top: 22px; }
  .nosotros .claim { font-size: 16px; }
}

/* Contact view styling */
#contacto {
  display: none;
}
#contacto a { color: inherit; text-decoration: underline; }

/* WhatsApp link inside contact block */
#contacto .contact-phone {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
#contacto .contact-phone:hover { text-decoration: underline; }
#contacto .whatsapp-icon svg { display: inline-block; vertical-align: middle; }

/* Improved WhatsApp icon: circular green badge with white glyph */
#contacto .whatsapp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #25D366;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform 120ms ease, box-shadow 120ms ease;
  margin-left: 8px;
}
/* Make icon container transparent and remove extra decoration so image background shows through */
#contacto .whatsapp-icon {
  width: 40px;
  height: 40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:8px;
  background: transparent;
  box-shadow: none;
  border: none;
}
#contacto .whatsapp-img {
  width: 100%;
  height: 100%;
  object-fit:contain;
  display:block;
  border-radius:50%;
  background: transparent;
}
#contacto .contact-phone:hover .whatsapp-icon { transform: translateY(-2px) scale(1.03); box-shadow: 0 6px 14px rgba(0,0,0,0.18); }
#contacto .whatsapp-link { color: inherit; text-decoration: none; font-weight: 700; margin-right: 6px; }
/* When generating PDF via html2pdf we render a cloned element; keep toolbar hidden there too */
.no-print { display: none !important; }

@media (max-width: 900px) {
  body {
    margin: 0;
    padding: 70px 12px 16px;
  }

  .toolbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar .logo {
    display: flex;
    justify-content: center;
  }

  .main-menu {
    position: static;
    transform: none;
  }

  .main-menu ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 18px;
  }

  .main-menu a {
    font-size: 14px;
  }

  .menu-icon-mantenimiento {
    height: 18px;
  }

  .toolbar-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .toolbar .toolbar-session {
    margin-left: 0;
    text-align: center;
  }

  .controls-row {
    margin-top: 8px;
  }
}

@media (max-width: 520px) {
  .main-menu a {
    font-size: 13px;
    padding: 4px 8px;
  }

  .main-menu ul {
    gap: 10px 14px;
  }

  .toolbar .logo img {
    height: 42px;
  }
}
