/* === Variables === */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #4f8cff;
  --approve: #2ea043;
  --reject: #da3633;
  --edit: #d29922;
  --hold: #768390;
  --radius: 8px;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* === Landing Page === */
.landing {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.landing .container {
  text-align: center;
  padding: 40px 20px;
}

.landing-header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.landing-header .tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 48px;
}

.landing-description {
  font-size: 1.05rem;
  color: var(--text);
  max-width: 540px;
  margin: 0 auto 20px;
  line-height: 1.7;
}

.landing-footer {
  margin-top: 48px;
}

.contact-link {
  font-size: 1rem;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s;
  display: inline-block;
}

.contact-link:hover {
  background: var(--surface);
  border-color: var(--accent);
  text-decoration: none;
}

/* === Review Page === */
.review-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.review-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.review-header .client-name {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.review-header .batch-notes {
  color: var(--text);
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.review-header .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.platform-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* === Overall Feedback === */
.overall-feedback {
  margin-top: 16px;
}

.overall-feedback label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.overall-feedback textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.overall-feedback textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.overall-feedback .save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.btn-save {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-save:hover {
  opacity: 0.85;
}

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

.save-status {
  font-size: 0.8rem;
  color: var(--approve);
}

/* === Return Banner === */
.return-banner {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Progress Bar === */
.progress-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.progress-bar .progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-bar .progress-text {
  white-space: nowrap;
  color: var(--text-muted);
}

/* === Platform Tabs === */
.platform-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.platform-tabs::-webkit-scrollbar {
  display: none;
}

.platform-tab {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.platform-tab:hover {
  background: var(--surface-hover);
}

.platform-tab.active {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--text);
}

.platform-tab .tab-count {
  margin-left: 6px;
  opacity: 0.6;
}

.tab-panel {
  display: none;
}

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

/* === Post Card === */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

.post-card.status-approve {
  border-color: var(--approve);
}

.post-card.status-reject {
  border-color: var(--reject);
}

.post-card.status-edit {
  border-color: var(--edit);
}

.post-card.status-hold {
  border-color: var(--hold);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-number {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.platform-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.platform-badge.x { background: rgba(29, 155, 240, 0.15); color: #1d9bf0; }
.platform-badge.linkedin { background: rgba(10, 102, 194, 0.15); color: #0a66c2; }
.platform-badge.instagram { background: rgba(225, 48, 108, 0.15); color: #e1306c; }
.platform-badge.bluesky { background: rgba(0, 133, 255, 0.15); color: #0085ff; }
.platform-badge.facebook { background: rgba(24, 119, 242, 0.15); color: #1877f2; }
.platform-badge.tiktok { background: rgba(255, 0, 80, 0.15); color: #ff0050; }
.platform-badge.telegram { background: rgba(38, 165, 227, 0.15); color: #26a5e4; }
.platform-badge.discord { background: rgba(88, 101, 242, 0.15); color: #5865f2; }
.platform-badge.default { background: rgba(118, 131, 144, 0.15); color: #768390; }

.post-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.post-status-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: capitalize;
}

.post-status-badge.approve { background: rgba(46, 160, 67, 0.15); color: var(--approve); }
.post-status-badge.reject { background: rgba(218, 54, 51, 0.15); color: var(--reject); }
.post-status-badge.edit { background: rgba(210, 153, 34, 0.15); color: var(--edit); }
.post-status-badge.hold { background: rgba(118, 131, 144, 0.15); color: var(--hold); }

/* === Version Badge (v2 revisions) === */
.version-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(79, 140, 255, 0.15);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === Original Content (collapsible) === */
.original-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.original-content summary {
  padding: 10px 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.original-content summary:hover {
  color: var(--text);
}

.original-content .original-text {
  padding: 0 14px 14px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* === Thread Group === */
.thread-group {
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 16px;
  padding-left: 0;
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) 0 0;
  margin-bottom: 0;
}

.thread-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.thread-group .post-card {
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0;
  border-top: none;
}

.thread-group .post-card:last-child {
  border-radius: 0 0 var(--radius) 0;
}

.thread-group .post-card + .post-card {
  border-top: 1px dashed var(--border);
}

/* === Tweet Preview (X posts) === */
.tweet-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.tweet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.tweet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.tweet-handle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tweet-handle strong {
  color: var(--text);
  display: block;
}

.tweet-content {
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}

.char-count.over-limit {
  color: var(--reject);
  font-weight: 600;
}

/* === Generic Post Content === */
.post-content {
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
}

/* === Media Preview === */
.media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.media-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
}

.media-preview .video-indicator {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Action Bar === */
.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.action-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  color: var(--text);
}

.action-btn.selected-approve {
  background: rgba(46, 160, 67, 0.15);
  border-color: var(--approve);
  color: var(--approve);
}

.action-btn.selected-reject {
  background: rgba(218, 54, 51, 0.15);
  border-color: var(--reject);
  color: var(--reject);
}

.action-btn.selected-edit {
  background: rgba(210, 153, 34, 0.15);
  border-color: var(--edit);
  color: var(--edit);
}

.action-btn.selected-hold {
  background: rgba(118, 131, 144, 0.15);
  border-color: var(--hold);
  color: var(--hold);
}

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

/* === Detail Panels === */
.detail-panel {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.detail-panel.visible {
  display: block;
}

.detail-panel label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-panel select,
.detail-panel textarea,
.detail-panel input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.detail-panel select:focus,
.detail-panel textarea:focus,
.detail-panel input:focus {
  outline: none;
  border-color: var(--accent);
}

.detail-panel textarea {
  min-height: 80px;
  resize: vertical;
}

.detail-panel .panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === Feedback Field (per-post) === */
.feedback-field {
  display: none;
  margin-bottom: 12px;
}

.feedback-field.visible {
  display: block;
}

.feedback-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.feedback-field textarea {
  width: 100%;
  min-height: 60px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.feedback-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* === Expired Page === */
.center-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.center-page h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.center-page p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

/* === Activity Log === */
.activity-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.activity-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s;
}

.activity-log-header:hover {
  background: var(--surface-hover);
}

.activity-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.activity-log-entries {
  max-height: 200px;
  overflow-y: auto;
  display: none;
  border-top: 1px solid var(--border);
}

.activity-log-entries.open {
  display: block;
}

.activity-entry {
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: baseline;
  animation: fadeIn 0.3s ease;
}

.activity-entry:last-child {
  border-bottom: none;
}

.activity-time {
  color: var(--text-muted);
  opacity: 0.6;
  white-space: nowrap;
  font-size: 0.75rem;
}

.activity-msg {
  flex: 1;
}

.activity-entry.action-approve .activity-msg { color: var(--approve); }
.activity-entry.action-reject .activity-msg { color: var(--reject); }
.activity-entry.action-edit .activity-msg { color: var(--edit); }
.activity-entry.action-hold .activity-msg { color: var(--hold); }
.activity-entry.action-overall .activity-msg { color: var(--accent); }
.activity-entry.action-submit .activity-msg { color: var(--approve); }

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

/* === Per-post Save === */
.post-save-row {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.post-save-row.visible {
  display: flex;
}

.post-save-status {
  font-size: 0.8rem;
}

/* === Submit Section === */
.submit-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.submit-prompt {
  text-align: center;
}

.submit-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.btn-submit {
  background: var(--approve);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-submit:hover:not(:disabled) {
  opacity: 0.85;
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.submitted-banner {
  background: rgba(46, 160, 67, 0.1);
  border: 1px solid var(--approve);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  color: var(--approve);
  font-weight: 500;
}

/* === Inline Error === */
.inline-error {
  color: var(--reject);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* === Mobile === */
@media (max-width: 480px) {
  .landing-header h1 {
    font-size: 1.8rem;
  }

  .landing-header .tagline {
    font-size: 0.95rem;
    margin-bottom: 32px;
  }

  .landing-description {
    font-size: 0.95rem;
  }

  .review-header h1 {
    font-size: 1.2rem;
  }

  .action-bar {
    grid-template-columns: 1fr 1fr;
  }

  .post-header {
    font-size: 0.85rem;
  }

  .post-date {
    margin-left: 0;
    width: 100%;
  }

  .container {
    padding: 0 12px;
  }

  .post-card {
    padding: 16px;
  }

  .review-header {
    padding: 16px;
  }

  .progress-bar {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}
