/* Reset y configuraciones generales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #3661eb;
  --secondary-color: #8a4fff;
  --accent-color: #ff416c;
  --success-color: #38ef7d;
  --warning-color: #f7b731;
  --info-color: #4facfe;
  --law-color: #3661eb;
  --decree-color: #8a4fff;
  --circular-color: #ff416c;
  --regulation-color: #38ef7d;
  --misc-color: #4facfe;
  --text-color: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --light-text: #fff;
  --bg-color: #f5f7fa;
  --card-bg: #fff;
  --gradient-1: linear-gradient(135deg, #3661eb, #8a4fff);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --border-radius: 16px;
  --transition: all 0.3s ease;
  --border-light: rgba(0, 0, 0, 0.05);
  --border-medium: rgba(0, 0, 0, 0.1);
  
  /* Sistema de Z-index para gestionar capas */
  --z-base: 1;
  --z-cards: 10;
  --z-header: 100;
  --z-search: 90;
  --z-nav: 110;
  --z-notification: 1000;
  --z-modal: 2000;
  
  /* Nuevas variables para gestión de espacios */
  --header-height: 60px;
  --footer-height: 65px;
  --content-padding: 20px;
  --card-content-max-height: 75vh;
  --notification-height: 60px;
}

body {
  font-family: 'Poppins', sans-serif;
  /* overflow: hidden; */
  color: var(--text-color);
  background-color: var(--bg-color);
  /* touch-action: none;  */
  position: relative;
  height: 100vh;
  width: 100vw;
}

/* Contenedor principal */
.app-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-color);
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  padding: 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: var(--z-header);
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.about-view header, .saved-view header {
  background: #3661eb; /* Color primario sólido en las otras vistas */
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo-container h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--light-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  margin-right: 15px;
}

/* Racha diaria */
.streak-container {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 20px;
  color: var(--light-text);
  font-size: 0.8rem;
}

.streak-icon {
  color: #ff7b00;
  margin-right: 5px;
  animation: flame 1.5s infinite alternate;
  text-shadow: 0 0 5px rgba(255, 123, 0, 0.7);
}

.streak-count {
  font-weight: 700;
  margin-right: 3px;
}

@keyframes flame {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 1; }
}

@media (max-width: 480px) {
  header {
    padding: 0 12px;
    height: var(--header-height);
  }
  
  .logo-container h1 {
    font-size: 1.2rem;
    margin-right: 8px;
  }
  
  .streak-container {
    padding: 3px 6px;
    font-size: 0.7rem;
  }
  
  .progress-badge {
    width: 35px;
    height: 35px;
  }
  
  .nav-icons {
    gap: 12px;
  }
  
  .swipe-indicator {
    padding: 8px 15px;
    bottom: calc(var(--footer-height) + 10px);
  }
  
  .swipe-indicator.seen {
    padding: 5px 10px;
  }
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-icons i {
  font-size: 1.2rem;
  color: var(--light-text);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.nav-icons i:hover {
  transform: scale(1.1);
}

/* Contador de vistas */
.progress-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: var(--light-text);
  font-size: 0.7rem;
  line-height: 1;
}

.progress-badge span {
  font-weight: 700;
  font-size: 0.9rem;
}

.progress-badge small {
  font-size: 0.6rem;
  opacity: 0.8;
}

/* Barra de búsqueda */
.search-bar {
  position: fixed;
  top: -60px;
  left: 0;
  width: 100%;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.95);
  z-index: var(--z-search);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: top 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-bar.active {
  top: var(--header-height);
}

.search-bar input {
  flex: 1;
  padding: 8px 15px;
  border: none;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.05);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: var(--text-color);
}

.search-bar input:focus {
  outline: none;
  background: rgba(0, 0, 0, 0.08);
}

.search-bar i {
  font-size: 1.1rem;
  color: var(--text-color);
  cursor: pointer;
  margin-left: 15px;
}

/* Estilos para resultados de búsqueda */
.search-results {
  position: fixed;
  top: calc(var(--header-height) + 60px);
  left: 0;
  width: 100%;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.95);
  z-index: var(--z-search);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  padding: 0 0 15px 0;
}

.search-results.active {
  transform: translateY(0);
  opacity: 1;
}

.search-results-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
}

