/**
 * Theme Cards - Magic Cat Themes Showcase
 * Magic card styling with unique design
 */

/* ===== THEMES GRID ===== */
.themes-grid {
  display: grid;
  gap: 2rem;
  margin: 0 auto;
  max-width: 1400px;
  
  /* Mobile first - 1 column */
  grid-template-columns: 1fr;
}

/* Tablet - 2 columns */
@media (min-width: 768px) {
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

/* Desktop - 3 columns */
@media (min-width: 1024px) {
  .themes-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
  }
}

/* Large desktop - max 3 columns (better UX than 4) */
@media (min-width: 1440px) {
  .themes-grid {
    gap: 3.5rem;
  }
}

/* ===== THEME CARD ===== */
.theme-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  
  backdrop-filter: blur(15px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  cursor: pointer;
  
  /* Stagger animation */
  opacity: 0;
  animation: cardReveal 0.6s ease-out forwards;
}

/* Stagger delay via inline style or JS */
.theme-card:nth-child(1) { animation-delay: 0.1s; }
.theme-card:nth-child(2) { animation-delay: 0.2s; }
.theme-card:nth-child(3) { animation-delay: 0.3s; }
.theme-card:nth-child(4) { animation-delay: 0.4s; }
.theme-card:nth-child(5) { animation-delay: 0.5s; }
.theme-card:nth-child(6) { animation-delay: 0.6s; }

/* Hover state */
.theme-card:hover {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--accent-primary);
  box-shadow: 
    0 15px 50px rgba(168, 85, 247, 0.4),
    0 0 40px var(--glow-color),
    inset 0 0 30px rgba(168, 85, 247, 0.1);
}

/* Active/click state */
.theme-card:active {
  transform: translateY(-5px) scale(1.01);
}

/* ===== CARD IMAGE CONTAINER ===== */
.card-image-container {
  position: relative;
  width: 100%;
  padding-top: 140%; /* 1:1.4 aspect ratio (portrait card) */
  overflow: hidden;
  background: linear-gradient(135deg, #2d1b4e 0%, #1a0b2e 100%);
}

.card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  
  transition: transform 0.5s ease, filter 0.3s ease;
  
  /* Subtle overlay */
  filter: brightness(0.9);
}

/* Hover effect - zoom & brighten */
.theme-card:hover .card-image {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Placeholder for missing images */
.card-image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 3rem;
}

.card-image-placeholder-text {
  margin-top: 1rem;
  font-size: 1rem;
  opacity: 0.8;
}

/* ===== CARD INFO SECTION ===== */
.card-info {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

/* App icon + name container */
.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px; /* Android adaptive icon style */
  object-fit: cover;
  
  /* Hide white background */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2px;
  
  border: 2px solid rgba(168, 85, 247, 0.4);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(168, 85, 247, 0.3);
  
  transition: all 0.3s ease;
  flex-shrink: 0; /* Don't shrink on small screens */
}

.theme-card:hover .app-icon {
  transform: scale(1.05);
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(168, 85, 247, 0.5);
}

.theme-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0; /* Remove margin since it's in flexbox */
  flex: 1; /* Take remaining space */
  
  /* Gradient text */
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  
  transition: transform 0.3s ease;
}

body.light-theme .theme-name {
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Light theme app icon border */
body.light-theme .app-icon {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 20px rgba(124, 58, 237, 0.3);
}

body.light-theme .theme-card:hover .app-icon {
  border-color: rgba(124, 58, 237, 0.7);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(124, 58, 237, 0.5);
}

.theme-card:hover .theme-name {
  transform: translateX(5px);
}

.theme-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ===== STATUS BADGE ===== */
.status-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  
  transition: all 0.3s ease;
}

/* Coming Soon badge */
.status-badge.coming-soon {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  border: 2px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  
  animation: pulse 2s ease-in-out infinite;
}

/* Available badge (future) */
.status-badge.available {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: 2px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.theme-card:hover .status-badge.coming-soon {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* ===== DOWNLOAD BUTTON (for future use) ===== */
.download-btn {
  display: inline-block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  
  color: white;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  
  transition: all 0.3s ease;
  
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.download-btn:hover {
  background: linear-gradient(135deg, #7c85f0 0%, #8b5bb8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--glow-color);
}

.download-btn:active {
  transform: translateY(0);
}

/* Disabled state */
.download-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== MAGIC BORDER EFFECT ===== */
.theme-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  
  background: linear-gradient(
    45deg,
    #a855f7,
    #ec4899,
    #f59e0b,
    #10b981,
    #3b82f6,
    #a855f7
  );
  background-size: 400% 400%;
  
  border-radius: 20px;
  opacity: 0;
  z-index: -1;
  
  transition: opacity 0.5s ease;
  animation: gradientShift 8s ease infinite;
}

.theme-card:hover::before {
  opacity: 0.6;
}

/* ===== PARTICLE BURST EFFECT (triggered by JS) ===== */
.card-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  pointer-events: none;
  animation: particleBurst 0.8s ease-out forwards;
  box-shadow: 0 0 10px var(--accent-primary);
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

/* ===== LOADING STATE ===== */
.theme-card.loading {
  pointer-events: none;
}

.theme-card.loading .card-image-container {
  background: linear-gradient(
    90deg,
    #2d1b4e 25%,
    #3d2b5e 50%,
    #2d1b4e 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
  .themes-grid {
    gap: 1.5rem;
  }
  
  .theme-card {
    border-radius: 16px;
  }
  
  .card-info {
    padding: 1.25rem;
  }
  
  .app-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }
  
  .theme-name {
    font-size: 1.25rem;
  }
  
  .theme-description {
    font-size: 0.85rem;
  }
  
  /* Reduce hover effects on mobile (touch devices) */
  @media (hover: none) {
    .theme-card:hover {
      transform: none;
    }
    
    .theme-card:hover .card-image {
      transform: none;
    }
  }
}

/* Extra small phones */
@media (max-width: 480px) {
  .themes-grid {
    gap: 1.25rem;
  }
  
  .app-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
  }
  
  .card-header {
    gap: 0.75rem;
  }
  
  .theme-name {
    font-size: 1.15rem;
  }
  
  .theme-description {
    font-size: 0.8rem;
  }
  
  .card-info {
    padding: 1rem;
  }
}

/* ===== ACCESSIBILITY ===== */
.theme-card:focus {
  outline: 3px solid var(--accent-primary);
  outline-offset: 4px;
}

.theme-card:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .theme-card,
  .card-image,
  .status-badge,
  .theme-name {
    animation: none;
    transition: none;
  }
  
  .theme-card:hover {
    transform: none;
  }
}
