/* =============================================================
   Child Theme — Custom Elements
   Versión: 1.1.0
   Contiene: Custom Button (.cb-button) + Sucursales (.suc-*) + Galería (.gal-*)
   =============================================================  */

/* ── Custom Button ─────────────────────────────────────────── */
.cb-button {
  display: inline-flex;
  align-items: center;
  height: 48px;
  cursor: pointer;
  text-decoration: none;
}

.cb-white-wrap {
  position: relative;
  height: 48px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.cb-white-svg {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  z-index: 1;
  display: block;
}

.cb-text {
  position: relative;
  z-index: 2;
  white-space: nowrap;
  padding: 0 32px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #1a3a7c;
}

.cb-red-wrap {
  flex-shrink: 0;
  margin-left: 10px;
  width: 51px; height: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cb-red-wrap svg {
  position: absolute;
  left: 0; top: 0;
  width: 51px; height: 48px;
  display: block;
}

.cb-arrow {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.cb-button:hover .cb-white-wrap { filter: brightness(0.95); }
.cb-button:hover .cb-red-wrap   { filter: brightness(0.88); }

@media (max-width: 480px) {
  .cb-button {
    height: auto;
    min-height: 48px;
    align-items: stretch;
  }

  .cb-white-wrap {
    flex: 1;
    min-width: 0;
    height: auto;
    min-height: 48px;
  }

  .cb-text {
    white-space: normal;
    word-break: break-word;
    padding: 10px 20px;
    line-height: 1.3;
  }

  .cb-red-wrap {
    flex-shrink: 0;
    align-self: center; /* centrado vertical respecto al texto */
  }
}


/* ── Sucursales Widget ─────────────────────────────────────── */
.sucursales-widget {
  display: block;
  width: 100%;
}

.suc-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 100px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

/* Mapa */
.suc-map-col {
  border-radius: 16px;
  overflow: hidden;
  width: 420px;
  height: 370px;
  min-width: 0;
}

.suc-map-col iframe {
  width: 100%; height: 100%;
  border: none; display: block;
}

/* Info */
.suc-info-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0; /* evita desbordamiento en grid */
  width: 100%;
}

/* Tabs */
.suc-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.suc-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 14px 0 10px;
  border-radius: 8px;
  border: none;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7a8d;
}

.suc-tab .tab-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #B91818;
  flex-shrink: 0;
  transition: background 0.2s;
}

.suc-tab.active {
  background: #1A3F7B;
  color: #E7E8E1;
}

.suc-tab.active .tab-dot {
  background: #B91818;
}

/* Card */
.suc-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.suc-card h3 {
  font-size: 42px;
  font-weight: 400;
  color: #1a3a7c;
  line-height: 1.2;
}

.suc-address {
  font-size: 19px;
  color: #222F30;
}

.suc-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suc-card ul li {
  font-size: 14px;
  color: #222F30;
  padding-left: 16px;
  position: relative;
  line-height: 1.8;
}

.suc-card ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #222F30;
  font-weight: 700;
}

/* Botón interno (hereda .cb-button pero con overrides de color) */
.suc-card .cb-text { color: #fff; }

/* Slides / animación */
.suc-slide     { display: none; }
.suc-map-slide { display: none; }

.suc-slide.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: sucFadeUp 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.suc-map-slide.active {
  display: block;
  height: 100%;
  animation: sucFadeUp 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes sucFadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
  .suc-layout {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .suc-map-col  { width: 100%; height: 340px; }
  .suc-card h3  { font-size: 28px; }
  .suc-address  { font-size: 15px; }
}

@media (max-width: 640px) {
  .suc-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .suc-map-col  { order: 2; width: 100%; height: 260px; }
  .suc-info-col { order: 1; }
  .suc-card h3  { font-size: 26px; }
  .suc-address  { font-size: 14px; }
  .suc-tabs     { gap: 6px; }

  .suc-tab {
    font-size: 10px;
    height: 28px;
    padding: 0 10px 0 8px;
  }

  .cb-button,
  .suc-card .cb-button     { height: 42px; }
  .suc-card .cb-white-wrap { height: 42px; }
  .suc-card .cb-text       { font-size: 11px; padding: 0 20px; }
  .suc-card .cb-red-wrap   { width: 42px; height: 42px; }
  .suc-card .cb-red-wrap svg { width: 42px; height: 42px; }
  .suc-card .cb-arrow      { font-size: 16px; }
}

/* ── Galería Slider (.gal-*) ───────────────────────────────── */

/* Custom properties con defaults */
.gal-widget {
  --gal-max-height:   717px;
  --gal-thumb-w:      100px;
  --gal-thumb-gap:    8px;
  --gal-active-color: #1A3F7B;
  --gal-radius:       12px;
  display: block;
  width: 100%;
}

/* Layout principal: thumbs izquierda + imagen derecha */
.gal-inner {
  display: flex;
  flex-direction: row;
  gap: 16px;
  width: 100%;
  max-height: var(--gal-max-height);
  align-items: flex-start;
}

/* ── Columna de thumbnails ─────────────────────────────────── */
.gal-thumbs-wrap {
  position: relative;
  width: var(--gal-thumb-w);
  flex-shrink: 0;
  max-height: var(--gal-max-height);
  display: flex;
  flex-direction: column;
}

.gal-thumbs {
  display: flex;
  flex-direction: column;
  gap: var(--gal-thumb-gap);
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;
  padding-bottom: 48px; /* espacio para la flecha */
}
.gal-thumbs::-webkit-scrollbar { display: none; }

/* Thumbnail individual */
.gal-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--gal-radius);
  border: 2px solid transparent;
  padding: 0;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color 0.2s;
}
.gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--gal-radius) - 2px);
  pointer-events: none;
}
.gal-thumb.active {
  border-color: var(--gal-active-color);
}
.gal-thumb:hover:not(.active) {
  border-color: color-mix(in srgb, var(--gal-active-color) 40%, transparent);
}

