/* ================================================================
   banner-component.css — Estilos del web component <reciclanet-banner>
   Reciclanet Web 2026 — v2.0 (rediseño a cards)

   Depende de: variables.css (tokens de diseño)
   NO depende de main.css — autónomo para usarse en cualquier página

   Contenido:
     1. Contenedor del banner (carrusel de cards)
     2. Cards individuales
     3. Imagen de la card — siempre completa, sin recortes
     4. Contenido textual de la card
     5. Controles: flechas y etiqueta
     6. Modal de inscripción a eventos
     7. Formulario dentro del modal
     8. Estados de carga, éxito y error
     9. Responsive
================================================================ */

/* ── 1. CONTENEDOR DEL BANNER ──────────────────────────────────── */

.rb-banner {
  position: relative;
  width: 100%;
  background: var(--color-bg-alt);
  padding: clamp(1rem, 2.5vw, 1.5rem) 0;
  overflow: hidden;
}

/* Etiqueta de sección encima del carrusel */
.rb-banner__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 clamp(1rem, 3vw, 2rem);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── 2. TRACK — carril deslizante ──────────────────────────────── */

.rb-track-wrap {
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  /* Máscara de desvanecimiento en los bordes */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 4%,
    black 96%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 4%,
    black 96%,
    transparent 100%
  );
}
.rb-track-wrap::-webkit-scrollbar {
  display: none;
}
.rb-track {
  display: flex;
  gap: clamp(10px, 1.5vw, 16px);
  width: max-content;
}




/* ── 3. CARD INDIVIDUAL ────────────────────────────────────────── */

.rb-card {
  width: clamp(280px, 35vw, 420px);
  flex-shrink: 0;
  background: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: default;
  transition: border-color 0.22s, box-shadow 0.22s, transform 0.22s;
  /* Evitar arrastre accidental */
  -webkit-user-drag: none;
  user-select: none;
}

.rb-card--clickable {
  cursor: pointer;
}

.rb-card--clickable:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px rgba(39, 174, 96, 0.15);
  transform: translateY(-2px);
}

.rb-card--clickable:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── 4. IMAGEN DE LA CARD — siempre completa, sin recortes ─────── */

.rb-card__img-wrap {
    width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #ffffff;
}

.rb-card__img {
  width: 100%;
  height: 100%;
 
  object-fit: cover;
  object-position: center center;
  background: #ffffff;
}

.rb-card--clickable:hover .rb-card__img {
  transform: scale(1.03);
}

/* Placeholder cuando no hay imagen */
.rb-card__img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Degradado corporativo */
  background: linear-gradient(
    135deg,
    var(--color-bg-alt2, #f0faf4) 0%,
    #e8f5e9 100%
  );
}

.rb-card__img-placeholder--evento {
  background: linear-gradient(135deg, #1a2744 0%, #27ae60 100%);
}
.rb-card__img-placeholder--aviso {
  background: linear-gradient(135deg, #27ae60 0%, #f0faf4 100%);
}
.rb-card__img-placeholder--blog {
  background: linear-gradient(135deg, #3d3d52 0%, #1a2744 100%);
}

.rb-card__img-placeholder-icon {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  opacity: 0.6;
}

/* Badge de tipo sobre la imagen */
.rb-card__badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.rb-card__badge--evento {
  background: rgba(240, 180, 41, 0.95);
  color: #1a1a2a;
}
.rb-card__badge--blog {
  background: rgba(39, 174, 96, 0.92);
  color: #ffffff;
}
.rb-card__badge--aviso {
  background: rgba(255, 255, 255, 0.9);
  color: #1a2744;
}

/* ── 5. CONTENIDO TEXTUAL DE LA CARD ───────────────────────────── */

.rb-card__body {
  padding: clamp(10px, 1.5vw, 14px) clamp(12px, 2vw, 16px) clamp(12px, 2vw, 16px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rb-card__titulo {
  font-family: var(--font-display);
  font-size: clamp(0.82rem, 1.4vw, 0.95rem);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin: 0;
  /* Máximo 2 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rb-card__meta {
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 1.1vw, 0.8rem);
  color: var(--color-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rb-card__cta {
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1.1vw, 0.8rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.18s, gap 0.18s;
}

.rb-card--clickable:hover .rb-card__cta {
  color: var(--color-primary-dark);
  gap: 8px;
}

/* ── 6. CONTROLES DE NAVEGACIÓN ────────────────────────────────── */

/* Flechas — esquina superior derecha del banner */
.rb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rb-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: #ffffff;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  flex-shrink: 0;
  padding: 0;
}

.rb-nav-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.rb-nav-btn svg {
  width: 13px;
  height: 13px;
  pointer-events: none;
}

/* Dots debajo del carrusel */
.rb-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 0.875rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.rb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, width 0.25s;
  flex-shrink: 0;
}

.rb-dot.rb-dot--active {
  background: var(--color-primary);
  width: 18px;
  border-radius: var(--radius-full);
}

/* ── 7. MODAL DE INSCRIPCIÓN ───────────────────────────────────── */

.rb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 8000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.rb-modal-overlay.rb-modal--open {
  opacity: 1;
  visibility: visible;
}

.rb-modal {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  margin: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.rb-modal-overlay.rb-modal--open .rb-modal {
  transform: translateY(0);
}

/* Cabecera del modal con imagen del evento */
.rb-modal__hero {
  position: relative;
  /* Proporción 16:9 — imagen siempre completa */
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--color-primary-bg);
}

.rb-modal__hero-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.rb-modal__hero-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #1a2744, #27ae60);
}

.rb-modal__hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26,39,68,0.65) 0%, transparent 55%);
}

