:root {
  --primary-color: #2563eb;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.message-select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: white;
  font-size: 0.875rem;
  color: var(--text-primary);
  min-width: 150px;
  cursor: pointer;
  transition: all 0.2s;
}

.message-select:hover {
  border-color: var(--primary-color);
}

.message-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.granularity-buttons {
  display: flex;
  gap: 0.25rem;
  background-color: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.375rem;
}

.granularity-btn {
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.granularity-btn:hover {
  color: #1a202c;
  background-color: rgba(255, 255, 255, 0.5);
}

.granularity-btn.active {
  color: #1a202c;
  background-color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-card {
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.message-card:hover {
  transform: translateY(-2px);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.message-type {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  text-transform: uppercase;
}

.message-type.trade {
  background-color: #dbeafe;
  color: #1e40af;
}

.message-type.portfolio {
  background-color: #dcfce7;
  color: #166534;
}

.message-timestamp {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.message-content {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none;
}

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

@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}

.new-messages-button {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 10;
  width: fit-content;
}

.new-messages-button:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.new-messages-button.hidden {
  display: none;
}

.message-nav {
  display: flex;
  gap: 0.5rem;
  margin-right: 1rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #64748b;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover {
  color: #1a202c;
  background-color: #f1f5f9;
}

.nav-link.active {
  color: #1a202c;
  background-color: #e2e8f0;
}

.message.in-progress {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  border-left: 5px solid #ff6b6b;
  position: relative;
  overflow: hidden;
}

.message.in-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%
  }

  100% {
    left: 100%
  }
}

.message.in-progress .status-badge {
  background: #ff6b6b;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  margin-left: 8px;
}

#in-progress-container {
  top: 1rem;
  margin-bottom: 1rem;
}

#in-progress-container .message {
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 0;
}

#in-progress-container .message.in-progress {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  border-left: 5px solid #ff6b6b;
  position: relative;
  overflow: hidden;
}
