/* ============================================================
   ESTILOS DE PUBLICIDAD NO INVASIVA Y BANNERS DE LA CASA (HOUSE ADS)
   FIJATE TOOLS - ESTÁNDAR GLOBAL UNIFICADO (ALTURAS ESTRICTAS BLOQUEADAS)
   ============================================================ */

/* Normalización de contenedores estándar para todas las herramientas */
.main-wrapper,
.app-main-container,
.app-container,
.main-content,
.tool-container,
.tool-layout,
.alzheimer-layout,
.smi-app-layout {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* 1. MODO ESTÁNDAR (< 1536px: Móvil, Tablet, Portátil, Pantallas estándar) */
/* El contenido principal ocupa el 100% de su espacio disponible (hasta 1200px) y la publicidad lateral queda totalmente anulada */
.tool-with-sidebar {
  display: block;
  width: 100%;
}

.tool-main-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

/* La sidebar de publicidad se oculta COMPLETAMENTE en pantallas < 1536px */
.tool-ad-sidebar,
.tool-sidebar:has(.ad-sidebar-card),
.tool-sidebar:has(.ad-unit-card) {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 0 !important;
}

/* 2. MODO ULTRA-PANORÁMICO (>= 1536px: Full HD 1080p completo, 2K, 4K) */
/* Se despliega la columna lateral de 300px con layout flexible y sticky scroll suave */
@media (min-width: 1536px) {
  .main-wrapper,
  .app-main-container,
  .app-main,
  .app-container,
  .main-content,
  .tool-container,
  .tool-layout,
  .alzheimer-layout,
  .smi-app-layout,
  .app-layout,
  .studio-main-layout,
  .app-grid,
  .library-container {
    max-width: 1580px;
  }

  .tool-with-sidebar {
    display: flex;
    gap: 2.5rem;
    align-items: stretch;
    justify-content: center;
    width: 100%;
  }

  .tool-main-content {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 1200px;
    margin: 0;
  }

  .tool-ad-sidebar,
  .tool-sidebar:has(.ad-sidebar-card),
  .tool-sidebar:has(.ad-unit-card) {
    display: block !important;
    width: 300px !important;
    max-width: 300px !important;
    flex-shrink: 0 !important;
    align-self: stretch !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Caja fija que acompaña el scroll de la herramienta (Sticky 300x600) */
.ad-sticky-box,
.ad-sidebar-wrapper {
  position: -webkit-sticky;
  position: sticky;
  top: 85px; /* Distancia respecto a la cabecera fija */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  will-change: transform;
}

/* Micro-etiqueta de aviso legal: Siempre visible por encima del bloque publicitario */
.ad-label {
  display: block !important;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #94a3b8);
  user-select: none;
  align-self: center;
  text-align: center;
  margin: 0 0 0.35rem 0;
  line-height: 1;
  transition: color 0.2s ease;
}

[data-theme="light"] .ad-label,
body.light-theme .ad-label {
  color: #64748b;
}


/* ============================================================
   CONTENEDORES CON BLOQUEO ESTRICTO DE ALTURA (CERO CRECIMIENTO)
   Bloquea e impide que Google AdSense expanda la caja verticalmente
   ============================================================ */

/* 1. Tarjeta Horizontal (Top / Bottom / In-Feed) - Adaptable y flexible */
.tools-ad-banner-section {
  display: block;
  width: 100%;
  max-width: 1200px;
  margin: 1rem auto 1.75rem auto;
  box-sizing: border-box;
  text-align: center;
}

@media (max-width: 768px) {
  .tools-ad-banner-section {
    margin: 0.5rem auto 1rem auto;
  }
}

.ad-banner-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto;
}

.ad-banner-card {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  height: auto;
  background: var(--bg-card, rgba(26, 32, 48, 0.5));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 14px);
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  box-sizing: border-box;
  padding: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: min-height 0.2s ease;
}

@media (max-width: 640px) {
  .ad-banner-card {
    min-height: 50px;
    padding: 0;
  }
}

.ad-banner-card.ad-filled,
.ad-banner-card.has-adsense,
.ad-banner-card:has(ins.adsbygoogle[data-ad-status="filled"]) {
  height: auto !important;
  min-height: 50px !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0.25rem 0 !important;
}

[data-theme="light"] .ad-banner-card,
body.light-theme .ad-banner-card {
  background: var(--bg-card, #ffffff);
  border-color: var(--border-color, #e2e8f0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* 2. Tarjeta Vertical (Sidebar 300x600) - Altura fija bloqueada 600px */
.ad-unit-card,
.ad-sidebar-card {
  width: 300px !important;
  max-width: 300px !important;
  min-width: 300px !important;
  height: 600px !important;
  min-height: 600px !important;
  max-height: 600px !important;
  background: var(--bg-card, rgba(26, 32, 48, 0.5));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 14px);
  display: grid !important;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "ad-slot";
  align-items: stretch;
  justify-items: stretch;
  position: relative;
  overflow: hidden !important;
  box-sizing: border-box;
  padding: 0 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .ad-unit-card,
body.light-theme .ad-unit-card,
[data-theme="light"] .ad-sidebar-card,
body.light-theme .ad-sidebar-card {
  background: var(--bg-card, #ffffff);
  border-color: var(--border-color, #e2e8f0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Ocultar placeholders antiguos de desarrollo */
.ad-dev-placeholder,
.ad-dev-placeholder-horizontal {
  display: none !important;
}

/* ============================================================
   ASIGNACIÓN Y CONTROL DE ELEMENTOS INTERNOS
   ============================================================ */

.ad-unit-card > *,
.ad-sidebar-card > * {
  grid-area: ad-slot;
}

.ad-banner-card ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  min-height: 50px;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  z-index: 2;
  position: relative;
  text-align: center;
  margin: 0 auto;
}

.ad-banner-card ins.adsbygoogle iframe,
.ad-banner-card ins.adsbygoogle > div,
.ad-banner-card ins.adsbygoogle > iframe {
  max-height: none !important;
  overflow: visible !important;
  margin: 0 auto !important;
}

.ad-unit-card ins.adsbygoogle,
.ad-sidebar-card ins.adsbygoogle {
  grid-area: ad-slot;
  display: block !important;
  width: 300px !important;
  height: 600px !important;
  max-height: 600px !important;
  overflow: hidden !important;
  z-index: 2;
  position: relative;
}

.ad-banner-card .fijate-house-ad {
  width: 100% !important;
  min-height: 90px;
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .ad-banner-card .fijate-house-ad {
    min-height: 60px;
  }
}

.ad-unit-card .fijate-house-ad,
.ad-sidebar-card .fijate-house-ad {
  grid-area: ad-slot;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  position: relative;
}

/* ============================================================
   ESTRUCTURA DE LOS BANNERS DE LA CASA (HOUSE ADS)
   ============================================================ */

.fijate-house-ad {
  display: flex;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

/* 1. Banner Horizontal de la Casa */
.fijate-house-ad-horizontal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, rgba(30, 41, 69, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border-radius: inherit;
  box-sizing: border-box;
}

[data-theme="light"] .fijate-house-ad-horizontal,
body.light-theme .fijate-house-ad-horizontal {
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
}

.fha-h-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.fha-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.fha-icon-box svg {
  width: 20px;
  height: 20px;
}

.fha-h-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.fha-h-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #60a5fa;
}

[data-theme="light"] .fha-h-badge,
body.light-theme .fha-h-badge {
  color: #2563eb;
}

.fha-h-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 8px #3b82f6;
}

.fha-h-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  margin: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .fha-h-title,
body.light-theme .fha-h-title {
  color: #0f172a;
}

.fha-h-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .fha-h-desc,
body.light-theme .fha-h-desc {
  color: #64748b;
}

.fha-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff !important;
  text-decoration: none;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.fha-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.fha-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.fha-btn:hover svg {
  transform: translateX(3px);
}

/* Responsividad del banner horizontal en móviles */
@media (max-width: 640px) {
  .fha-icon-box {
    display: none !important;
  }

  .fijate-house-ad-horizontal {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    align-items: center;
  }

  .fha-h-left {
    gap: 0;
  }

  .fha-h-text {
    gap: 0.1rem;
  }

  .fha-h-badge {
    font-size: 0.62rem;
  }

  .fha-h-title {
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .fha-h-desc {
    display: none !important;
  }

  .fha-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
    white-space: nowrap;
    gap: 0.35rem;
  }

  .fha-btn svg {
    width: 12px;
    height: 12px;
  }
}

/* 2. Banner Vertical Skyscraper de la Casa (300x600) */
.fijate-house-ad-vertical {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(180deg, rgba(30, 41, 69, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-radius: inherit;
  text-align: center;
  box-sizing: border-box;
}

[data-theme="light"] .fijate-house-ad-vertical,
body.light-theme .fijate-house-ad-vertical {
  background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
}

.fha-v-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.fha-v-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.fha-v-logo-box svg {
  width: 24px;
  height: 24px;
}

.fha-v-brand {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary, #ffffff);
}

[data-theme="light"] .fha-v-brand,
body.light-theme .fha-v-brand {
  color: #0f172a;
}

.fha-v-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

.fha-v-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-theme="light"] .fha-v-badge,
body.light-theme .fha-v-badge {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: #2563eb;
}

.fha-v-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  margin: 0;
  line-height: 1.35;
}

[data-theme="light"] .fha-v-title,
body.light-theme .fha-v-title {
  color: #0f172a;
}

.fha-v-features {
  list-style: none;
  margin: 0.4rem 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
}

.fha-v-features li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-muted, #cbd5e1);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .fha-v-features li {
  color: #475569;
  background: #ffffff;
  border-color: #e2e8f0;
}

.fha-v-features li svg {
  width: 13px;
  height: 13px;
  color: #3b82f6;
  flex-shrink: 0;
}

.fha-v-footer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.fha-v-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.fha-v-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
  transform: translateY(-2px);
}

.fha-v-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.fha-v-btn:hover svg {
  transform: translateX(4px);
}

.fha-v-subtext {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
}

/* ============================================================
   GESTIÓN DE ESTADOS (ADSENSE vs BANNER DE LA CASA)
   ============================================================ */

/* Si AdSense se llena o está activo, ocultamos el banner de la casa */
.ad-banner-card.ad-filled .fijate-house-ad,
.ad-banner-card.has-adsense .fijate-house-ad,
.ad-unit-card.ad-filled .fijate-house-ad,
.ad-unit-card.has-adsense .fijate-house-ad,
.ad-sidebar-card.ad-filled .fijate-house-ad,
.ad-sidebar-card.has-adsense .fijate-house-ad,
.ad-banner-card:has(ins.adsbygoogle[data-ad-status="filled"]) .fijate-house-ad,
.ad-banner-card:has(ins.adsbygoogle iframe) .fijate-house-ad,
.ad-unit-card:has(ins.adsbygoogle[data-ad-status="filled"]) .fijate-house-ad,
.ad-sidebar-card:has(ins.adsbygoogle[data-ad-status="filled"]) .fijate-house-ad {
  display: none !important;
}

/* Si AdSense no tiene anuncio (unfilled), ocultamos el tag ins y mostramos el house ad */
ins.adsbygoogle[data-ad-status="unfilled"],
.ad-banner-card.ad-unfilled ins.adsbygoogle,
.ad-unit-card.ad-unfilled ins.adsbygoogle,
.ad-sidebar-card.ad-unfilled ins.adsbygoogle {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

ins.adsbygoogle[data-ad-status="unfilled"] iframe,
ins.adsbygoogle[data-ad-status="unfilled"] > div,
ins.adsbygoogle[data-ad-status="unfilled"] > iframe {
  display: none !important;
}

.ad-banner-card.ad-unfilled .fijate-house-ad,
.ad-unit-card.ad-unfilled .fijate-house-ad,
.ad-sidebar-card.ad-unfilled .fijate-house-ad {
  display: flex !important;
}

/* ============================================================
   MODO SIN PUBLICIDAD (fijate_no_ads en localStorage)
   Eliminación total de espacios publicitarios, banners y reajuste de maquetación
   ============================================================ */
html[data-no-ads="true"] .tools-ad-banner-section,
html[data-no-ads="true"] .tools-ad-banner-top,
html[data-no-ads="true"] .tools-ad-banner-bottom,
html[data-no-ads="true"] .tool-ad-sidebar,
html[data-no-ads="true"] .ad-banner-container,
html[data-no-ads="true"] .ad-banner-card,
html[data-no-ads="true"] .ad-unit-card,
html[data-no-ads="true"] .ad-sidebar-card,
html[data-no-ads="true"] .ad-sidebar-wrapper,
html[data-no-ads="true"] .ad-sticky-box,
html[data-no-ads="true"] .ad-label,
html[data-no-ads="true"] ins.adsbygoogle,
html[data-no-ads="true"] .fijate-house-ad,
html[data-no-ads="true"] .tool-sidebar:has(.ad-sidebar-card),
html[data-no-ads="true"] .tool-sidebar:has(.ad-unit-card) {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  flex: 0 0 0 !important;
}

html[data-no-ads="true"] .tool-with-sidebar {
  display: block !important;
  width: 100% !important;
}

html[data-no-ads="true"] .tool-main-content {
  width: 100% !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