.rb-modal__hero-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
}

.rb-modal__hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(240, 180, 41, 0.92);
  color: #1a1a2a;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.rb-modal__hero-titulo {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.rb-modal__hero-fecha {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
  margin-top: 3px;
}

.rb-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s;
  z-index: 2;
}

.rb-modal__close:hover { background: rgba(0,0,0,0.5); }

.rb-modal__body {
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.rb-modal__desc {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

/* ── 8. FORMULARIO DEL MODAL ───────────────────────────────────── */

.rb-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.rb-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 480px) {
  .rb-form-row { grid-template-columns: 1fr 1fr; }
}

.rb-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rb-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.rb-required { color: var(--color-error); margin-left: 2px; }

.rb-input,
.rb-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text-primary);
  background: var(--color-bg-alt);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  box-sizing: border-box;
}

.rb-input:focus,
.rb-textarea:focus {
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.12);
}

.rb-input::placeholder,
.rb-textarea::placeholder {
  color: var(--color-text-light);
}

.rb-input--invalid {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}

.rb-textarea {
  resize: vertical;
  min-height: 72px;
}

/* Texto de ayuda fijo — siempre visible durante la escritura */
.rb-field-hint {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.rb-rgpd {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
}

.rb-rgpd input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
}

.rb-rgpd-text {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  cursor: pointer;
}

.rb-rgpd-text a {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.rb-field-error {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-error);
  display: none;
}

.rb-field-error--visible { display: block; }

.rb-alert {
  padding: 10px 14px;
  background: var(--color-error-bg);
  border: 1.5px solid #f5c2c7;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-error);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rb-submit-btn {
  align-self: flex-end;
  padding: 10px 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rb-submit-btn:hover { background: var(--color-primary-dark); }
.rb-submit-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.rb-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: rb-spin 0.7s linear infinite;
  display: none;
}

.rb-submit-btn--loading .rb-spinner { display: block; }

@keyframes rb-spin { to { transform: rotate(360deg); } }

/* ── 9. ESTADOS: ÉXITO Y CARGA ─────────────────────────────────── */

.rb-success {
  text-align: center;
  padding: 2rem 1rem;
}

.rb-success__icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
}

.rb-success__title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 800;
  color: var(--color-primary-dark);
  margin: 0 0 0.5rem;
}

.rb-success__msg {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

.rb-success__close {
  padding: 9px 24px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.18s;
}

.rb-success__close:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.rb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--color-bg-alt);
}

.rb-loading__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-primary-light, #a8d5b5);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: rb-spin 0.8s linear infinite;
}

/* ── 10. HONEYPOT ───────────────────────────────────────────────── */

.rb-hp {
  opacity: 0;
  position: absolute;
  top: 0; left: 0;
  height: 0; width: 0;
  z-index: -1;
  pointer-events: none;
}

/* ── 11. RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 480px) {
  .rb-card {
    width: clamp(180px, 72vw, 240px);
  }
}

@media (min-width: 1024px) {
  .rb-card {
    width: clamp(240px, 22vw, 300px);
  }
}

@media (min-width: 1400px) {
  .rb-card {
    width: clamp(260px, 20vw, 320px);
  }
}
