/* ============================================================================
   LOVBOT AI — Cookie Consent Banner + Google Consent Mode v2
   ============================================================================
   - Banner discreto estilo Stripe/Linear (abajo a la derecha)
   - Modal de "Personalizar" con categorías granulares
   - Default consent: DENIED (cumple Google Consent Mode v2)
   - Persistencia: 180 días (localStorage + cookie de respaldo)
   - Compatible con GTM, GA4 y Meta Pixel
   ============================================================================ */

#lb-cookie-banner,
#lb-cookie-modal,
#lb-cookie-modal-overlay {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}
#lb-cookie-banner *,
#lb-cookie-modal * { box-sizing: border-box; }

/* ===== BANNER (esquina inferior derecha) ===== */
#lb-cookie-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: calc(100% - 40px);
  max-width: 420px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 22px;
  z-index: 999998;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}
#lb-cookie-banner.lb-visible {
  transform: translateY(0);
  opacity: 1;
}
#lb-cookie-banner-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
#lb-cookie-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#lb-cookie-banner-icon svg {
  width: 18px;
  height: 18px;
  color: #475569;
}
#lb-cookie-banner-text { flex: 1; min-width: 0; }
#lb-cookie-banner-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 4px;
  line-height: 1.3;
}
#lb-cookie-banner-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #64748B;
  margin: 0;
}
#lb-cookie-banner-desc a {
  color: #7C3AED;
  text-decoration: underline;
  font-weight: 500;
}
#lb-cookie-banner-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lb-btn {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  flex: 1;
  min-width: 90px;
}
.lb-btn:active { transform: scale(0.98); }
.lb-btn-primary { background: #111827; color: white; }
.lb-btn-primary:hover { background: #1F2937; }
.lb-btn-secondary {
  background: white;
  color: #0F172A;
  border: 1.5px solid #E2E8F0;
}
.lb-btn-secondary:hover { border-color: #94A3B8; }
.lb-btn-text {
  background: transparent;
  color: #64748B;
  padding: 9px 8px;
  flex: 0 0 auto;
  min-width: auto;
  text-decoration: underline;
  font-weight: 500;
}
.lb-btn-text:hover { color: #0F172A; }

/* ===== MODAL PERSONALIZAR ===== */
#lb-cookie-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#lb-cookie-modal-overlay.lb-visible {
  opacity: 1;
  pointer-events: auto;
}
#lb-cookie-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  transform: scale(0.96);
  transition: transform 0.3s ease;
}
#lb-cookie-modal-overlay.lb-visible #lb-cookie-modal { transform: scale(1); }
#lb-cookie-modal-header {
  padding: 24px 24px 18px;
  border-bottom: 1px solid #F1F5F9;
}
#lb-cookie-modal-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 6px;
}
#lb-cookie-modal-subtitle {
  font-size: 14px;
  color: #64748B;
  margin: 0;
  line-height: 1.5;
}
#lb-cookie-modal-body { padding: 8px 24px; }
.lb-cookie-cat {
  padding: 16px 0;
  border-bottom: 1px solid #F1F5F9;
}
.lb-cookie-cat:last-child { border-bottom: none; }
.lb-cookie-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 6px;
}
.lb-cookie-cat-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}
.lb-cookie-cat-desc {
  font-size: 13px;
  color: #64748B;
  line-height: 1.5;
  margin: 0;
}
.lb-cookie-cat-required {
  font-size: 12px;
  color: #94A3B8;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 10px;
  background: #F1F5F9;
  border-radius: 999px;
}

/* Toggle switch */
.lb-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.lb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.lb-toggle-slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.lb-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.lb-toggle input:checked + .lb-toggle-slider { background: #7C3AED; }
.lb-toggle input:checked + .lb-toggle-slider::before { transform: translateX(18px); }
.lb-toggle input:disabled + .lb-toggle-slider { background: #E2E8F0; cursor: not-allowed; opacity: 0.7; }

#lb-cookie-modal-footer {
  padding: 16px 24px 22px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #F1F5F9;
}
#lb-cookie-modal-footer .lb-btn { flex: 1; }

/* ===== Mobile ===== */
@media (max-width: 480px) {
  #lb-cookie-banner {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 18px;
  }
  #lb-cookie-banner-buttons { flex-direction: column; }
  .lb-btn { width: 100%; }
  #lb-cookie-modal-footer { flex-direction: column-reverse; }
}

/* ===== Trigger flotante (botón pequeño abajo izquierda para reabrir) ===== */
#lb-cookie-trigger {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999997;
  padding: 0;
  transition: transform 0.2s ease;
}
#lb-cookie-trigger.lb-visible { display: flex; }
#lb-cookie-trigger:hover { transform: scale(1.1); }
#lb-cookie-trigger svg { width: 18px; height: 18px; color: #475569; }
