/* ── VARIABLES MÓVIL ────────────────────────────────────── */
body.wb-template-4 {
  --wb-m-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --wb-m-btn-bg:     #3b82f6;
  --wb-m-btn-color:  white;
  --wb-m-btn-border: none;
  --wb-m-btn-radius: 14px;
  --wb-m-accent:     #3b82f6;
  --wb-m-hero-bg:    linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  --wb-m-page-bg:    #f0f9ff;
  --wb-m-text:       #0f172a;
}

/* ── RESET BASE ─────────────────────────────────────────── */
body.wb-template-4 {
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

/* ── ESTILOS VISUALES ────────────────────────────────────── */

body.wb-template-4 .wb-hero-section {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(102,126,234,0.3);
  width: 100%;
  position: relative;
}

body.wb-template-4 .wb-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  z-index: 1;
  box-shadow: none;
}
body.wb-template-4 .wb-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

body.wb-template-4 .wb-avatar-container { display: flex; align-items: center; justify-content: center; }
body.wb-template-4 .wb-avatar {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: 4px solid white;
  color: white; font-weight: 700; font-size: 32px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

body.wb-template-4 .wb-profile-info {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  background: rgba(255,255,255,0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 16px; padding: 16px 24px; box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
body.wb-template-4 .wb-name     { font-size: 28px; font-weight: 700; margin: 0; line-height: 1.2; color: #0f172a; text-shadow: none; }
body.wb-template-4 .wb-prof     { font-size: 15px; font-weight: 600; margin: 0; color: #3b82f6; text-shadow: none; }
body.wb-template-4 .wb-location,
body.wb-template-4 .wb-address  { font-size: 13px; margin: 0; color: #475569; text-shadow: none; }

body.wb-template-4 .wb-card { background: transparent; box-shadow: none; padding: 0; }
.wb-template-4-unused { height: 1px; background: linear-gradient(90deg, transparent, #e2e8f0, transparent); margin: 32px 0; }

body.wb-template-4 .wb-bio { font-size: 17px; line-height: 1.8; color: #475569; text-align: center; margin-bottom: 32px; }

body.wb-template-4 .wb-btn { background: #3b82f6; color: white; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
body.wb-template-4 .wb-btn:hover { background: #2563eb; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.4); }

body.wb-template-4 .wb-section-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; color: #0f172a; text-align: center; }
body.wb-template-4 .wb-module-title  { font-size: 24px; font-weight: 700; margin-bottom: 24px; color: #0f172a; text-align: center; }

body.wb-template-4 .wb-portfolio-grid    { display: flex; flex-direction: column; gap: 20px; }
body.wb-template-4 .wb-portfolio-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
body.wb-template-4 .wb-portfolio-title    { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: #0f172a; }
body.wb-template-4 .wb-portfolio-subtitle { font-size: 13px; color: #64748b; margin-bottom: 6px; font-style: italic; }
body.wb-template-4 .wb-portfolio-subtitle { font-size: 14px; color: #64748b; font-weight: 600; margin-bottom: 8px; }
body.wb-template-4 .wb-portfolio-desc     { font-size: 14px; color: #94a3b8; line-height: 1.6;  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

body.wb-template-4 .wb-col-extra { padding: 0; overflow: hidden; display: flex; flex-direction: column; align-self: start; }
body.wb-template-4 .wb-col-extra .wb-module--map         { display: flex; flex-direction: column; overflow: hidden; }
body.wb-template-4 .wb-col-extra .wb-module--map .wb-map-body   { flex: 1; padding: 0 12px 12px; min-height: 0; }
body.wb-template-4 .wb-col-extra .wb-module--map .wb-map-iframe { width: 100%; height: 100%; display: block; border: 0; border-radius: 8px; }
body.wb-template-4 .wb-col-extra .wb-module--schedule    { width: 100%; }

body.wb-template-4 .wb-logo-container {
  position: absolute; top: 50%; right: 28px; transform: translateY(-50%);
  background: transparent; display: flex; align-items: center; justify-content: flex-end;
  padding: 0; z-index: 10;
}
body.wb-template-4 .wb-logo-container img { width: auto; height: 90px; max-width: 180px; max-height: 90px; object-fit: contain; background: transparent; display: block; }

/* ── LAYOUT DESKTOP (solo ≥769px) ───────────────────────── */
@media (min-width: 769px) {

  body.wb-template-4 { padding: 50px 20px; }

  body.wb-template-4 .wb-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  body.wb-template-4 .wb-hero-section { max-width: 800px; margin-bottom: 0; }

  body.wb-template-4 .wb-hero {
    height: 350px;
    border-radius: 0;
    aspect-ratio: unset;
    width: 100%;
  }

  body.wb-template-4 .wb-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.55) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
  }

  body.wb-template-4 .wb-profile-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    color: white;
    width: 100%;
    gap: 24px;
  }

  body.wb-template-4 .wb-avatar { width: 90px; height: 90px; }

  body.wb-template-4 .wb-bio-section,
  body.wb-template-4 .wb-actions-section {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
    padding: 0;
    margin: 0;
  }

  body.wb-template-4 .wb-bio-section .wb-card {
    border-radius: 24px 24px 0 0;
    padding: 60px 50px 28px;
    background: white;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    margin-top: -80px;
  }
  body.wb-template-4 .wb-actions-section .wb-card {
    border-radius: 0 0 24px 24px;
    padding: 28px 50px 50px;
    background: white;
    box-shadow: 4px 4px 24px rgba(0,0,0,0.08), -4px 4px 24px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.08);
  }

  body.wb-template-4 .wb-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  body.wb-template-4 .wb-actions > .wb-btn:nth-child(odd):last-child { grid-column: 1 / -1; }

  body.wb-template-4 .wb-modules-container {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 48px;
    min-width: 0;
    overflow-x: hidden;
  }

  /* Gallery: columna 1 (bajo portfolio), no ocupa celda extra del grid */
  body.wb-template-4 .wb-modules-container > .wb-module--gallery { grid-column: 1 / -1; min-width: 0; }
  /* col-extra ancla en fila 1 col 2 para no irse bajo la galería */
  body.wb-template-4 .wb-col-extra { grid-column: 2; grid-row: 1; min-width: 0; }
  

  body.wb-template-4 .wb-portfolio-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    background: #f8fafc;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
    align-items: center;
  }
  body.wb-template-4 .wb-portfolio-card.wb-no-media { grid-template-columns: 1fr; gap: 0; }
  body.wb-template-4 .wb-portfolio-card.wb-no-media .wb-portfolio-content { padding: 16px; }
  body.wb-template-4 .wb-portfolio-media   { width: 200px; height: 150px; aspect-ratio: 4/3; }
  body.wb-template-4 .wb-portfolio-content { padding: 0 16px 0 0; }
  body.wb-template-4 .wb-module--testimonials { grid-column: 1 / -1; }
  /* ── v5: mc sin sidebar (mapa+horario desactivados) → columna única */
  body.wb-template-4 .wb-modules-container.wb-mc--no-sidebar {
    grid-template-columns: 1fr;
  }
  /* ── v5: mc sin portfolio → columna única, col-extra ocupa todo el ancho */
  body.wb-template-4 .wb-modules-container.wb-mc--no-portfolio {
    grid-template-columns: 1fr;
  }
  body.wb-template-4 .wb-modules-container.wb-mc--no-portfolio .wb-col-extra {
    grid-column: 1;
    grid-row: 1;
  }

}

/* ── RESPONSIVE: tablet (≤1024px) ──────────────────────── */
@media (max-width: 1024px) {
  body.wb-template-4 .wb-modules-container { grid-template-columns: 1fr; }
}

/* ── RESPONSIVE: móvil (≤768px) ─────────────────────────── */
@media (max-width: 768px) {
  body.wb-template-4 { padding: 0; }
  body.wb-template-4 .wb-wrap { padding: 0; max-width: 100%; }
  body.wb-template-4 .wb-hero-section { border-radius: 0; box-shadow: none; overflow: visible; }
  body.wb-template-4 .wb-hero { height: auto; min-height: 0; border-radius: 0; box-shadow: none; }
  body.wb-template-4 .wb-hero-overlay { position: relative; inset: auto; background: none; padding: 32px 20px 24px; flex-direction: column; align-items: center; justify-content: center; }
  body.wb-template-4 .wb-profile-header { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  body.wb-template-4 .wb-profile-info   { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; padding: 0; border-radius: 0; }
  body.wb-template-4 .wb-name    { color: #0f172a; text-shadow: none; font-size: 22px; }
  body.wb-template-4 .wb-prof    { color: #475569; font-size: 14px; }
  body.wb-template-4 .wb-location,
  body.wb-template-4 .wb-address { color: #475569; }
  body.wb-template-4 .wb-avatar  { width: 80px; height: 80px; font-size: 28px; }
  body.wb-template-4 .wb-bio-section .wb-card    { padding: 28px 20px 20px; margin-top: -40px; border-radius: 20px 20px 0 0; }
  body.wb-template-4 .wb-actions-section .wb-card { padding: 20px 20px 32px; border-radius: 0 0 20px 20px; }
  body.wb-template-4 .wb-bio     { font-size: 15px; }
  body.wb-template-4 .wb-actions { grid-template-columns: 1fr; }
  body.wb-template-4 .wb-modules-container { grid-template-columns: 1fr; margin-top: 24px; padding: 0 16px 32px; }
  body.wb-template-4 .wb-portfolio-card    { grid-template-columns: 1fr; }
  body.wb-template-4 .wb-portfolio-media   { width: 100%; height: auto; }
  body.wb-template-4 .wb-portfolio-content { padding: 16px; }
  body.wb-template-4 .wb-logo-container img { height: 60px; max-width: 120px; max-height: 60px; }
}


/* ═══════════════════════════════════════════════════════
   MÓVIL — Cabecera estilo Timeline (≤768px)
   Estructura: hero(imagen+panel) → bio → botones → módulos → extras
   ═══════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* col-extra (mapa/horario/testimonios) — fluye debajo del mc */
  body.wb-template-4 .wb-wrap > .wb-col-extra { padding: 24px 40px; display: flex; flex-direction: column; gap: 20px; }
}

@media (max-width: 768px) {

  /* Wrap: flex columna */
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] {
    display: flex !important;
    flex-direction: column !important;
    max-width: 100% !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow-x: hidden !important;
  }

  /* Reset grid de desktop en todos los hijos directos */
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > * {
    grid-column: unset !important;
    grid-row: unset !important;
    grid-area: unset !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  /* Hero: contenedor flex con imagen de fondo, panel al fondo */
  body.wb-template-4 .wb-hero-section {
    display: flex !important;
    align-items: flex-end !important;
    min-height: 260px !important;
    height: 260px !important;
    overflow: hidden !important;
    position: relative !important;
    flex-shrink: 0 !important;
  }

  /* #wbHero: posición absoluta como fondo (el JS le pone la imagen) */
  body.wb-template-4 #wbHero {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 0 !important;
    display: block !important;
  }

  /* Overlay: panel semitransparente al fondo del hero */
  body.wb-template-4 .wb-hero-overlay {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    padding: 16px 20px 20px !important;
    background: rgba(0,0,0,0.45) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-top: 1px solid rgba(255,255,255,0.15) !important;
    display: block !important;
  }

  body.wb-template-4 .wb-profile-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 14px !important;
    color: white !important;
  }

  body.wb-template-4 .wb-name { color: white !important; font-size: 18px !important; margin: 0 0 2px !important; }
  body.wb-template-4 .wb-prof { color: white !important; opacity: 0.85; font-size: 13px !important; margin: 0 0 2px !important; }
  body.wb-template-4 .wb-location { color: white !important; opacity: 0.75; font-size: 12px !important; margin: 0 !important; }

  body.wb-template-4 .wb-avatar-container { flex-shrink: 0 !important; }
  body.wb-template-4 .wb-avatar {
    width: 60px !important;
    height: 60px !important;
    border: 2px solid rgba(255,255,255,0.5) !important;
  }

  /* Bio y botones */
  body.wb-template-4 .wb-bio-section,
  body.wb-template-4 .wb-actions-section {
    padding: 20px 16px !important;
  }

  /* Módulos: flex columna */
  body.wb-template-4 .wb-modules-container {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    padding: 0 16px 16px !important;
    gap: 16px !important;
    overflow-x: hidden !important;
  }
  body.wb-template-4 .wb-modules-container > * {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    grid-column: unset !important;
    grid-row: unset !important;
  }
  /* Galería y testimonios: nunca más anchos que el viewport */
  body.wb-template-4 .wb-module--gallery,
  body.wb-template-4 .wb-module--testimonials {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  body.wb-template-4 .wb-gallery-carousel-wrap,
  body.wb-template-4 .wb-testimonials-carousel-wrap {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  /* col-extra: flex columna */
  body.wb-template-4 .wb-col-extra {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    padding: 0 16px 24px !important;
    grid-column: unset !important;
    grid-row: unset !important;
    overflow-x: hidden !important;
  }

  /* Botones: una columna */
  body.wb-template-4 .wb-actions {
    grid-template-columns: 1fr !important;
  }

  /* Logo */
  body.wb-template-4 .wb-logo-container img {
    height: 60px !important;
    max-width: 120px !important;
    max-height: 60px !important;
    width: auto !important;
  }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-hero-section { order: 1 !important; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-actions-section { order: 2 !important; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-bio-section { order: 3 !important; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-modules-container { order: 5 !important; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-col-extra { order: 7 !important; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-footer-section { order: 99 !important; }
}

/* ── PUBLICACIONES T4 ───────────────────────────────────── */
body.wb-template-4 .wb-publications-section { max-width: 800px; width: 100%; margin: 0 auto; padding: 0 40px 48px; box-sizing: border-box; }
body.wb-template-4 .wb-publications-section .wb-pub-card { background: #ffffff; border: 1px solid #dbeafe; border-radius: 14px; }
body.wb-template-4 .wb-publications-section .wb-pub-date { color: #3b82f6; font-weight: 600; font-size: 11px; }
body.wb-template-4 .wb-publications-section .wb-pub-ptitle { color: #0f172a; font-weight: 700; }
body.wb-template-4 .wb-publications-section .wb-pub-more { color: #3b82f6; }
@media (max-width: 768px) {
  body.wb-template-4 .wb-publications-section { padding: 0 16px 40px; }
  body.wb-template-4 .wb-wrap[data-wb-v5="1"] > .wb-publications-section { order: 10 !important; }
}

body.wb-template-4 .wb-rating { margin-left:auto; margin-right:auto; }
