/* ============================================
   Save to Drive — Estilos para banner y botón ⭐
   Solo suscriptores pueden seleccionar/exportar
   ============================================ */

/* ---- Botón ⭐ en cada tarjeta ---- */
.save-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  z-index: 5;
  opacity: 0.7;
}

.save-btn:hover {
  opacity: 1;
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.save-btn:focus-visible {
  outline: 2px solid var(--brand-primary, #0055ff);
  outline-offset: 2px;
}

.save-btn.saved {
  background: #fef3c7;
  opacity: 1;
  box-shadow: 0 2px 10px rgba(234, 179, 8, 0.3);
}

.save-btn.saved:hover {
  background: #fde68a;
}

/* Tarjeta necesita position relative para el botón absoluto */
.research-card {
  position: relative;
}

/* Highlight en tarjeta seleccionada */
.research-card.selected {
  border: 2px solid #eab308;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.15), 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ---- Banner inferior sticky ---- */
.save-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

/* Estado: usuario autenticado con papers seleccionados */
.save-banner--active {
  background: #ffffff;
  border-top: 2px solid var(--brand-primary, #0055ff);
  color: var(--text-primary, #000);
}

/* Estado: usuario invitado (CTA login) */
.save-banner--guest {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border-top: 2px solid var(--brand-primary, #0055ff);
  color: var(--text-secondary, #1a1a1a);
}

/* Ocultar banner cuando no hay selecciones (autenticado) */
.save-banner--hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.save-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.save-banner-icon {
  font-size: 1.3rem;
}

.save-banner-text {
  font-weight: 500;
}

.save-banner-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botón limpiar */
.save-banner-clear {
  padding: 6px 14px;
  border: 1px solid var(--border-primary, #e5e7eb);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #666);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.save-banner-clear:hover {
  background: #f3f4f6;
  border-color: var(--border-secondary, #d1d5db);
}

/* Botón exportar */
.save-banner-export {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: var(--brand-primary, #0055ff);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-banner-export:hover {
  background: var(--brand-accent, #0044dd);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.3);
}

.save-banner-export:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Botón login (guest) */
.save-banner-login {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: var(--brand-primary, #0055ff);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.save-banner-login:hover {
  background: var(--brand-accent, #0044dd);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.3);
}

/* Toast de éxito */
.save-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  background: #ffffff;
  border: 1px solid #d1fae5;
  border-left: 4px solid #10b981;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  animation: toastIn 0.3s ease-out;
  max-width: 400px;
}

.save-toast-icon {
  font-size: 1.5rem;
}

.save-toast-text strong {
  display: block;
  color: #065f46;
  margin-bottom: 4px;
}

.save-toast-link {
  color: var(--brand-primary, #0055ff);
  text-decoration: none;
  font-weight: 600;
}

.save-toast-link:hover {
  text-decoration: underline;
}

.save-toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Toast error */
.save-toast--error {
  border-color: #fee2e2;
  border-left-color: #ef4444;
}

.save-toast--error strong {
  color: #991b1b;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .save-banner {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .save-banner-text {
    font-size: 0.82rem;
  }

  .save-banner-export,
  .save-banner-login {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .save-banner-left {
    flex: 1 1 100%;
  }

  .save-banner-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .save-btn,
  .save-banner,
  .save-toast {
    transition: none;
    animation: none;
  }
}