.search-results-header h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.search-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-option {
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 15px;
  background: #f0f0f0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-option:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

.filter-option.active {
  background: var(--primary-color);
  color: white;
}

.search-results-list {
  padding: 10px 20px;
}

.search-result-item {
  display: flex;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  border-left: 4px solid var(--primary-color);
}

.search-result-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item.law {
  border-left-color: var(--law-color);
}

.search-result-item.decree {
  border-left-color: var(--decree-color);
}

.search-result-item.circular {
  border-left-color: var(--circular-color);
}

.search-result-item.regulation {
  border-left-color: var(--regulation-color);
}

.search-result-item.misc {
  border-left-color: var(--misc-color);
}

.result-category {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--primary-color);
  color: white;
}

.result-category.law {
  background: var(--law-color);
}

.result-category.decree {
  background: var(--decree-color);
}

.result-category.circular {
  background: var(--circular-color);
}

.result-category.regulation {
  background: var(--regulation-color);
}

.result-category.misc {
  background: var(--misc-color);
}

.result-info {
  flex: 1;
  padding-right: 80px; /* Espacio para la etiqueta de categoría */
}

.result-info h4 {
  font-size: 1rem;
  margin-bottom: 5px;
  color: var(--text-color);
}

.result-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  color: var(--text-muted);
}

.search-empty i {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.5;
}

.search-empty p {
  font-size: 1rem;
}

/* Contenedor de tarjetas - REDISEÑADO */
.cards-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: var(--z-base);
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* Estilo de cada tarjeta/slide - REDISEÑADO */
.card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: var(--gradient-1);
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.card.active {
  transform: translateY(0);
  z-index: var(--z-cards);
}

.card.prev {
  transform: translateY(-100%);
  z-index: calc(var(--z-cards) - 1);
}

.card-content {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 25px;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 600px;
  max-height: var(--card-content-max-height);
  margin: 0 auto;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow);
  overflow-y: auto;
  position: relative;
  /* Estilo mejorado para scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
  
.card-content::-webkit-scrollbar {
  width: 6px;
}
  
.card-content::-webkit-scrollbar-track {
  background: transparent;
}
  
.card-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 6px;
}

.card.active .card-content {
  animation: fadeInScale 0.5s forwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0.5;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.category-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.3);
  color: var(--light-text);
  z-index: 5; /* Añadido para asegurar que está por encima */
  max-width: 45%; /* Limitar ancho máximo */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Añadir sombra para mejor visibilidad */
}

@media (max-width: 480px) {
  .category-badge {
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.65rem;
    max-width: 40%;
  }
  
  .card-title {
    padding-top: 25px; /* Espacio adicional arriba para evitar sobreposición */
    padding-right: 0; /* Quitar padding derecho */
    font-size: 1.4rem;
  }
}

.category-badge.law {
  background: rgba(54, 97, 235, 0.7);
}

.category-badge.decree {
  background: rgba(138, 79, 255, 0.7);
}

.category-badge.circular {
  background: rgba(255, 65, 108, 0.7);
}

.category-badge.regulation {
  background: rgba(56, 239, 125, 0.7);
}

.category-badge.misc {
  background: rgba(79, 172, 254, 0.7);
}

.card-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--light-text);
  line-height: 1.3;
  padding-right: 40px; /* Espacio para el badge */
}

.card-description {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  color: var(--light-text);
  font-weight: 400;
  text-align: left;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.card-citation {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: left;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 25px;
}

.bookmark-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bookmark-btn:hover {
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.3);
}

