/*
 * Activities Page Styles - Redesign v2
 * Focus: High Impact UX/UI, Emotional Design
 */

/* ===== HERO SECTION ===== */
.activities-hero {
  position: relative;
  /* Fondo con imagen inspiradora + overlay de marca */
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.85) 0%, rgba(59, 130, 246, 0.8) 100%),
              url('https://images.unsplash.com/photo-1485738422979-f5c462d49f74?q=80&w=1600&auto=format&fit=crop'); /* NYC Skyline */
  background-size: cover;
  background-position: center;
  background-attachment: scroll; /* Fixed parallax often causes issues on some browsers, scroll is safer */
  padding: 160px 0 120px; /* Increased top padding significantly to clear fixed headers */
  text-align: center;
  color: white;
  margin-bottom: var(--space-xl);
  border-bottom: none;
  display: flex;
  align-items: center;
  min-height: 500px; /* Taller hero */
}

.activities-hero h1 {
  color: white;
  font-size: var(--text-5xl); /* 48px - Match Home V2 */
  font-weight: 800;
  margin-bottom: var(--space-md);
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  letter-spacing: -1px;
  line-height: 1.15;
  padding-top: var(--space-md); /* Extra safety padding */
}

/* ===== FILTER BAR ===== */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: var(--space-lg);
}

.city-pill {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  color: white;
  font-size: var(--text-base); /* Match base text size */
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.city-pill:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  color: white;
  text-decoration: none;
}

.city-pill.active {
  background: white;
  color: var(--color-full-primary, #1e40af);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== ACTIVITIES GRID ===== */
.activities-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  padding: var(--space-xl) 0;
  justify-content: center; /* Centra items, incluyendo huérfanas */
}

/* Cards con ancho fijo para 3 columnas en desktop */
.activities-grid .activity-card {
  flex: 0 0 362px; /* No grow, no shrink, base 362px */
  max-width: 362px;
}

/* Tablet: 2 columnas */
@media (max-width: 1200px) {
  .activities-grid .activity-card {
    flex: 0 0 calc(50% - 16px); /* 50% menos medio gap */
    max-width: calc(50% - 16px);
  }
}

/* Mobile: 1 columna, pero estilo lista horizontal */
@media (max-width: 640px) {
  .activities-grid {
    gap: 16px;
    padding: var(--space-md) 0;
  }

  .activities-grid .activity-card {
    flex: 0 0 100%;
    max-width: 100%;
    /* Switch to Row Layout */
    flex-direction: row;
    min-height: 140px;
    align-items: stretch;
  }
}

/* ===== ACTIVITY CARD REFINEMENTS ===== */
.activity-card {
  background: white;
  border: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border-radius: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%; /* Force full height in grid */
  overflow: hidden; /* Ensure children don't overflow border radius */
}

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

/* Mobile Hover Disable or Adjust */
@media (max-width: 640px) {
  .activity-card:hover {
    transform: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  }
}

.activity-image {
  height: 220px;
  width: 100%;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  /* Border radius is handled by parent overflow: hidden usually, but here strictly: */
  border-radius: 20px 20px 0 0;
}

.activity-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.activity-card:hover .activity-image img {
  transform: scale(1.05);
}

/* Mobile Image Adjustments */
@media (max-width: 640px) {
  .activity-image {
    width: 38%; /* Occupy ~40% of width */
    height: auto; /* Full height */
    min-height: 140px;
    border-radius: 0; /* Reset specific radius, rely on card overflow */
  }
  
  .activity-card:hover .activity-image img {
    transform: none;
  }
}

.activity-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}

/* Mobile Badge */
@media (max-width: 640px) {
  .activity-badge {
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 11px;
  }
}

.activity-content {
  padding: 24px;
  flex-grow: 1; /* Content takes available space */
  display: flex;
  flex-direction: column;
}

/* Mobile Content */
@media (max-width: 640px) {
  .activity-content {
    width: 62%; /* Remaining width */
    padding: 12px;
  }
}

.activity-title {
  font-size: var(--text-xl); /* 20px - Match design tokens */
  font-weight: 700;
  margin-bottom: 12px;
  color: #1e293b;
  /* Limit title to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3rem; /* Reserve space for 2 lines always */
}

