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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0f0f0f;
  color: #e7e9ea;
  min-height: 100vh;
}

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

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #2f3336;
  margin-bottom: 20px;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #71767b;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f7931a;
}

.status.connected .status-dot {
  background: #00ba7c;
}

.status.error .status-dot {
  background: #f4212e;
}

/* Main layout */
main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 20px;
  height: fit-content;
}

.settings-section {
  background: #16181c;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.settings-section h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #e7e9ea;
}

/* Keywords */
#keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.keyword-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1d9bf0;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
}

.keyword-tag button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.7;
}

.keyword-tag button:hover {
  opacity: 1;
}

.add-keyword {
  display: flex;
  gap: 8px;
}

.add-keyword input {
  flex: 1;
  background: #202327;
  border: 1px solid #2f3336;
  border-radius: 8px;
  padding: 8px 12px;
  color: #e7e9ea;
  font-size: 14px;
}

.add-keyword input:focus {
  outline: none;
  border-color: #1d9bf0;
}

.add-keyword button {
  background: #1d9bf0;
  border: none;
  border-radius: 8px;
  color: white;
  width: 36px;
  cursor: pointer;
  font-size: 18px;
}

.add-keyword button:hover {
  background: #1a8cd8;
}

/* Select */
select {
  width: 100%;
  background: #202327;
  border: 1px solid #2f3336;
  border-radius: 8px;
  padding: 10px 12px;
  color: #e7e9ea;
  font-size: 14px;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #1d9bf0;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 12px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.option-row input {
  width: 70px;
  background: #202327;
  border: 1px solid #2f3336;
  border-radius: 8px;
  padding: 8px;
  color: #e7e9ea;
  text-align: center;
}

/* Custom prompt */
#custom-prompt {
  width: 100%;
  background: #202327;
  border: 1px solid #2f3336;
  border-radius: 8px;
  padding: 12px;
  color: #e7e9ea;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  margin-bottom: 10px;
}

#custom-prompt:focus {
  outline: none;
  border-color: #1d9bf0;
}

.save-prompt-btn {
  width: 100%;
  background: #202327;
  border: 1px solid #2f3336;
  border-radius: 8px;
  color: #e7e9ea;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.save-prompt-btn:hover {
  background: #2f3336;
  border-color: #1d9bf0;
}

/* Refresh button */
.refresh-btn {
  width: 100%;
  background: #1d9bf0;
  border: none;
  border-radius: 20px;
  color: white;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.refresh-btn:hover {
  background: #1a8cd8;
}

.refresh-btn:disabled {
  background: #2f3336;
  cursor: not-allowed;
}

/* Tweet list */
.tweet-list {
  min-height: 400px;
}

.tweet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tweet-header h2 {
  font-size: 20px;
  font-weight: 700;
}

#tweet-count {
  color: #71767b;
  font-size: 14px;
}

/* Tweet card */
.tweet-card {
  background: #16181c;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.tweet-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.tweet-author {
  display: flex;
  flex-direction: column;
}

.tweet-author .name {
  font-weight: 700;
  font-size: 15px;
}

.tweet-author .handle {
  color: #71767b;
  font-size: 14px;
}

.tweet-keyword {
  background: #202327;
  color: #71767b;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.tweet-text {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
  word-wrap: break-word;
}

.tweet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.tweet-time {
  color: #71767b;
  font-size: 13px;
}

.tweet-metrics {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #71767b;
}

.tweet-metrics span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tweet-metrics .virality {
  color: #00ba7c;
  font-weight: 600;
  background: rgba(0, 186, 124, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Draft section */
.draft-section {
  background: #202327;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.draft-section h4 {
  font-size: 13px;
  color: #71767b;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.draft-textarea {
  width: 100%;
  background: #16181c;
  border: 1px solid #2f3336;
  border-radius: 8px;
  padding: 12px;
  color: #e7e9ea;
  font-size: 15px;
  line-height: 1.4;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.draft-textarea:focus {
  outline: none;
  border-color: #1d9bf0;
}

.draft-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.char-count {
  font-size: 13px;
  color: #71767b;
}

.char-count.over {
  color: #f4212e;
}

.draft-buttons {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 16px;
  background: #202327;
  color: #e7e9ea;
  border: 1px solid #2f3336;
  cursor: pointer;
}

.btn-small:hover {
  background: #2f3336;
}

.btn-context {
  color: #1d9bf0;
  border-color: #1d9bf0;
}

.btn-context:hover {
  background: rgba(29, 155, 240, 0.1);
}

/* Tweet actions */
.tweet-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #1d9bf0;
  color: white;
}

.btn-primary:hover {
  background: #1a8cd8;
}

.btn-primary:disabled {
  background: #2f3336;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: #1d9bf0;
  border: 1px solid #2f3336;
}

.btn-secondary:hover {
  background: rgba(29, 155, 240, 0.1);
  border-color: #1d9bf0;
}

.btn-skip {
  background: transparent;
  color: #71767b;
  border: 1px solid #2f3336;
}

.btn-skip:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Loading & empty states */
.loading, .empty {
  text-align: center;
  padding: 60px 20px;
  color: #71767b;
}

.loading {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #1d9bf0;
  color: white;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 15px;
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

.toast.error {
  background: #f4212e;
}

.toast.success {
  background: #00ba7c;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .settings-section {
    margin-bottom: 0;
  }

  .refresh-btn {
    grid-column: 1 / -1;
  }
}

/* Trending Section */
.trend-refresh-btn {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: #1d9bf0;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.trend-refresh-btn:hover {
  background: #1a8cd8;
}

.trends-list {
  max-height: 300px;
  overflow-y: auto;
}

.trends-list .muted {
  color: #71767b;
  font-size: 13px;
}

.trends-list .muted.error {
  color: #f4212e;
}

.trend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.trend-item:hover {
  background: #1a1a1a;
}

.trend-rank {
  color: #71767b;
  font-size: 12px;
  min-width: 18px;
}

.trend-topic {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #e7e9ea;
}

.trend-count {
  color: #71767b;
  font-size: 12px;
}
