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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #e0e0e0;
}

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

header {
  text-align: center;
  padding: 30px 0;
}

header h1 {
  font-size: 2.5rem;
  color: #e31337;
  margin-bottom: 10px;
}

header p {
  color: #888;
}

/* Tab Navigation */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 12px 20px;
  background: #252536;
  color: #888;
  border: 2px solid #3a3a4f;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: #3a3a4f;
  color: #fff;
  transform: none;
}

.tab-btn.active {
  background: #e31337;
  border-color: #e31337;
  color: white;
}

.search-panel {
  background: #252536;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.panel-description {
  grid-column: 1 / -1;
  padding: 15px;
  background: #1a1a2e;
  border-radius: 8px;
  border-left: 4px solid #e31337;
}

.panel-description p {
  margin: 0;
  color: #ccc;
}

.panel-description .hint {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #888;
  font-style: italic;
}

.input-group.full-width {
  grid-column: 1 / -1;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 5px;
}

.input-group input {
  padding: 12px;
  border: 1px solid #3a3a4f;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: #e31337;
}

button {
  grid-column: 1 / -1;
  padding: 15px 30px;
  background: #e31337;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #ff1744;
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #3a3a4f;
  border-top: 4px solid #e31337;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.results {
  background: #252536;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.results-header {
  background: #1a1a2e;
  padding: 20px;
  border-bottom: 1px solid #3a3a4f;
}

.results-header h2 {
  font-size: 1.2rem;
  margin-bottom: 5px;
}

.results-header #userNames {
  color: #e31337;
}

.results-header p {
  color: #888;
  font-size: 0.9rem;
}

.chat-container {
  max-height: 600px;
  overflow-y: auto;
  padding: 20px;
}

.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

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

.message.user1 {
  align-items: flex-start;
}

.message.user2 {
  align-items: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
}

.message.user1 .message-bubble {
  background: #3a3a4f;
  border-bottom-left-radius: 4px;
}

.message.user2 .message-bubble {
  background: #e31337;
  border-bottom-right-radius: 4px;
}

.message-author {
  font-weight: bold;
  font-size: 0.85rem;
  margin-bottom: 5px;
  color: #aaa;
}

.message.user2 .message-author {
  color: rgba(255, 255, 255, 0.8);
}

.message-body {
  line-height: 1.5;
  word-wrap: break-word;
}

.message-body img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 10px;
}

.message-meta {
  display: flex;
  gap: 15px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #666;
}

.message.user2 .message-meta {
  justify-content: flex-end;
}

.message-meta a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

.message-meta a:hover {
  color: #e31337;
}

/* Who Told Me Results */
.who-told-me-result {
  align-items: flex-start !important;
}

.who-told-me-result .message-bubble {
  background: #2d4a3e;
  border-left: 4px solid #4CAF50;
  max-width: 95%;
}

.who-told-me-result .message-author {
  color: #4CAF50;
}

.who-told-me-result .message-author strong {
  color: #81C784;
}

/* Keyword highlight */
mark.highlight {
  background: #FFD54F;
  color: #1a1a2e;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

.error {
  background: #ff1744;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  text-align: center;
}

.hidden {
  display: none;
}

/* Pagination Controls */
.pagination-controls {
  padding: 20px;
  text-align: center;
  border-top: 1px solid #3a3a4f;
}

.pagination-controls button {
  padding: 12px 24px;
  background: #3a3a4f;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s, transform 0.1s;
}

.pagination-controls button:hover {
  background: #4a4a5f;
  transform: translateY(-2px);
}

.loading-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #888;
}

.spinner-small {
  width: 24px;
  height: 24px;
  border: 3px solid #3a3a4f;
  border-top: 3px solid #e31337;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
  width: 8px;
}

.chat-container::-webkit-scrollbar-track {
  background: #1a1a2e;
}

.chat-container::-webkit-scrollbar-thumb {
  background: #3a3a4f;
  border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: #4a4a5f;
}

/* Responsive design */
@media (max-width: 600px) {
  .search-panel {
    grid-template-columns: 1fr;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab-btn {
    width: 100%;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid #3a3a4f;
}

.site-footer p {
  color: #888;
  font-size: 0.9rem;
  margin: 8px 0;
}

.site-footer a {
  color: #e31337;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #ff4d6a;
  text-decoration: underline;
}
