/* CSS Variables */
:root {
  --primary-color: #0088cc;
  --primary-dark: #006699;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;

  --bg-color: #f5f7fb;
  --card-bg: #ffffff;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #a4a6b3;
  --sidebar-active: #ffffff;

  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-muted: #a0aec0;

  --border-color: #e2e8f0;
  --border-radius: 8px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);

  --sidebar-width: 260px;
  --header-height: 64px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* App Layout */
#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.logo {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-active);
  font-size: 1.25rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo i {
  font-size: 2rem;
  color: var(--primary-color);
}

.nav-menu {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-active);
}

.nav-item.active {
  background: rgba(0, 136, 204, 0.1);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  font-size: 0.875rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger-color);
}

.status-dot.connected {
  background: var(--success-color);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-primary);
  cursor: pointer;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Pages Container */
.pages-container {
  flex: 1;
  padding: 24px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #e3f2fd; color: #1976d2; }
.stat-icon.green { background: #e8f5e9; color: #388e3c; }
.stat-icon.orange { background: #fff3e0; color: #f57c00; }
.stat-icon.red { background: #ffebee; color: #d32f2f; }

.stat-info h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #5a6268;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-color);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
}

.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.form-control,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9375rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--card-bg);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

.col-6 { flex: 0 0 calc(50% - 8px); }
.col-4 { flex: 0 0 calc(33.333% - 11px); }

.form-section {
  background: var(--bg-color);
  padding: 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
}

.form-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.filter-group {
  display: flex;
  gap: 12px;
}

.filter-group select {
  width: auto;
  min-width: 150px;
}

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 48px);
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header i {
  font-size: 4rem;
  color: var(--primary-color);
  margin-bottom: 16px;
}

.login-header h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
}

.login-form {
  margin-bottom: 20px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider span {
  padding: 0 16px;
  font-size: 0.875rem;
}

/* Posts List/Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}

.post-card:hover {
  box-shadow: var(--shadow);
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.post-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.post-card-channel {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-card-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-draft { background: #f0f0f0; color: #666; }
.status-scheduled { background: #fff3cd; color: #856404; }
.status-active { background: #d4edda; color: #155724; }
.status-sent { background: #cce5ff; color: #004085; }

.post-card-content {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-media {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.post-card-media img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.post-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.post-card-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-card-actions {
  display: flex;
  gap: 8px;
}

.post-card-actions button {
  padding: 6px 10px;
  font-size: 0.8125rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-color);
  border-radius: var(--border-radius);
}

.post-list-item-info {
  flex: 1;
}

.post-list-item-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.post-list-item-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Media Upload */
.media-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.media-upload-area:hover,
.media-upload-area.dragover {
  border-color: var(--primary-color);
  background: rgba(0, 136, 204, 0.05);
}

.upload-placeholder i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-placeholder p {
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-placeholder small {
  color: var(--text-muted);
}

.media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.media-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
}

.media-preview-item img,
.media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.media-preview-item .remove-media {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Channels Grid */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-color);
  border-radius: var(--border-radius);
  transition: box-shadow 0.2s ease;
}

.channel-card:hover {
  box-shadow: var(--shadow);
}

.channel-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.channel-info {
  flex: 1;
}

.channel-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.channel-username {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.channel-type {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--primary-color);
  color: white;
  border-radius: 10px;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-color);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--primary-color);
}

.task-item-info h4 {
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

.task-item-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Loop Groups */
.loop-groups-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loop-group-card {
  background: var(--bg-color);
  border-radius: var(--border-radius);
  padding: 16px;
  border-left: 4px solid var(--success-color);
}

.loop-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.loop-group-name {
  font-weight: 600;
  font-size: 1rem;
}

.loop-group-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.loop-group-actions {
  display: flex;
  gap: 8px;
}

/* Scheduler Grid */
.scheduler-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
}

.modal-lg {
  max-width: 700px;
}

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

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--danger-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }
.toast.info { border-left: 4px solid var(--info-color); }

.toast-icon {
  font-size: 1.25rem;
}

.toast.success .toast-icon { color: var(--success-color); }
.toast.error .toast-icon { color: var(--danger-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.info .toast-icon { color: var(--info-color); }

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-overlay p {
  color: var(--text-secondary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* Page Actions */
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Checkbox List */
.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px;
}

.checkbox-list-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.checkbox-list-item:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .form-row .col-6,
  .form-row .col-4 {
    flex: 1 1 100%;
  }
}

@media (max-width: 768px) {
  .pages-container {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .header {
    padding: 0 16px;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .login-card {
    padding: 24px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .scheduler-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }

  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    flex-direction: column;
  }

  .filter-group select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-actions .btn {
    width: 100%;
  }
}

/* Text Editor & Formatting Toolbar */
.editor-container {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--card-bg);
}

.format-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 4px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toolbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: var(--card-bg);
  color: var(--primary-color);
}

.toolbar-btn.active {
  background: var(--primary-color);
  color: white;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 8px;
}

.toolbar-select {
  padding: 4px 8px;
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.editor-container textarea {
  border: none;
  border-radius: 0;
  resize: vertical;
  min-height: 120px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.editor-container textarea:focus {
  box-shadow: none;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
}

.char-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Preview Modal */
.preview-container {
  background: var(--bg-color);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-top: 12px;
}

.preview-content {
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-content b, .preview-content strong {
  font-weight: 600;
}

.preview-content i, .preview-content em {
  font-style: italic;
}

.preview-content u {
  text-decoration: underline;
}

.preview-content s, .preview-content strike, .preview-content del {
  text-decoration: line-through;
}

.preview-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875em;
}

.preview-content pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: 8px 0;
}

.preview-content pre code {
  background: none;
  padding: 0;
}

.preview-content .spoiler {
  background: var(--text-primary);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 0 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-content .spoiler:hover,
.preview-content .spoiler.revealed {
  background: rgba(0, 0, 0, 0.1);
  color: inherit;
}

.preview-content a {
  color: var(--primary-color);
  text-decoration: none;
}

.preview-content a:hover {
  text-decoration: underline;
}

/* Format Help Tooltip */
.format-help {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--card-bg);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
}

.toolbar-btn:hover .format-help {
  opacity: 1;
  visibility: visible;
}

/* Responsive Toolbar */
@media (max-width: 768px) {
  .format-toolbar {
    padding: 6px 8px;
  }

  .toolbar-btn {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }

  .toolbar-divider {
    margin: 0 4px;
  }

  .toolbar-select {
    font-size: 0.75rem;
    padding: 2px 6px;
  }
}
