/* Conversation UI - Main Stylesheet */

:root {
  /* Base colors */
  --primary-color: #EF4444;
  --primary-light: #FCA5A5;
  --primary-dark: #B91C1C;
  --secondary-color: #FFFBEB;
  --text-color: #1F2937;
  --text-light: #4B5563;
  
  /* Generation-specific colors */
  --boomer-color: #F97316;
  --boomer-light: #FDBA74;
  --genx-color: #FACC15;
  --genx-light: #FDE047;
  --millennial-color: #22C55E;
  --millennial-light: #86EFAC;
  --genz-color: #3B82F6;
  --genz-light: #93C5FD;
  --genalpha-color: #A855F7;
  --genalpha-light: #D8B4FE;
  
  /* UI elements */
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --bubble-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  --transition-standard: all 0.3s ease;
  
  /* Fonts */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Bangers', cursive;
  --font-accent: 'Luckiest Guy', cursive;
}

/* Dark mode variables */
.dark {
  --primary-color: #EF4444;
  --primary-light: #B91C1C;
  --primary-dark: #7F1D1D;
  --secondary-color: #1F2937;
  --text-color: #F9FAFB;
  --text-light: #D1D5DB;
}

/* Base styles */
body {
  font-family: var(--font-family);
  background-color: var(--secondary-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  text-align: center;
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  margin: 0;
  letter-spacing: 1px;
}

.app-subtitle {
  font-family: var(--font-accent);
  font-size: 1rem;
  margin: 0;
  opacity: 0.9;
}

/* Main container */
.main-container {
  flex: 1;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Category Carousel */
.category-carousel {
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  padding: 1rem 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  display: flex;
  gap: 1rem;
}

.category-carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

.category-card {
  scroll-snap-align: start;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  height: 150px;
  padding: 1rem;
  border-radius: 12px;
  background-color: white;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  /* Make keyboard accessible */
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.category-card:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3), var(--card-shadow);
}

/* Add tabindex support */
.category-card[tabindex] {
  outline: none;
}

.category-card[tabindex]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3), var(--card-shadow);
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-card:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 20px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.category-card:hover::before {
  opacity: 1;
}