.bookmark-btn.active {
  background: var(--light-text);
  color: var(--primary-color);
  animation: pop 0.3s;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Gradientes alternados para cada tarjeta */
.card.law {
  background: linear-gradient(135deg, #3661eb, #627cff);
}

.card.decree {
  background: linear-gradient(135deg, #8a4fff, #b27aff);
}

.card.circular {
  background: linear-gradient(135deg, #ff416c, #ff6b8b);
}

.card.regulation {
  background: linear-gradient(135deg, #11998e, #38ef7d);
}

.card.misc {
  background: linear-gradient(135deg, #2193b0, #6dd5ed);
}

/* Contenedor de Guardados - REDISEÑADO */
.saved-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  padding: calc(var(--header-height) + 20px) var(--content-padding) var(--footer-height);
  overflow-y: auto;
  z-index: var(--z-base);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.saved-container.active {
  z-index: var(--z-cards);
  opacity: 1;
  pointer-events: auto;
  animation: slideInFromBottom 0.3s forwards;
}

.saved-header {
  margin-bottom: 20px;
}

.saved-title {
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: var(--text-color);
}

.saved-actions {
  background: white;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.saved-sort {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.saved-sort label,
.saved-filter label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-right: 10px;
}

.saved-sort select {
  padding: 8px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  background: #f9f9f9;
  color: var(--text-color);
  cursor: pointer;
}

.saved-sort select:focus {
  outline: 2px solid var(--primary-color);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.filter-tag {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 20px;
  background: #f0f0f0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tag:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

.filter-tag.active {
  background: var(--primary-color);
  color: white;
}

.filter-tag.law.active {
  background: var(--law-color);
}

.filter-tag.decree.active {
  background: var(--decree-color);
}

.filter-tag.circular.active {
  background: var(--circular-color);
}

.filter-tag.regulation.active {
  background: var(--regulation-color);
}

/* Estadísticas de guardados */
.saved-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.saved-stat-item {
  flex: 1;
  min-width: 100px;
  background: white;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}

.saved-stat-item:hover {
  transform: translateY(-3px);
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Grid de tarjetas guardadas mejorado */
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.saved-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.3s forwards;
}

.saved-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.saved-card:nth-child(2) {
  animation-delay: 0.05s;
}

.saved-card:nth-child(3) {
  animation-delay: 0.1s;
}

.saved-card:nth-child(4) {
  animation-delay: 0.15s;
}

.saved-card:nth-child(5) {
  animation-delay: 0.2s;
}

.saved-card-header {
  padding: 15px;
  position: relative;
  background: linear-gradient(135deg, rgba(0,0,0,0.03), rgba(0,0,0,0));
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.saved-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-color);
  line-height: 1.3;
  padding-right: 25px; /* Espacio para el botón de eliminar */
}

.saved-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
}

.saved-card-preview {
  padding: 15px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(0,0,0,0.02);
}

.saved-card-category {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  color: white;
  background: var(--primary-color);
  display: inline-block;
}

.saved-card-category.law {
  background: var(--law-color);
}

.saved-card-category.decree {
  background: var(--decree-color);
}

.saved-card-category.circular {
  background: var(--circular-color);
}

.saved-card-category.regulation {
  background: var(--regulation-color);
}

.saved-card-category.misc {
  background: var(--misc-color);
}

.card-actions {
  display: flex;
  gap: 10px;
}

.card-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-action-btn:hover {
  background: rgba(0,0,0,0.1);
  transform: scale(1.2);
}

.remove-saved {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-saved:hover {
  background: rgba(255,65,108,0.1);
  color: var(--accent-color);
}

/* Estados vacíos mejorados */
.empty-saved {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-illustration {
  width: 100px;
  height: 100px;
  background: rgba(0,0,0,0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-illustration i {
  font-size: 40px;
  color: var(--text-muted);
}

.empty-saved h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.empty-saved p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 400px;
}

.explore-button {
  padding: 12px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 25px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.explore-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(54, 97, 235, 0.3);
}

/* Vista de detalle */
.saved-detail-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.saved-detail-view.active {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 2;
}

.back-to-saved {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-color);
  cursor: pointer;
}

.detail-header h3 {
  margin-left: 15px;
  font-size: 1.2rem;
  color: var(--text-color);
}

.detail-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.detail-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  overflow: hidden;
}

.detail-card-header {
  padding: 20px;
  background: var(--primary-color);
  color: white;
}

.detail-card.law .detail-card-header {
  background: var(--law-color);
}

.detail-card.decree .detail-card-header {
  background: var(--decree-color);
}

.detail-card.circular .detail-card-header {
  background: var(--circular-color);
}

.detail-card.regulation .detail-card-header {
  background: var(--regulation-color);
}

.detail-card-title {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.detail-card-category {
  display: inline-block;
  padding: 5px 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 15px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.detail-card-body {
  padding: 20px;
}

.detail-card-description {
  font-size: 1rem;
  line-height: 1.6;
  color: #444;
  margin-bottom: 20px;
}

.detail-card-citation {
  font-size: 0.9rem;
  color: #888;
  font-style: italic;
  padding-top: 15px;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.detail-card-meta {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
}

.detail-card-meta i {
  margin-right: 5px;
}

.detail-card-meta span {
  margin-right: 15px;
}

.detail-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.detail-action-btn {
  padding: 10px 15px;
  border-radius: 8px;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-light {
  background: rgba(0,0,0,0.05);
  color: #444;
}

.btn-light:hover {
  background: rgba(0,0,0,0.1);
}

.btn-danger {
  background: rgba(255,65,108,0.1);
  color: var(--accent-color);
}

.btn-danger:hover {
  background: rgba(255,65,108,0.2);
}

/* Contenedor Acerca de - REDISEÑADO */
.about-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  padding: calc(var(--header-height) + 20px) var(--content-padding) var(--footer-height);
  overflow-y: auto;
  z-index: var(--z-base);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.about-container.active {
  z-index: var(--z-cards);
  opacity: 1;
  pointer-events: auto;
  animation: slideInFromBottom 0.3s forwards;
}

.about-container h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
  margin-left: 50px; /* Espacio para el botón de retorno */
  color: var(--text-color);
}

.about-container p {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  color: var(--text-secondary);
}

.about-container h3 {
  font-size: 1.3rem;
  margin: 30px 0 15px;
  color: var(--text-color);
}

/* Estadísticas mejoradas */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-icon {
  background: var(--primary-color);
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  color: white;
  font-size: 1.5rem;
}

.stat-info {
  flex: 1;
}

.stat-info h4 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 10px;
}

/* Barras de progreso */
.progress-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 4px;
  width: 0;
  transition: width 1s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Calendario de racha */
.streak-calendar {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30px;
}

.day-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.day-number {
  font-size: 0.9rem;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.calendar-day.visited .day-number {
  background: var(--success-color);
  color: white;
}

.calendar-day.today .day-number {
  outline: 2px solid var(--primary-color);
}

.achievement-text {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Próximos logros */
.next-achievements-section {
  margin-bottom: 30px;
}

.next-achievements-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.next-achievement-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  align-items: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.next-achievement-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.next-achievement-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
}

.next-achievement-info h4 {
  font-size: 1rem;
  margin-bottom: 5px;
  color: var(--text-color);
}

.next-achievement-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.empty-next-achievements {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  background: rgba(0,0,0,0.02);
  border-radius: 12px;
}

.empty-next-achievements i {
  font-size: 2rem;
  color: var(--success-color);
  margin-bottom: 10px;
}

.empty-next-achievements p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Sección de logros mejorada */
.achievements-section {
  margin-bottom: 30px;
}

.achievements-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.achievements-count {
  font-size: 0.9rem;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  color: var(--text-secondary);
}

.achievements-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

.tab-item {
  font-size: 0.9rem;
  padding: 8px 15px;
  border-radius: 20px;
  background: #f0f0f0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-item:hover {
  background: #e0e0e0;
}

.tab-item.active {
  background: var(--primary-color);
  color: white;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.badge-item {
  display: flex;
  align-items: center;
  padding: 15px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.badge-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.badge-item.locked {
  opacity: 0.7;
  background: #f9f9f9;
}

.badge-item.unlocked {
  position: relative;
}

.badge-item.unlocked:after {
  content: '\f00c';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--success-color);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-icon {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.badge-info {
  flex-grow: 1;
}

.badge-info h4 {
  font-size: 1rem;
  margin-bottom: 5px;
  color: var(--text-color);
}

.badge-info p {
  font-size: 0.85rem;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.4;
}

.badge-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Sección de consejos y ayuda */
.tips-section {
  margin-bottom: 30px;
}

.tips-carousel {
  display: flex;
  overflow: hidden;
  margin: 15px 0;
  transition: transform 0.5s ease;
}

.tip-card {
  flex: 0 0 100%;
  background: white;
  border-radius: 16px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.tip-card i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.tip-card h4 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.tip-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.carousel-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
}

.control-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-dot:hover {
  background: #ccc;
}

.control-dot.active {
  background: var(--primary-color);
  transform: scale(1.2);
}

/* Indicador de progreso - REDISEÑADO */
.progress-container {
  position: fixed;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-nav);
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  transition: var(--transition);
  margin: 4px 0;
}

.progress-dot.active {
  background-color: var(--light-text);
  transform: scale(1.2);
}

.progress-dot.progress-more {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  margin: 6px auto;
}

.progress-dot.progress-more:before {
  content: "•••";
  color: rgba(255, 255, 255, 0.5);
  position: relative;
  left: -8px;
  font-size: 10px;
  letter-spacing: -1px;
}

/* Indicador de deslizar - REDISEÑADO */
/* Indicador de deslizar - MEJORADO */
.swipe-indicator {
  position: fixed;
  bottom: calc(var(--footer-height) + 15px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--light-text);
  opacity: 0.95;
  z-index: var(--z-cards);
  background: rgba(0, 0, 0, 0.75);
  padding: 10px 20px;
  border-radius: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.5s ease;
  animation: attention 2s infinite;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Estado sutil después de la primera visualización */
.swipe-indicator.seen {
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  transform: translateX(-50%) scale(0.85);
  animation: gentle-pulse 3s infinite;
}

.swipe-indicator span {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.swipe-indicator.seen span {
  display: none; /* Ocultar el texto completamente */
}

.swipe-indicator i {
  margin-top: 5px;
  font-size: 1.2rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

/* Animación llamativa para primera visualización */
@keyframes attention {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05) translateY(-5px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
  100% { transform: translateX(-50%) scale(1); }
}

/* Animación sutil para después */
@keyframes gentle-pulse {
  0% { transform: translateX(-50%) scale(0.85); }
  50% { transform: translateX(-50%) scale(0.85) translateY(-3px); }
  100% { transform: translateX(-50%) scale(0.85); }
}

/* Animación para el ícono solo */
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}


/* Navegación inferior - REDISEÑADO */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-nav);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.back-button {
  position: fixed;
  top: calc(var(--header-height) + 15px);
  left: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-nav);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.back-button:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--light-text);
}

.nav-item:hover {
  transform: translateY(-3px);
}

.nav-item i {
  font-size: 1.2rem;
  margin-bottom: 5px;
}

.nav-item span {
  font-size: 0.8rem;
}

/* Animaciones adicionales */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-content > * {
  animation: fadeIn 0.5s forwards;
}

.card-title {
  animation-delay: 0.1s;
}

.card-description {
  animation-delay: 0.3s;
}

.card-actions {
  animation-delay: 0.5s;
  opacity: 0;
}

.card-citation {
  animation-delay: 0.7s;
}

/* Animación para botón compartir */
.share-button {
  display: inline-block;
  padding: 10px 25px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  color: var(--light-text);
  font-weight: 500;
  cursor: pointer;
  border: none;
  margin-top: 15px;
  transition: var(--transition);
  animation: fadeIn 0.5s forwards;
  animation-delay: 0.7s;
  opacity: 0;
}

.share-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
}

.share-button i {
  margin-right: 8px;
}

/* Transición y loader */
.transition-loader {
  position: fixed;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #fff;
  border-bottom-color: #fff;
  animation: spin 1s linear infinite;
  z-index: var(--z-modal);
}

.transition-loader.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes spin {
  0% { transform: translateX(-50%) rotate(0deg); }
  100% { transform: translateX(-50%) rotate(360deg); }
}

/* Efecto de rebote */
.bounce-top {
  animation: bounce-top 0.3s ease;
}

@keyframes bounce-top {
  0% { transform: translateY(0); }
  30% { transform: translateY(10px); }
  60% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

/* ===== SISTEMA DE NOTIFICACIONES REDISEÑADO ===== */
/* Contenedor principal de notificaciones */
.notifications-container {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: 10px;
  max-width: 350px;
  width: 100%;
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - 20px);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  z-index: var(--z-notification);
}

/* Estilo base de notificación */
.toast-notification {
  width: calc(100% - 20px);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  padding: 12px 15px;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin-bottom: 10px;

  pointer-events: auto;
  max-width: 350px;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-notification.hide {
  opacity: 0;
  transform: translateX(100%);
}

/* Icono de notificación */
.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.toast-icon i {
  font-size: 1.1rem;
  color: white;
}

/* Contenido de notificación */
.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 3px;
  color: var(--text-color);
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Botón para cerrar notificación */
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 5px;
  margin-left: 5px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.toast-close:hover {
  opacity: 1;
}

/* Barra de progreso para auto-cierre */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  width: 100%;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.toast-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--primary-color);
  animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
  0% { width: 100%; }
  100% { width: 0%; }
}

/* Variantes de notificación */
.toast-notification.info .toast-icon {
  background: var(--info-color);
}

.toast-notification.success .toast-icon {
  background: var(--success-color);
}

.toast-notification.warning .toast-icon {
  background: var(--warning-color);
}

.toast-notification.error .toast-icon {
  background: var(--accent-color);
}

.toast-notification.achievement {
  border-left: 4px solid #ffd700;
}

.toast-notification.achievement .toast-icon {
  background: #ffd700;
}

/* ===== MODAL DE CONFIRMACIÓN REDISEÑADO ===== */
.confirmation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);

  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.confirmation-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.confirmation-content {
  background: white;
  border-radius: 16px;
  padding: 25px;
  width: 90%;
  max-width: 350px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.confirmation-modal.active .confirmation-content {
  transform: scale(1);
}

.confirmation-content h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.confirmation-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirmation-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.confirmation-actions button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Confeti para celebraciones */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-notification);
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #ffd700;
  opacity: 0.8;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

/* Adaptación a dispositivos móviles y tablets */
@media (max-width: 768px) {
  :root {
    --card-content-max-height: 65vh;
  }
  
  .card-title {
    font-size: 1.5rem;
  }

  .card-description {
    font-size: 1rem;
  }
  
  .card-content {
    width: 95%;
    padding: 20px;
  }
  
  .stats-container {
    grid-template-columns: 1fr;
  }
  
  .badges-grid {
    grid-template-columns: 1fr;
  }
  
  .saved-grid {
    grid-template-columns: 1fr;
  }
  
  .saved-stats {
    flex-direction: column;
  }
  
  .saved-stat-item {
    width: 100%;
  }
  
  /* Mejora para notificaciones en móvil */
  .notifications-container {
    left: 10px;
    right: 10px;
    max-width: calc(100% - 20px);
  }
  
  .toast-notification {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 480px) {
  :root {
    --card-content-max-height: 60vh;
  }
  
  .card-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
  }

  .card-description {
    font-size: 0.95rem;
    margin-bottom: 15px;
  }
  
  .card-content {
    padding: 15px;
    width: 100%;
  }
  
  .logo-container h1 {
    font-size: 1.3rem;
  }
  
  .nav-icons i {
    font-size: 1.1rem;
  }
  
  .streak-container {
    padding: 3px 8px;
    font-size: 0.7rem;
  }
  
  .search-filters {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .filter-options {
    margin-top: 10px;
  }
  
  /* Ajustes de notificaciones para pantallas muy pequeñas */
  .toast-notification {
    padding: 10px;
  }
  
  .toast-icon {
    width: 30px;
    height: 30px;
    margin-right: 8px;
  }
  
  .toast-title {
    font-size: 0.9rem;
  }
  
  .toast-message {
    font-size: 0.8rem;
  }
}

/* Estilos para tarjetas patrocinadas */
.sponsored-card {
  position: relative;
  overflow: hidden; /* Añadido para controlar posibles desbordamientos */
}

.sponsored-content {
  position: relative;
  z-index: 2; /* Asegurar que esté por encima del fondo */
}

/* Añadir una capa adicional para mejorar contraste y legibilidad */
.sponsored-card:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.4));
  pointer-events: none; /* Permitir clics a través */
  z-index: 1;
}

/* Asegurar que el texto en la tarjeta patrocinada sea siempre visible */
.sponsored-card .card-title,
.sponsored-card .card-description,
.sponsored-card .sponsor-brand-name {
  color: white !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5); /* Añadir sombra para mejor legibilidad */
  position: relative;
  z-index: 3;
}

/* Mejorar visibilidad del logo */
.sponsor-logo {
  position: relative;
  z-index: 3;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Mejor posicionamiento para móviles */
@media (max-width: 480px) {
  .sponsored-card .card-content {
    padding: 20px 15px;
  }
  
  .sponsor-brand-container {
    margin-top: 20px; /* Dar más espacio para el badge */
  }
  
  .sponsored-card .card-title {
    padding-top: 30px;
  }
}


.category-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.3);
  color: var(--light-text);

  z-index: 5; /* Añadido para asegurar que está por encima */
  max-width: 45%; /* Limitar ancho máximo */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Añadir sombra para mejor visibilidad */
}

@media (max-width: 480px) {
  .category-badge {
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.65rem;
    max-width: 40%;
  }
  
  .card-title {
    padding-top: 25px; /* Espacio adicional arriba para evitar sobreposición */
    padding-right: 0; /* Quitar padding derecho */
    font-size: 1.4rem;
  }
}

.sponsored-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.6); /* Fondo más oscuro para mejor contraste */
  color: white; /* Color de texto blanco sólido */
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Sombra para mejor visibilidad */
  border: 1px solid rgba(255, 255, 255, 0.2); /* Borde sutil para definir mejor */
}

.sponsored-badge i {
  font-size: 0.7rem;
  color: white; /* Color explícito */
  opacity: 1; /* Asegurar máxima opacidad */
}

@media (max-width: 480px) {
  .sponsored-badge {
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.65rem;
  }
}

/* Forzar color de texto en el badge patrocinado para prevenir sobrescrituras */
.sponsored-badge,
.sponsored-badge * {
  color: white !important;
}

.sponsor-brand-container {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.sponsor-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
  background-color: white;
  padding: 3px;
  object-fit: contain;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sponsor-brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--light-text);
}

.sponsor-cta-button {
  display: inline-block;
  padding: 12px 25px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  color: var(--light-text);
  font-weight: 600;
  cursor: pointer;
  border: none;
  margin-top: 20px;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.sponsor-cta-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Animación especial para tarjetas patrocinadas */
.sponsored-card.active .card-content {
  animation: pulseLight 2s infinite, fadeInScale 0.5s forwards;
}

@keyframes pulseLight {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Animaciones mejoradas para tarjetas patrocinadas */
.sponsored-card.active .card-content {
  animation: 
    fadeInScale 0.5s forwards, 
    glowPulse 2s infinite alternate,
    slideFromBottom 0.5s ease-out;
}

@keyframes slideFromBottom {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }
  100% {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
  }
}

/* Animación para el botón CTA */
.sponsor-cta-button {
  position: relative;
  overflow: hidden;
}

.sponsor-cta-button:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.7);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.sponsor-cta-button.clicked:after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  20% {
    transform: scale(25, 25);
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}


/* Estilos para búsqueda mejorada */
.searching-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.searching-indicator i {
  margin-right: 10px;
  color: var(--primary-color);
}

mark {
  background-color: rgba(255, 230, 0, 0.4);
  padding: 0 2px;
  border-radius: 2px;
}

mark.highlight-primary {
  background-color: rgba(255, 165, 0, 0.6);
  font-weight: 500;
}

.search-filter-active {
  background: white;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 15px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-filter-active span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.clear-search {
  background: rgba(0,0,0,0.05);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 5px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.clear-search:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text-color);
}

/* Mejora visual para resultados de búsqueda */
.search-result-item {
  transition: all 0.2s ease;
}

.search-result-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Mejoras para filtros de categoría */
.filter-tag {
  position: relative;
  overflow: hidden;
}

.filter-tag::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}

.filter-tag:active::after {
  transform: translateY(0);
}

/* Estilos para el botón compartir */
.share-button {
  position: relative;
  overflow: hidden;
}

.share-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  transform: scale(0);
  transition: transform 0.3s ease;
}

