/* 
       NOTA PARA REPLICACIÓN:
       - Plantilla A (con bolsas): usar .pcard-img + <img>
       - Plantilla B (sin bolsas): usar .pcard-img-icon (emoji)
       
       Esta página usa el banner de CIAMSA y tarjetas de producto
       con imágenes reales de bolsas extraídas del PDF.
    */

    /* ── Override de variables de marca (verde CIAMSA) ── */
    :root {
      --brand-accent:        var(--brand-ciamsa);
      --brand-accent-dark:   var(--brand-ciamsa-dark);
      --brand-accent-lite:   var(--brand-ciamsa-lite);
      --brand-accent-tint:   var(--brand-ciamsa-tint);
      --brand-accent-border: var(--brand-ciamsa-border);
    }

    .brand-hero-img-ciamsa {
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(to bottom, #10802a 50%, #046631 50%);
    }
    .brand-hero-img-ciamsa img { width: 100%; height: auto; object-fit: contain; }
    .brand-hero-img-ciamsa::after { display: none; }
    .ciamsa-quick-links {
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      gap: 0.6rem;
      padding: 1.5rem;
      background: white;
    }
    .ciamsa-quick-links .brand-hero-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      padding: 0.65rem 1rem;
    }

    /* ── IMAGEN DE BOLSA (Plantilla A) ── */
    .pcard-img {
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(135deg, #ffffff, #f8faf8);
      border-bottom: 1px solid var(--rule);
      height: 200px;
      padding: 1rem;
      overflow: hidden;
    }
    .pcard-img img {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      display: block;
      transition: transform 0.3s ease;
    }
    .pcard:hover .pcard-img img { transform: scale(1.04); }

    /* ── Variantes de color por tipo de producto ── */
    .pcard-naxtrom .pcard-accent { background: linear-gradient(90deg, #7e22ce, #a855f7); }
    .pcard-naxtrom .pcard-formula { color: #7e22ce; }
    .pcard-naxtrom .pcard-highlight { background: #fdf4ff; border-left-color: #7e22ce; color: #6b21a8; }
    .pcard-naxtrom .pcard-cta { background: #7e22ce; }
    .pcard-naxtrom .pcard-cta:hover { background: #6b21a8; }
    .pcard-naxtrom .comp-table td:last-child { color: #6b21a8; }

    .pcard-nutrikimia .pcard-accent { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
    .pcard-nutrikimia .pcard-formula { color: #1d4ed8; }
    .pcard-nutrikimia .pcard-highlight { background: #eff6ff; border-left-color: #1d4ed8; color: #1e40af; }
    .pcard-nutrikimia .pcard-cta { background: #1d4ed8; }
    .pcard-nutrikimia .pcard-cta:hover { background: #1e40af; }
    .pcard-nutrikimia .comp-table td:last-child { color: #1e40af; }

    .pcard-simple .pcard-accent { background: linear-gradient(90deg, #475569, #64748b); }
    .pcard-simple .pcard-formula { color: #475569; }
    .pcard-simple .pcard-cta { background: #475569; }
    .pcard-simple .pcard-cta:hover { background: #334155; }
    .pcard-simple .comp-table td:last-child { color: #334155; }

    /* ── Hero derecho con gradiente e íconos (Plantilla B · sin imagen) ── */
    .brand-hero-img.brand-hero-img-gradient {
      position: relative;
      overflow: hidden;
      background: linear-gradient(135deg, var(--brand-accent-tint) 0%, #ffffff 50%, var(--brand-accent-tint) 100%);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .brand-hero-img.brand-hero-img-gradient::before {
      content: '';
      position: absolute;
      width: 400px;
      height: 400px;
      border-radius: 50%;
      background: rgba(0,0,0,0.03);
      top: -80px;
      right: -100px;
    }
    .brand-hero-img.brand-hero-img-gradient::after {
      content: '';
      position: absolute;
      width: 260px;
      height: 260px;
      border-radius: 50%;
      background: rgba(0,0,0,0.04);
      bottom: -60px;
      left: -60px;
    }
    .brand-hero-img-gradient .brand-hero-right-inner {
      padding: 4rem 3rem;
      text-align: center;
      position: relative;
      z-index: 1;
      width: 100%;
    }
    .brand-hero-logo {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 3rem;
      font-weight: 700;
      color: var(--brand-accent);
      letter-spacing: 0.05em;
      margin-bottom: 0.3rem;
    }
    .brand-hero-logo-sub {
      font-size: 0.72rem;
      font-weight: 600;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--brand-accent-dark);
      opacity: 0.7;
      margin-bottom: 2rem;
    }
    .hero-groups {
      display: flex;
      flex-direction: column;
      gap: 0.7rem;
      margin-top: 1.5rem;
    }
    .hero-group {
      background: white;
      border-radius: 10px;
      padding: 0.85rem 1.2rem;
      display: flex;
      align-items: center;
      gap: 0.8rem;
      box-shadow: 0 4px 16px rgba(0,0,0,0.06);
      text-align: left;
    }
    .hero-group-icon { font-size: 1.4rem; flex-shrink: 0; }
    .hero-group strong { font-size: 0.82rem; color: var(--ink); display: block; }
    .hero-group span { font-size: 0.7rem; color: var(--ink-soft); }

    /* ── Badge de producto estrella ── */
    .pcard-star {
      font-size: 0.62rem;
      font-weight: 700;
      padding: 0.22rem 0.55rem;
      border-radius: 4px;
      background: #fef3c7;
      color: #92400e;
      display: inline-flex;
      align-items: center;
      gap: 0.2rem;
      margin-left: auto;
      white-space: nowrap;
    }

    /* ── Responsive ── */
    @media (max-width: 900px) {
      .brand-hero-img.brand-hero-img-gradient { height: 320px; }
      .brand-hero-img-gradient .brand-hero-right-inner { padding: 2rem 1.5rem; }
      .brand-hero-logo { font-size: 2rem; }
      .pcard-img { height: 170px; }
    }
/* ─── FIX RESPONSIVE CIAMSA ─── */
@media (max-width: 900px) {
  .ciamsa-hero, .hero, section {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  img, video, iframe {
    max-width: 100% !important;
    height: auto !important;
  }
  /* Forzar que las columnas fijas se vuelvan 1 sola columna */
  .ciamsa-grid, .products-grid, .grid-3, .grid-2 {
    grid-template-columns: 1fr !important;
  }
  /* Si hay tablas, que se puedan deslizar */
  table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }
  /* Los anchos fijos de 400px/260px se vuelven 100% */
  [style*="width: 400px"], [style*="width: 260px"] {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ─── FIX REAL: Apilado de tarjetas en móvil ─── */
@media (max-width: 900px) {
  .subline-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .subline-grid > div, .subline-grid > a {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 1rem !important;
  }
}

/* ─── FIX DEFINITIVO MÓVIL CIAMSA ─── */
@media (max-width: 900px) {
  /* Forzar a que TODO el texto se rompa y no se desborde */
  * {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
  
  /* Asegurar que los contenedores no sean más anchos que la pantalla */
  .ciamsa-hero, .hero, section, .container, [class*="hero"], [class*="grid"] {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .brand-hero-img-ciamsa {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Apilar las viñetas (Capital, Mezclas, etc.) en 1 columna */
  .ciamsa-features, .features, .hero-features, ul, ol {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    width: 100% !important;
  }

  /* Ocultar el globo de "Cotiza aquí" en móvil para que no tape el texto */
  .agc-bot-tooltip {
    display: none !important;
  }

  /* Ajustar tamaño de fuentes gigantes */
  h1, h2 {
    font-size: 2rem !important;
    line-height: 1.2 !important;
  }
}

/* ─── FIX DEFINITIVO INTRO Y HERO (CIAMSA / ECOFERTIL) ─── */
@media (max-width: 900px) {
  /* 1. Apilar la intro (Logo arriba, texto abajo) */
  .brand-intro-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
    padding: 2rem 1rem !important;
  }

  /* 2. Apilar las viñetas de beneficios */
  .brand-benefits {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.2rem !important;
    width: 100% !important;
  }

  /* 3. Asegurar que el texto no se desborde */
  .brand-intro-text, 
  .brand-benefit p, 
  .brand-intro-title {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }

  /* 4. Arreglar el Hero de CIAMSA (el que tiene el gradiente) */
  .hero-groups {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    width: 100% !important;
    padding: 1rem !important;
  }
  
  .hero-group {
    width: 100% !important;
    display: flex !important;
    align-items: flex-start !important;
  }

  .brand-hero {
    display: flex !important;
    flex-direction: column !important;
    min-height: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .brand-hero-img-ciamsa { order: -1; }

  .brand-hero-left, .brand-hero-right-inner {
    padding: 2rem 1rem !important;
    width: 100% !important;
  }

  .brand-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .brand-hero-stat-num, .brand-hero-stat-lbl {
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: visible !important;
  }
  .brand-hero-stat-num { font-size: clamp(1.5rem, 7vw, 2rem); }

  /* 5. Reforzar las tarjetas de productos (por si acaso) */
  .subline-grid {
    grid-template-columns: 1fr !important;
  }
}
