/* Tweet Harvest CSS - Harvest-themed styling */
:root {
  --deep-soil: #004b23;
  --rich-earth: #006400;
  --fertile-ground: #007200;
  --growing-field: #008000;
  --fresh-harvest: #38b000;
  --spring-growth: #70e000;
  --new-sprout: #9ef01a;
  --bright-bloom: #ccff33;
  --text-dark: #000000;
  --text-light: #666666;
  --border-light: #e8d5b7;
  --shadow: rgba(0, 75, 35, 0.2);
  --error-red: #d32f2f;
  --success-green: #388e3c;
  --background-light: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(
    135deg,
    #f8f9fa 0%,
    rgba(158, 240, 26, 0.08) 20%,
    #f8f9fa 100%
  );
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: linear-gradient(
    135deg,
    var(--deep-soil) 0%,
    var(--fertile-ground) 100%
  );
  color: white;
  padding: 2rem 0;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.logo i {
  font-size: 2.5rem;
  color: var(--bright-bloom);
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.tagline {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-card {
  background: var(--background-light);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 8px 30px var(--shadow);
  border: 2px solid var(--spring-growth);
}

.search-card h2 {
  color: var(--rich-earth);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.search-card h2 i {
  margin-right: 0.5rem;
}

.search-form {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-input-container {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--spring-growth);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: rgba(112, 224, 0, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: var(--growing-field);
  box-shadow: 0 0 0 2px rgba(112, 224, 0, 0.2);
}

.search-btn {
  background: linear-gradient(
    135deg,
    var(--deep-soil) 0%,
    var(--rich-earth) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.search-btn:hover {
  box-shadow: 0 4px 15px var(--shadow);
}

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

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--background-light);
  border: 2px solid var(--spring-growth);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 15px var(--shadow);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

/* Special handling for dropdowns in chat tab to prevent cutoff */
.chat-section .search-dropdown {
  position: fixed;
  max-height: min(300px, calc(100vh - 200px));
  z-index: 10000;
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(158, 240, 26, 0.2);
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dropdown-item:hover,
.dropdown-item.highlighted {
  background: rgba(56, 176, 0, 0.1);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item .account-username {
  font-weight: 600;
  color: var(--rich-earth);
}

.dropdown-item .account-display-name {
  color: var(--text-light);
  font-size: 0.9rem;
}

.dropdown-item .account-stats {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-light);
}

.search-dropdown.hidden {
  display: none;
}

.account-info {
  padding: 1rem;
  background: rgba(204, 255, 51, 0.1);
  border-radius: 8px;
}

/* Results Section */
.results-section {
  background: var(--background-light);
  border-radius: 15px;
  box-shadow: 0 8px 30px var(--shadow);
  border: 2px solid var(--spring-growth);
  overflow: hidden;
}

.filters {
  background: rgba(112, 224, 0, 0.1);
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--spring-growth);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.filters h3 {
  color: var(--rich-earth);
  font-size: 1.3rem;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.limit-select {
  padding: 8px 12px;
  border: 2px solid var(--spring-growth);
  border-radius: 6px;
  background: var(--background-light);
  font-size: 1rem;
}

/* Draftpoasts Toggle */
.draftpoasts-toggle-container {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--spring-growth);
}

.draftpoasts-toggle-container.hidden {
  display: none;
}

.draftpoasts-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.draftpoasts-toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.draftpoasts-toggle input:checked + .toggle-slider {
  background: var(--fresh-harvest);
}

.draftpoasts-toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--rich-earth);
  white-space: nowrap;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(158, 240, 26, 0.1);
  border-bottom: 2px solid var(--spring-growth);
  padding: 0.5rem;
}

.tab-btn {
  flex: 1 1 auto;
  min-width: calc(100% / 7 - 0.5rem);
  padding: 1rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.tab-btn:hover {
  background: rgba(0, 75, 35, 0.1);
  color: var(--text-dark);
}

.tab-btn.active {
  background: var(--background-light);
  color: var(--rich-earth);
  border-bottom-color: transparent;
}

.tab-btn i {
  margin-right: 0.5rem;
}

/* Tab Content */
.tab-content {
  padding: 2rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.ratio-section {
  margin-bottom: 2rem;
}

.ratio-section h4 {
  color: var(--rich-earth);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Word Cloud Styles */
.wordcloud-section {
  padding: 1rem 0;
}

.wordcloud-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.wordcloud-btn {
  background: linear-gradient(
    135deg,
    var(--deep-soil) 0%,
    var(--rich-earth) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wordcloud-btn:hover:not(:disabled) {
  box-shadow: 0 4px 15px var(--shadow);
}

.wordcloud-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wordcloud-container {
  width: 100%;
  height: 400px;
  max-width: 400px;
  margin: 0 auto;
  background: rgba(112, 224, 0, 0.05);
  border: 2px solid var(--new-sprout);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  aspect-ratio: 1;
}

.wordcloud-placeholder {
  text-align: center;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 2rem;
  border-radius: 8px;
}

.wordcloud-placeholder:hover {
  background: rgba(56, 176, 0, 0.1);
  color: var(--text-dark);
}

.wordcloud-placeholder p {
  font-size: 1.1rem;
  margin: 0;
}

#wordCloudCanvas {
  width: 100%;
  height: 100%;
  max-width: 400px;
  max-height: 400px;
}

.wordcloud-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  z-index: 10;
}

.progress-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-dark);
  font-weight: 600;
}

.wordcloud-container::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(
    to top,
    var(--fresh-harvest) 0%,
    rgba(56, 176, 0, 0.3) 100%
  );
  transition: height 0.5s ease;
  border-radius: 0 0 10px 10px;
  z-index: 1;
}

.wordcloud-container.filling::before {
  height: var(--progress-height, 0%);
}

/* Tweet Grid */
.tweets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.tweet-card {
  background: rgba(112, 224, 0, 0.06);
  border: 2px solid var(--new-sprout);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tweet-card {
  cursor: pointer;
  position: relative;
}

.tweet-card:hover {
  box-shadow: 0 8px 25px var(--shadow);
  border-color: var(--growing-field);
}

.tweet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  height: 24px;
  line-height: 1;
}

.tweet-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
}

.tweet-date span {
  color: var(--rich-earth);
  font-weight: 600;
}

.tweet-ratio-label {
  color: var(--rich-earth);
  font-weight: 600;
  background: rgba(0, 128, 0, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.tweet-text {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.tweet-text a {
  color: var(--fresh-harvest);
  text-decoration: underline;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tweet-text a:hover {
  color: var(--growing-field);
  background: rgba(0, 128, 0, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
}

.tweet-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.metric {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
  height: 24px;
  line-height: 1;
}

.metric i {
  color: var(--fresh-harvest);
}

.metric.highlight {
  background: var(--growing-field);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.metric.highlight i {
  color: white;
}

.copy-tweet-btn {
  background: transparent;
  color: var(--text-light);
  border: none;
  padding: 0.3rem;
  border-radius: 4px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.copy-tweet-btn:hover {
  color: var(--fresh-harvest);
  background: rgba(56, 176, 0, 0.1);
}

.ratio-badge {
  background: linear-gradient(
    135deg,
    var(--deep-soil) 0%,
    var(--rich-earth) 100%
  );
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--rich-earth);
}

.loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--growing-field);
}

.loading p {
  font-size: 1.1rem;
  font-weight: 600;
}

.error-message {
  background: var(--error-red);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin: 1rem 0;
  text-align: center;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Footer */
.footer {
  background: var(--deep-soil);
  color: var(--background-light);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer a {
  color: var(--fresh-harvest);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fresh-harvest);
  font-size: 3rem;
  transition: color 0.3s ease;
  text-decoration: none !important;
}

.social-link:hover {
  color: var(--spring-growth);
  text-decoration: none !important;
}

.social-link img {
  width: 2.5rem;
  height: calc(
    2.5rem * 1447 / 1000
  ); /* Maintain 1000:1447 aspect ratio with width fixed */
  transition: filter 0.3s ease;
  /* Apply darker green color filter to better match other icons */
  filter: brightness(0) saturate(100%) invert(45%) sepia(82%) saturate(1200%)
    hue-rotate(75deg) brightness(95%) contrast(90%);
}

.social-link:hover img {
  /* Apply lighter green color filter on hover */
  filter: brightness(0) saturate(100%) invert(60%) sepia(90%) saturate(1150%)
    hue-rotate(75deg) brightness(105%) contrast(88%);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .logo i {
    font-size: 2rem;
  }

  .search-form {
    flex-direction: column;
  }

  .search-btn {
    align-self: flex-start;
  }

  .filters {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-controls {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .draftpoasts-toggle-container {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
  }

  .toggle-label {
    font-size: 0.8rem;
  }

  .toggle-slider {
    width: 36px;
    height: 20px;
  }

  .toggle-slider::before {
    width: 16px;
    height: 16px;
  }

  .draftpoasts-toggle input:checked + .toggle-slider::before {
    transform: translateX(16px);
  }

  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tab-btn {
    min-width: auto;
    flex: 1 1 calc(50% - 0.5rem);
    margin: 0.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.8rem 0.5rem;
  }

  .tweets-grid {
    grid-template-columns: 1fr;
  }

  .tweet-metrics {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .search-card,
  .tab-content {
    padding: 1rem;
  }

  .tweet-card {
    padding: 1rem;
  }

  .header {
    padding: 1.5rem 0;
  }
}

/* Chat History Styles */
.chat-section {
  margin-top: 1rem;
}

.chat-setup {
  background: var(--background-light);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.second-user-selection h4 {
  color: var(--fertile-ground);
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.second-user-selection .search-input-container {
  margin-bottom: 1rem;
}

/* Chat Container */
.chat-container {
  background: #f2f2f7; /* iOS Messages background */
  border-radius: 12px;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.chat-header {
  background: var(--background-light);
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.chat-participants {
  font-weight: 600;
  color: var(--fertile-ground);
  font-size: 1.1rem;
}

.chat-participants.clickable {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
}

.chat-participants.clickable:hover {
  background: rgba(0, 128, 0, 0.1);
  transform: scale(1.02);
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Chat Search */
.chat-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.chat-search-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  width: 200px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-search-input:focus {
  border-color: var(--growing-field);
}

.chat-search-btn {
  background: var(--growing-field);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-search-btn:hover {
  background: var(--fertile-ground);
  transform: scale(1.05);
}

.search-navigation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--background-light);
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 12px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: #f0f0f0;
  color: var(--fertile-ground);
}

#searchResultCounter {
  color: var(--text-light);
  font-size: 12px;
  min-width: 40px;
  text-align: center;
}

/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f2f2f7;
}

.chat-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-light);
}

.chat-loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--growing-field);
}

/* Message Bubbles - iOS Style */
.message-group {
  margin-bottom: 1rem;
}

.date-separator {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.date-separator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #c7c7cc;
}

.date-separator span {
  background: #f2f2f7;
  padding: 0.5rem 1rem;
  color: #8e8e93;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.message-bubble {
  max-width: 70%;
  margin-bottom: 2px;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
  animation: messageSlideIn 0.3s ease-out;
}

.message-bubble.clickable-tweet {
  cursor: pointer;
  transition: all 0.2s ease;
}

.message-bubble.clickable-tweet:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message-bubble.sent {
  background: #007aff; /* iOS blue */
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  background: #e5e5ea; /* iOS gray */
  color: black;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message-bubble.context {
  background: #f0f0f0; /* Neutral gray for context tweets */
  color: #333;
  margin: 0 auto;
  max-width: 85%;
  border: 1px solid #ddd;
  border-radius: 12px;
}

.message-bubble.highlight {
  background: #ffd60a !important;
  color: black !important;
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.3);
}

.message-content {
  margin-bottom: 4px;
}

.message-meta {
  font-size: 11px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 4px;
  flex-wrap: wrap;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
}

.message-type {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  font-weight: 500;
}

.sent .message-type {
  background: rgba(255, 255, 255, 0.2);
}

.message-username {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
  color: var(--fertile-ground);
  font-weight: 600;
}

/* Thread indicators */
.thread-indicator {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  color: #8e8e93;
  font-size: 11px;
  font-family: monospace;
  white-space: pre;
}

.thread-indicator.depth-1 {
  left: -20px;
}

.thread-indicator.depth-2 {
  left: -30px;
}

.thread-indicator.depth-3 {
  left: -40px;
}

.message-bubble[class*="depth-"] {
  position: relative;
}

.message-bubble.reply {
  position: relative;
}

/* Threading indentation based on depth */
.message-bubble.sent[data-tweet-id] {
  margin-left: auto;
}

.message-bubble.received[data-tweet-id] {
  margin-right: auto;
}

.message-bubble.context[data-tweet-id] {
  margin: 0 auto;
}

/* Add threading indentation */
.messages-list {
  padding-left: 20px; /* Base padding for thread indicators */
}

.message-bubble.original {
  font-weight: 500;
}

.message-bubble.context {
  font-style: italic;
}

/* Consecutive message styling */
.message-bubble.consecutive {
  margin-bottom: 1px;
}

.message-bubble.first-in-group {
  margin-top: 8px;
}

.message-bubble.last-in-group {
  margin-bottom: 8px;
}

/* Search highlighting */
.search-highlight {
  background: #ffd60a;
  color: black;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 600;
}

.search-highlight.current {
  background: #ff9500;
  color: white;
}

/* Empty state */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-light);
  text-align: center;
}

.chat-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #c7c7cc;
}

/* Search Tab Styles */
.search-tweets-section {
  padding: 1rem 0;
}

.search-controls {
  background: rgba(112, 224, 0, 0.1);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 2px solid var(--spring-growth);
}

.search-input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.tweet-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--spring-growth);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--background-light);
  transition: all 0.3s ease;
}

.tweet-search-input:focus {
  outline: none;
  border-color: var(--growing-field);
  box-shadow: 0 0 0 2px rgba(112, 224, 0, 0.2);
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.sort-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sort-btn {
  background: var(--background-light);
  border: 2px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.sort-btn:hover {
  border-color: var(--spring-growth);
  color: var(--text-dark);
}

.sort-btn.active-desc {
  background: var(--growing-field);
  border-color: var(--growing-field);
  color: white;
}

.sort-btn.active-desc::after {
  content: "↓";
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

.sort-btn.active-asc {
  background: var(--fertile-ground);
  border-color: var(--fertile-ground);
  color: white;
}

.sort-btn.active-asc::after {
  content: "↑";
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

.info-btn {
  background: var(--background-light);
  border: 2px solid var(--border-light);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.info-btn:hover {
  border-color: var(--spring-growth);
  color: var(--growing-field);
  background: rgba(112, 224, 0, 0.1);
}

.search-results {
  min-height: 400px;
}

.search-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-light);
  text-align: center;
}

.search-loading-placeholder p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--rich-earth);
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-light);
  text-align: center;
}

.search-empty p {
  margin: 0;
  font-size: 1.1rem;
}

/* Search Help Popup */
.search-help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.search-help-popup {
  background: var(--background-light);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  margin: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  cursor: default;
  animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.search-help-popup h3 {
  color: var(--rich-earth);
  margin: 0 0 1.5rem 0;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-help-content {
  margin-bottom: 1.5rem;
}

.search-example {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(112, 224, 0, 0.08);
  border-radius: 8px;
  border-left: 4px solid var(--spring-growth);
  font-size: 0.95rem;
}

.search-example strong {
  color: var(--rich-earth);
  font-family: "Courier New", monospace;
  background: rgba(112, 224, 0, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 0.5rem;
}

.search-help-note {
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  margin: 0;
  font-style: italic;
}

/* Emoji Chart Styles */
.emoji-section {
  margin-top: 1rem;
}

.emoji-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.emoji-btn {
  background: linear-gradient(
    135deg,
    var(--deep-soil) 0%,
    var(--rich-earth) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.emoji-btn:hover:not(:disabled) {
  box-shadow: 0 4px 15px var(--shadow);
}

.emoji-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.emoji-chart-container {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.emoji-placeholder {
  text-align: center;
  color: var(--text-light);
}

.emoji-placeholder p {
  font-size: 1.2rem;
  margin: 0;
  color: var(--rich-earth);
}

.emoji-progress {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.emoji-progress .progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 400px;
  margin: 1rem auto;
  padding: 1.5rem;
  background: rgba(158, 240, 26, 0.1);
  border-radius: 15px;
  border: 2px solid var(--spring-growth);
  box-shadow: 0 4px 12px rgba(158, 240, 26, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

.emoji-progress .progress-info::before {
  content: "🔄";
  font-size: 1.5rem;
  margin-right: 1rem;
  animation: spin 2s linear infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
}

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

.emoji-chart {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.chart-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--spring-growth);
}

.chart-header h3 {
  color: var(--rich-earth);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.chart-header p {
  color: var(--text-light);
  margin: 0;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.emoji-bar {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 8px;
  background: var(--background-light);
  border: 1px solid rgba(158, 240, 26, 0.2);
  transition: all 0.3s ease;
  animation: slideIn 0.6s ease forwards;
  opacity: 0;
  transform: translateX(-20px);
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.emoji-bar:hover {
  background: rgba(158, 240, 26, 0.1);
  transform: scale(1.02);
  box-shadow: 0 2px 10px rgba(112, 224, 0, 0.2);
}

.emoji-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 150px;
  flex-shrink: 0;
}

.emoji-rank {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.9rem;
  width: 30px;
  text-align: right;
}

.emoji-symbol {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    "Twemoji Mozilla", "Android Emoji", "EmojiSymbols", sans-serif;
  line-height: 1;
  display: inline-block;
}

.emoji-count {
  font-weight: 600;
  color: var(--rich-earth);
  font-size: 0.9rem;
  min-width: 70px;
}

.bar-container {
  flex: 1;
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  margin-left: 1rem;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--spring-growth),
    var(--growing-field)
  );
  border-radius: 10px;
  transition: width 1s ease;
  position: relative;
}

.bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

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

.emoji-empty,
.emoji-error {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}

.emoji-empty h3,
.emoji-error h3 {
  color: var(--rich-earth);
  margin-bottom: 1rem;
}

.emoji-empty p,
.emoji-error p {
  margin: 0;
  max-width: 400px;
  margin: 0 auto;
}

/* Responsive emoji design */
@media (max-width: 768px) {
  .emoji-controls {
    flex-direction: column;
    align-items: center;
  }

  .emoji-info {
    min-width: 120px;
    gap: 0.5rem;
  }

  .emoji-count {
    min-width: 60px;
    font-size: 0.8rem;
  }

  .emoji-symbol {
    font-size: 1.3rem;
    width: 25px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
      "Twemoji Mozilla", "Android Emoji", "EmojiSymbols", sans-serif;
    line-height: 1;
    display: inline-block;
  }

  .bar-container {
    margin-left: 0.5rem;
  }
}

@media (max-width: 480px) {
  .emoji-info {
    min-width: 100px;
  }

  .emoji-rank {
    width: 25px;
    font-size: 0.8rem;
  }

  .emoji-symbol {
    font-size: 1.2rem;
    width: 20px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
      "Twemoji Mozilla", "Android Emoji", "EmojiSymbols", sans-serif;
    line-height: 1;
    display: inline-block;
  }

  .emoji-count {
    min-width: 50px;
    font-size: 0.75rem;
  }
}

/* Responsive chat design */
@media (max-width: 768px) {
  .chat-container {
    height: 500px;
  }

  .chat-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .chat-controls {
    justify-content: space-between;
  }

  .chat-search-input {
    width: 150px;
  }

  .message-bubble {
    max-width: 85%;
    font-size: 15px;
  }

  .search-navigation {
    font-size: 11px;
  }
}

/* Tab responsive breakpoints */
@media (max-width: 900px) {
  .tab-btn {
    min-width: calc(50% - 0.5rem);
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .tab-btn {
    min-width: calc(33.333% - 0.5rem);
    font-size: 0.9rem;
    padding: 0.8rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .chat-setup {
    padding: 1rem;
  }

  .chat-container {
    height: 400px;
  }

  .chat-search-input {
    width: 120px;
  }

  .message-bubble {
    max-width: 90%;
    font-size: 14px;
    padding: 6px 10px;
  }

  .tab-btn {
    min-width: calc(50% - 0.5rem);
    font-size: 0.85rem;
    padding: 0.7rem 0.4rem;
  }
}