.share-button:active::after {
  transform: scale(1);
}

.share-button.sharing {
  pointer-events: none;
  opacity: 0.8;
}

/* Modal de compartir */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.share-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.share-modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.share-modal.active .share-modal-content {
  transform: scale(1);
}

.share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--primary-color);
  color: white;
}

.share-modal-header h3 {
  font-size: 1.2rem;
  margin: 0;
}

.close-modal {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-modal-body {
  padding: 20px;
}

.share-text {
  width: 100%;
  height: 150px;
  padding: 12px;
  margin: 10px 0 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  resize: none;
  background: #f9f9f9;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.copy-text-btn {
  padding: 10px 15px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.copy-text-btn:hover {
  background: var(--secondary-color);
}

.copy-text-btn.copied {
  background: var(--success-color);
}

.share-platforms {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 5px;
}

.share-platforms button {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-platforms button:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.share-whatsapp {
  background: #25d366;
}

.share-telegram {
  background: #0088cc;
}

.share-email {
  background: #ea4335;
}

@media (max-width: 480px) {
  .share-modal-content {
    width: 95%;
  }
  
  .share-text {
    height: 120px;
  }
  
  .share-options {
    gap: 10px;
  }
}

/* Efecto de onda al clicar en compartir */
.share-button {
  position: relative;
  overflow: hidden;
}

.share-ripple {
  position: absolute;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  transform: scale(1);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(60);
    opacity: 0;
  }
}

/* Estilos para el menú de compartir en la vista de detalle */
.share-container {
  position: relative;
}

.share-detail-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  width: 150px;
  z-index: 10;
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.share-detail-menu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-option:hover {
  background: rgba(0,0,0,0.05);
}

.share-option i {
  width: 20px;
  text-align: center;
}

.share-option.share-whatsapp i {
  color: #25d366;
}

.share-option.share-telegram i {
  color: #0088cc;
}

.share-option.share-email i {
  color: #ea4335;
}

.share-option.share-clipboard i {
  color: var(--text-secondary);
}

.share-detail-btn.active {
  background: var(--primary-color);
  color: white;
}


/* Eliminar franja gris superior en móvil */
html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  overflow: hidden;
  width: 100%;
  height: 100%;
  position: fixed; /* Esto evita posibles desplazamientos */
}

/* Asegurar que el contenedor principal ocupe todo el espacio disponible */
.app-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  margin: 0;
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* Ajustar el header para que ocupe todo el ancho sin espacios */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  background: #3661eb; /* Color primario sólido en lugar de transparencia */
}