.category-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 5px 10px -3px rgba(0, 0, 0, 0.15), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.category-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.category-name {
  font-weight: 600;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.category-count {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Featured Categories */
.featured-section {
  margin: 2rem 0;
}

.section-title {
  font-family: var(--font-accent);
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.section-title::before {
  content: "✨";
  margin-right: 0.5rem;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.featured-card {
  position: relative;
  border-radius: 12px;
  padding: 1.5rem;
  background-color: white;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  overflow: hidden;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

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

.featured-card:hover::before {
  transform: translateY(0);
}

.featured-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 5px 10px -3px rgba(0, 0, 0, 0.15), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.featured-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--primary-color);
  color: white;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  font-weight: 600;
}

.featured-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.featured-preview {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Surprise Me Button */
.surprise-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem auto;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.surprise-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transition: all 0.5s ease;
  z-index: -1;
}

.surprise-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 14px rgba(239, 68, 68, 0.3), 0 3px 6px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

.surprise-button:hover::before {
  left: 100%;
}

.surprise-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.surprise-icon {
  margin-right: 0.5rem;
  font-size: 1.2rem;
  animation: spin 10s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.surprise-button.animating {
  animation: shake 0.8s cubic-bezier(.36,.07,.19,.97) both;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Conversation View */
.conversation-container {
  max-width: 650px;
  margin: 2rem auto 0;
  padding: 1.5rem;
  background-color: #f9f9f9;
  background-image: radial-gradient(#e5e5e5 0.5px, #f9f9f9 0.5px);
  background-size: 10px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.conversation-header {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e5e5;
}

.back-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary-color);
  margin-right: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background-color: white;
}

.back-button:hover {
  background-color: rgba(239, 68, 68, 0.1);
  transform: translateX(-3px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.back-button:active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.conversation-topic {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--primary-dark);
  font-family: var(--font-accent);
}

.conversation-bubbles {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bubble-container {
  display: flex;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
  margin-bottom: 2.5rem;
  transition: transform 0.3s ease;
  align-items: flex-start;
}

.bubble-container:hover {
  transform: translateX(5px);
}

.bubble-container.boomer { --avatar-color: var(--boomer-color); }
.bubble-container.genx { --avatar-color: var(--genx-color); }
.bubble-container.millennials { --avatar-color: var(--millennial-color); }
.bubble-container.genz { --avatar-color: var(--genz-color); }
.bubble-container.genalpha { --avatar-color: var(--genalpha-color); }

.avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 1.25rem;
  width: 60px;
  position: relative;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--avatar-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  border: 3px solid white;
  animation: avatarBounce 0.6s ease forwards;
  opacity: 0;
  position: relative;
  z-index: 2;
}

.avatar-label {
  font-size: 0.7rem;
  margin-top: 0.5rem;
  text-align: center;
  color: var(--text-light);
  font-weight: 600;
  background-color: #f0f0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.speech-bubble {
  position: relative;
  padding: 1.5rem;
  border-radius: 18px;
  max-width: 85%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  background-color: white;
  background-image: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,1));
  animation: bubblePop 0.5s ease forwards 0.2s;
  opacity: 0;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  margin-left: 15px;
}

.speech-bubble:hover {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

/* Generation-specific styling */
.bubble-container.boomers .speech-bubble { border-left: 4px solid var(--boomer-color); }
.bubble-container.boomers .avatar { background-color: var(--boomer-color); }
.bubble-container.boomers .avatar-label { color: var(--boomer-color); background-color: var(--boomer-light); }

.bubble-container.genx .speech-bubble { border-left: 4px solid var(--genx-color); }
.bubble-container.genx .avatar { background-color: var(--genx-color); }
.bubble-container.genx .avatar-label { color: #806400; background-color: var(--genx-light); }

.bubble-container.millennials .speech-bubble { border-left: 4px solid var(--millennial-color); }
.bubble-container.millennials .avatar { background-color: var(--millennial-color); }
.bubble-container.millennials .avatar-label { color: #0B5E26; background-color: var(--millennial-light); }

.bubble-container.genz .speech-bubble { border-left: 4px solid var(--genz-color); }
.bubble-container.genz .avatar { background-color: var(--genz-color); }
.bubble-container.genz .avatar-label { color: #1E429F; background-color: var(--genz-light); }

.bubble-container.genalpha .speech-bubble { border-left: 4px solid var(--genalpha-color); }
.bubble-container.genalpha .avatar { background-color: var(--genalpha-color); }
.bubble-container.genalpha .avatar-label { color: #6B21A8; background-color: var(--genalpha-light); }

.speech-bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 20px;
  border-width: 8px 12px 8px 0;
  border-style: solid;
  border-color: transparent white transparent transparent;
  filter: drop-shadow(-3px 2px 2px rgba(0, 0, 0, 0.08));
}

.bubble-term {
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  color: #333;
  font-family: var(--font-accent);
  letter-spacing: 0.5px;
}

.bubble-definition {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: #555;
}

.bubble-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  border-top: 1px solid #f0f0f0;
  padding-top: 0.75rem;
}

.bubble-action {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-light);
  transition: all 0.2s ease;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
}

.bubble-action:hover {
  color: var(--primary-color);
  background-color: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

.bubble-action svg {
  width: 18px;
  height: 18px;
}

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

@keyframes bubblePop {
  0% { transform: scale(0.8); opacity: 0; }
  40% { transform: scale(1.1); }
  60% { transform: scale(0.9); }
  80% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes avatarBounce {
  0% { transform: translateY(10px); opacity: 0; }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-title {
    font-size: 2rem;
  }
  
  .main-container {
    padding: 0.75rem;
  }
  
  .category-carousel {
    padding: 0.75rem 0;
    gap: 0.75rem;
  }
  
  .featured-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .category-card {
    min-width: 100px;
    height: 120px;
    padding: 0.75rem;
  }
  
  .category-emoji {
    font-size: 1.5rem;
  }
  
  .category-name {
    font-size: 0.9rem;
  }
  
  .category-count {
    font-size: 0.7rem;
  }
  
  .featured-card {
    padding: 1.25rem;
  }
  
  .featured-title {
    font-size: 1.125rem;
  }
  
  .conversation-container {
    margin: 1rem auto 0;
    padding: 1rem;
  }
  
  .conversation-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
  }
  
  .conversation-topic {
    font-size: 1.2rem;
  }
  
  .bubble-container {
    margin-bottom: 1.5rem;
  }
  
  .avatar-container {
    margin-right: 1rem;
    width: 50px;
  }
  
  .avatar {
    width: 40px;
    height: 40px;
    font-size: 0.8rem;
  }
  
  .avatar-label {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
  }
  
  .speech-bubble {
    max-width: 80%;
    padding: 1.25rem;
    margin-left: 10px;
  }
  
  .bubble-term {
    font-size: 1.125rem;
  }
  
  .bubble-definition {
    font-size: 0.9rem;
  }
  
  .surprise-button {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    margin: 1rem auto;
  }
}

/* Dark mode adjustments */
.dark .category-card,
.dark .featured-card,
.dark .conversation-container {
  background-color: #2D3748;
  color: white;
}

.dark .speech-bubble {
  background-color: #4A5568;
}

.dark .speech-bubble::before {
  border-color: transparent #4A5568 transparent transparent;
}

.dark .category-count,
.dark .featured-preview,
.dark .avatar-label {
  color: #A0AEC0;
}

.dark .back-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark .conversation-header {
  border-bottom-color: #4A5568;
}
