/* LinkedIn Post Previewer - Stylesheet
   Pure Vanilla CSS - Zero Dependencies - Dark & Light Mode
   Natural Flow, Zero Artificial Whitespace
*/

:root {
  --bg-primary: #f3f2ef;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-link: #0a66c2;
  --text-link-hover: #004182;

  --accent-blue: #0a66c2;
  --accent-blue-bg: #e8f3ff;
  --accent-green: #057642;

  --feed-width-desktop: 552px;
  --feed-width-mobile: 375px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --transition: all 0.15s ease-in-out;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #172033;
  --bg-surface-subtle: #111827;
  --bg-surface-hover: #1f293d;
  --border-color: #27354f;
  --border-subtle: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-link: #70b5f9;
  --text-link-hover: #9cd0ff;

  --accent-blue: #38bdf8;
  --accent-blue-bg: rgba(56, 189, 248, 0.12);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.linkedin-badge-logo {
  background-color: #0a66c2;
  color: white;
  font-weight: 800;
  font-size: 15px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-title-group h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-toggle {
  display: flex;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
}

.device-btn {
  background: transparent;
  border: none;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.device-btn.active {
  background-color: var(--bg-surface);
  color: var(--accent-blue);
  box-shadow: var(--shadow-sm);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* App Main Layout */
.app-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
  gap: 24px;
  flex: 1;
}

@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Sidebar & Queue */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-count-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.post-tab {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-tab:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-color);
}

.post-tab.active {
  background-color: var(--accent-blue-bg);
  border-color: var(--accent-blue);
}

.tab-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tab-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  text-transform: uppercase;
}

.tab-schedule {
  font-size: 11px;
  color: var(--text-muted);
}

.tab-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tab-pillar {
  font-size: 10px;
  color: var(--text-muted);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: #004182;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
}

/* Editor Section */
.editor-container {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.editor-container.open {
  display: flex;
}

.editor-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.editor-textarea {
  width: 100%;
  min-height: 160px;
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

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

/* Main Preview Area */
.preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.preview-container {
  width: 100%;
  max-width: var(--feed-width-desktop);
  transition: max-width 0.2s ease-in-out;
}

.preview-container.mobile-mode {
  max-width: var(--feed-width-mobile);
}

/* LinkedIn Feed Card */
.linkedin-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  height: fit-content;
}

/* Post Header */
.feed-header {
  padding: 12px 16px 8px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.feed-author-block {
  display: flex;
  gap: 10px;
  text-decoration: none;
}

.avatar-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, #0a66c2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

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

.author-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.connection-degree {
  font-size: 12px;
  color: var(--text-muted);
}

.author-headline {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.33;
  margin-top: 2px;
}

.post-timestamp {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.header-options-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 16px;
}

/* Post Body */
.feed-body {
  padding: 4px 16px 12px 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}

.post-text-content {
  white-space: pre-line;
  word-break: break-word;
}

.post-text-content.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.see-more-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 0 0 0;
  display: inline-block;
}

.see-more-btn:hover {
  color: var(--text-link);
  text-decoration: underline;
}

.post-hashtags {
  margin-top: 10px;
  font-size: 14px;
}

.hashtag {
  color: var(--text-link);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.hashtag:hover {
  text-decoration: underline;
}

/* Visual Attachment */
.feed-visual-attachment {
  border-top: 1px solid var(--border-subtle);
  background-color: #0b1120;
  color: #f8fafc;
  padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  overflow-x: auto;
}

.visual-title-tag {
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.visual-pre-content {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  white-space: pre;
}

/* Action Row */
.feed-actions {
  border-top: 1px solid var(--border-subtle);
  padding: 2px 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.action-item {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.action-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* First Comment Card */
.first-comment-card {
  margin-top: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.comment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comment-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-sm {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}

.btn-icon-sm:hover {
  background-color: var(--bg-surface-hover);
}

.comment-bubble {
  background-color: var(--bg-surface-subtle);
  border-radius: 0 10px 10px 10px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, #0a66c2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.comment-content-wrap {
  flex: 1;
}

.comment-author-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.author-pill {
  font-size: 10px;
  font-weight: 600;
  background-color: var(--border-color);
  color: var(--text-secondary);
  padding: 1px 5px;
  border-radius: 3px;
}

.comment-body-text {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  margin-top: 3px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #0f172a;
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease-in-out;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