/* Ajustes específicos para iOS Safari, que a veces tiene problemas con espacios */
@supports (-webkit-touch-callout: none) {
  html, body {
    height: -webkit-fill-available;
  }
  
  .app-container {
    height: -webkit-fill-available;
  }
  
  header {
    height: var(--header-height);
  }
}

/* Ajustes para dispositivos con notch/franja superior */
@media screen and (orientation: portrait) and (max-device-width: 896px) {
  body {
    padding-top: env(safe-area-inset-top, 0px);
  }
  
  header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }
  
  .app-container {
    padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }
}


/* ===== ESTILOS PARA SISTEMA DE CARGA PROGRESIVA =====*/

/* Indicador de carga de transición */
.transition-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.transition-loader::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid #fff;
  animation: spin 1s linear infinite;
}

.transition-loader.fade-out {
  opacity: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Indicador de carga en búsqueda y estadísticas */
.searching-indicator, .stats-loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: #666;
}

.searching-indicator i, .stats-loading-indicator i {
  font-size: 24px;
  margin-bottom: 10px;
  color: #3661eb;
}

/* Indicador de error en búsqueda */
.error-indicator {
  padding: 15px;
  text-align: center;
  color: #f44336;
  background-color: rgba(244, 67, 54, 0.1);
  border-radius: 8px;
  margin: 10px 0;
}