/* Flecha scroll — overlap con degradado */
.gal-arrow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  background: linear-gradient(to bottom, transparent 0%, white 55%);
  border: none;
  cursor: pointer;
  border-radius: 0 0 var(--gal-radius) var(--gal-radius);
  transition: opacity 0.2s;
  z-index: 2;
}
.gal-arrow:hover { opacity: 0.75; }
.gal-arrow.hidden { display: none; }

/* ── Imagen principal ──────────────────────────────────────── */
.gal-main {
  flex: 1;
  min-width: 0;
  max-height: var(--gal-max-height);
  border-radius: var(--gal-radius);
  /* Sin border — solo los thumbs tienen borde activo */
  overflow: hidden;
  position: relative;
  /* aspect-ratio fijo evita el colapso mientras carga la imagen */
  aspect-ratio: 4 / 3;
  background: #f0f4fa; /* placeholder mientras carga */
}

/* Slides */
.gal-slide {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gal-slide.active {
  display: block;
  animation: galFadeIn 0.3s ease both;
}
.gal-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes galFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Botones prev / next ───────────────────────────────────── */
.gal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.92);
  color: var(--gal-active-color, #1A3F7B);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: opacity 0.2s, transform 0.2s;
  /* Ocultos por defecto en PC — aparecen en hover */
  opacity: 0;
  pointer-events: none;
}
.gal-nav--prev { left: 12px; }
.gal-nav--next { right: 12px; }

/* Mostrar en hover del contenedor (PC) */
.gal-main:hover .gal-nav {
  opacity: 1;
  pointer-events: auto;
}
.gal-nav:hover {
  transform: translateY(-50%) scale(1.1);
  background: #fff;
}

/* ── Mobile: thumbs abajo ──────────────────────────────────── */
@media (max-width: 640px) {
  .gal-inner {
    flex-direction: column;
    max-height: none;
  }

  .gal-main {
    order: 1;
    width: 100%;
    max-height: none;
    aspect-ratio: 4 / 3; /* mantiene el espacio reservado en mobile también */
    flex: none;
  }

  .gal-thumbs-wrap {
    order: 2;
    width: 100%;
    max-height: none;
    flex-direction: row;
    height: 80px; /* alto fijo — evita que los thumbs se muevan al cargar */
    flex-shrink: 0;
  }

  .gal-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
    padding-right: 48px;
    gap: var(--gal-thumb-gap);
    height: 100%;
  }

  .gal-thumb {
    width: 72px;
    height: 72px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
  }

  /* Flecha apunta a la derecha en mobile */
  .gal-arrow {
    position: absolute;
    right: 0;
    bottom: 0;
    top: 0;
    left: auto;
    width: 52px;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, white 55%);
    border-radius: 0 var(--gal-radius) var(--gal-radius) 0;
    padding-bottom: 0;
    padding-right: 6px;
    align-items: center;
    justify-content: flex-end;
  }

  .gal-nav {
    opacity: 1;
    pointer-events: auto;
    width: 32px;
    height: 32px;
  }
  .gal-arrow svg {
    transform: rotate(-90deg);
  }
}