/* Mobile Title */
@media (max-width: 640px) {
  .activity-title {
    font-size: 15px; /* Smaller title */
    margin-bottom: 6px;
    min-height: auto; /* Remove min-height */
    line-height: 1.3;
  }
}

.activity-location {
  color: var(--color-full-primary);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

/* Mobile Location */
@media (max-width: 640px) {
  .activity-location {
    font-size: 11px;
    margin-bottom: 4px;
  }
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 62px; /* Reserva espacio para 2 filas de tags */
}

/* Mobile Meta */
@media (max-width: 640px) {
  .activity-meta {
    display: none; /* Hide meta tags on mobile list view for cleaner look */
  }
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #64748b;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 6px;
}

.meta-icon {
  font-size: 14px;
}

/* Description truncation */
.activity-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 16px 0;
  min-height: 42px; /* Reserva espacio para 2 líneas */
}

/* Mobile Description */
@media (max-width: 640px) {
  .activity-description {
    display: none; /* Hide description on mobile */
  }
}

.activity-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 20px;
  margin-top: auto; /* Empuja footer al fondo de la card */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Mobile Footer */
@media (max-width: 640px) {
  .activity-footer {
    border-top: none; /* Remove border for cleaner look */
    padding-top: 4px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.price-label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

/* Mobile Price Label */
@media (max-width: 640px) {
  .price-label {
    font-size: 10px;
    margin-bottom: 0;
    display: inline; /* Inline with price */
    margin-right: 4px;
  }
}

.price-value {
  color: #0f172a;
  font-family: var(--font-family-numbers);
  font-size: var(--text-2xl);
  font-weight: 700;
}

/* Mobile Price Value */
@media (max-width: 640px) {
  .price-value {
    font-size: 18px;
  }
}

.btn-activity {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background-color: #3b82f6;
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.btn-activity:hover {
  background-color: #2563eb;
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* Mobile Button */
@media (max-width: 640px) {
  .btn-activity {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 13px;
    margin-top: 4px;
  }
}

/* ===== FEATURED SECTION ===== */
.featured-section {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  padding: var(--space-3xl) 0;
  margin-top: var(--space-xl);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-header h2 {
  font-size: 44px; /* Match Home V2 */
  font-weight: 700;
  color: #0f172a;
  margin-bottom: var(--space-sm);
}

.section-header p {
  font-size: 1.25rem; /* 20px - Match Home V2 Subtitle */
  color: #64748b;
}

.feature-item {
  padding: var(--space-lg);
}

.feature-item h3 {
  font-size: var(--text-xl); /* 20px */
  font-weight: 600;
  color: #1e293b;
  margin-bottom: var(--space-sm);
}

.feature-item p {
  color: #64748b;
  line-height: 1.6;
}

/* ===== RESPONSIVE HERO & FILTER ===== */
@media (max-width: 768px) {
  .activities-hero {
    min-height: auto;
    padding: var(--space-3xl) var(--space-md);
    background-attachment: scroll; /* Performance en móvil */
  }
  
  .activities-hero h1 {
    font-size: 32px; /* Match Home V2 mobile */
  }

  .section-header h2 {
    font-size: 32px; /* Match Home V2 mobile */
  }

  .section-header p {
    font-size: 18px; /* Match Home V2 mobile */
  }
  
  /* Mobile Scroll Wrapper with Fade Mask */
  .filter-scroll-wrapper {
    position: relative;
    width: calc(100% + 48px); /* Break out of container */
    margin-left: -24px;
    margin-right: -24px;
    /* Fade mask on the right edge */
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    /* Ensure mask allows clicks? Mask doesn't block clicks on visible parts usually */
    pointer-events: auto; 
  }

  .filter-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    
    /* Padding: 
       Top: 0
       Right: 48px (Extra space so last item isn't hidden by mask)
       Bottom: 16px (Touch area/Shadow)
       Left: 24px (Align with content)
    */
    padding: 0 48px 16px 24px;
    
    width: 100%;
    margin: 0; /* Reset margins handled by wrapper */
    
    justify-content: flex-start;
    background: transparent;
    border-radius: 0;
    
    scrollbar-width: none; 
  }

  .filter-container::-webkit-scrollbar {
    display: none;
  }
  
  /* Remove the pseudo-element spacer as padding-right handles it now */
  .filter-container::after {
    display: none;
  }

  .city-pill {
    flex: 0 0 auto; /* Prevent shrinking */
    padding: 10px 20px;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
  }
  
  .city-pill.active {
    background: white;
    color: var(--color-full-primary, #1e40af);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* ===== SORT BAR ===== */
.sort-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: #f8fafc;
  border-radius: 14px;
  flex-wrap: wrap;
  gap: 16px;
}

.results-count {
  color: #475569;
  font-size: 17px;
  font-weight: 500;
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-dropdown label {
  color: #64748b;
  font-size: 16px;
  font-weight: 500;
}

.sort-dropdown select {
  padding: 12px 40px 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 14px center;
  font-size: 16px;
  color: #1e293b;
  cursor: pointer;
  appearance: none;
  min-width: 220px;
}

.sort-dropdown select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== IMAGE BADGES ===== */
.discount-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: #ef4444;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.free-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Mobile Badges Adjust */
@media (max-width: 640px) {
  .discount-badge {
    top: auto;
    bottom: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .free-badge {
    bottom: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }
}

/* ===== HEADER ROW (Location + Category) ===== */
.activity-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.activity-header-row .activity-location {
  margin-bottom: 0;
}

.activity-category {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Mobile Header Row */
@media (max-width: 640px) {
  .activity-header-row {
    flex-direction: column; /* Stack location and category? Or row? */
    /* Let's keep it simple, maybe hide category if too long, or just show location */
    flex-direction: row;
    justify-content: flex-start;
  }

  .activity-category {
    display: none; /* Hide category on mobile list view to save space */
  }
}

/* ===== ACTIVITY STATS (Travelers/Reviews) ===== */
.activity-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.activity-stats span {
  font-size: 14px;
  color: #64748b;
}

/* Mobile Stats */
@media (max-width: 640px) {
  .activity-stats {
    gap: 8px;
    margin-bottom: 8px;
  }
  
  .activity-stats span {
    font-size: 11px;
  }
}

/* ===== PRICE STYLES ===== */
.price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 58px; /* Reserva espacio para precio + tachado */
}

/* Mobile Price Block */
@media (max-width: 640px) {
  .price-block {
    min-height: auto;
    flex-direction: row; /* Inline price */
    align-items: baseline;
    gap: 6px;
    width: 100%;
    flex-wrap: wrap;
  }
}

.price-original {
  text-decoration: line-through;
  color: #94a3b8;
  font-size: 14px;
  margin-top: 2px;
}

.price-value.free {
  color: #10b981;
  font-size: 1.25rem;
}

/* ===== FREE CANCELLATION HIGHLIGHT ===== */
.meta-item.free-cancel {
  background: #ecfdf5;
  color: #059669;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.pagination .city-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 12px 20px;
  font-size: 16px;
  min-width: 48px;
  text-align: center;
}

.pagination .city-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.pagination .city-pill.active {
  background: var(--color-full-primary, #3b82f6);
  color: white;
  border-color: var(--color-full-primary, #3b82f6);
}

.pagination .city-pill.disabled {
  cursor: default;
  opacity: 0.6;
}

/* ===== RESPONSIVE SORT BAR ===== */
@media (max-width: 640px) {
  .sort-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 16px;
  }

  .sort-dropdown {
    justify-content: center;
  }

  .sort-dropdown select {
    width: 100%;
  }
}

/* ===== AJAX LOADING STATE ===== */
#activities-content {
  position: relative;
  min-height: 400px;
  transition: opacity 0.2s ease;
}

#activities-content.loading {
  opacity: 0.5;
  pointer-events: none;
}

#activities-content.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
  z-index: 10;
}

@keyframes spinner {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Empty state */
.activities-empty {
  text-align: center;
  padding: 60px 20px;
}

.activities-empty p {
  font-size: 18px;
  color: var(--color-text-secondary, #64748b);
  margin-bottom: 20px;
}