/* Estilo para tarjetas cargándose */
.card.loading {
  background-color: #f5f5f5;
  border: 1px dashed #ddd;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.card.loading::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 3px solid rgba(54, 97, 235, 0.3);
  border-radius: 50%;
  border-top: 3px solid #3661eb;
  animation: spin 1s linear infinite;
}

/* Mejoras para indicador de deslizamiento */
.swipe-indicator {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  padding: 10px 15px;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.swipe-indicator.seen {
  opacity: 0.5;
  transform: translateX(-50%) scale(0.9);
}

.swipe-indicator i {
  animation: upDown 1.5s infinite ease-in-out;
}

@keyframes upDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Optimizaciones para UX durante carga */
.card-content {
  transition: opacity 0.2s ease;
}

.card.active .card-content {
  opacity: 1;
}

.card:not(.active) .card-content {
  opacity: 0.7;
}

/* Esqueleto de carga para tarjetas */
.card-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  border-radius: 12px;
  overflow: hidden;
}

.card-skeleton::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(0%); }
  100% { transform: translateX(200%); }
}

/* Mejoras visuales para feedback de carga */
.memory-status {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 10px;
  z-index: 50;
  opacity: 0.7;
}

.memory-status.loading {
  background-color: rgba(54, 97, 235, 0.7);
}

/* Mejoras de accesibilidad - contraste y visibilidad */
.notification-text, .toast-notification .toast-message {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Efecto de transición para tarjetas */
.card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.active {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Feedback para carga limitada en móviles */
@media (max-width: 768px) {
  .data-status-indicator {
    position: fixed;
    top: 60px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 5px 8px;
    border-radius: 10px;
    z-index: 100;
    opacity: 0.7;
    pointer-events: none;
  }
}

/* Animación para efecto de rebote en límites */
.card.bounce-bottom {
  animation: bounceBottom 0.3s ease-in-out;
}

.card.bounce-top {
  animation: bounceTop 0.3s ease-in-out;
}

@keyframes bounceBottom {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

@keyframes bounceTop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Estilos para el info de atajos de teclado */
.keyboard-shortcuts-info {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;
}

.info-btn {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.shortcuts-tooltip {
  position: absolute;
  bottom: 45px;
  right: 0;
  background: white;
  border-radius: 8px;
  padding: 15px;
  width: 250px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.keyboard-shortcuts-info.active .shortcuts-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.shortcuts-tooltip h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #333;
}

.shortcuts-tooltip ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shortcuts-tooltip li {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.shortcuts-tooltip kbd {
  background: #f1f1f1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: 10px;
  font-size: 12px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  min-width: 15px;
  text-align: center;
}

/* Estilo para indicador de búsqueda */
.searching-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #666;
}

.searching-indicator i {
  margin-right: 10px;
  color: #3661eb;
}