/* ============================
   ThreadsBot — Premium Dark Theme
   ============================ */

:root {
  /* Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: #16162a;
  --bg-card-hover: #1e1e38;
  --bg-input: #1a1a2e;
  --bg-modal: rgba(0, 0, 0, 0.85);

  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #6868880;
  --text-link: #7c6aff;

  --accent-primary: #7c6aff;
  --accent-primary-glow: rgba(124, 106, 255, 0.3);
  --accent-success: #2dd4a0;
  --accent-success-glow: rgba(45, 212, 160, 0.25);
  --accent-warning: #f5a623;
  --accent-warning-glow: rgba(245, 166, 35, 0.25);
  --accent-danger: #ff4d6a;
  --accent-danger-glow: rgba(255, 77, 106, 0.25);
  --accent-info: #38bdf8;
  --accent-info-glow: rgba(56, 189, 248, 0.25);
  --accent-affiliate: #ff6b9d;

  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(124, 106, 255, 0.15);

  --sidebar-width: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-primary-glow);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

a { color: var(--text-link); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-primary); }

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 3px; }

/* ============================
   Sidebar
   ============================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px var(--accent-primary-glow));
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-affiliate));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent-primary);
  border-radius: 0 4px 4px 0;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(124, 106, 255, 0.05);
}

.nav-link.active {
  color: var(--accent-primary);
  background: rgba(124, 106, 255, 0.08);
}

.nav-link.active::before {
  height: 24px;
}

.nav-icon { font-size: 18px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.app-version {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ============================
   Main Content
   ============================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0 32px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.menu-toggle {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================
   Alerts
   ============================ */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

.alert-error {
  background: rgba(255, 77, 106, 0.1);
  border: 1px solid rgba(255, 77, 106, 0.3);
  color: var(--accent-danger);
}

.alert-success {
  background: rgba(45, 212, 160, 0.1);
  border: 1px solid rgba(45, 212, 160, 0.3);
  color: var(--accent-success);
}

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

/* ============================
   Cards
   ============================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::after { opacity: 1; }
.stat-success::after { background: var(--accent-success); }
.stat-warning::after { background: var(--accent-warning); }
.stat-danger::after { background: var(--accent-danger); }
.stat-info::after { background: var(--accent-info); }
.stat-affiliate::after { background: var(--accent-affiliate); }

.stat-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ============================
   Dashboard Grid
   ============================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ============================
   Activity List
   ============================ */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.activity-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-done, .badge-success { background: rgba(45, 212, 160, 0.15); color: var(--accent-success); }
.badge-draft { background: rgba(152, 152, 176, 0.15); color: var(--text-secondary); }
.badge-scheduled { background: rgba(56, 189, 248, 0.15); color: var(--accent-info); }
.badge-posting { background: rgba(245, 166, 35, 0.15); color: var(--accent-warning); }
.badge-failed { background: rgba(255, 77, 106, 0.15); color: var(--accent-danger); }
.badge-cancelled { background: rgba(152, 152, 176, 0.1); color: var(--text-muted); }
.badge-warning { background: rgba(245, 166, 35, 0.15); color: var(--accent-warning); }
.badge-muted { background: rgba(152, 152, 176, 0.1); color: var(--text-muted); }
.badge-affiliate { background: rgba(255, 107, 157, 0.15); color: var(--accent-affiliate); }

.badge-type-regular { background: rgba(124, 106, 255, 0.15); color: var(--accent-primary); }
.badge-type-affiliate { background: rgba(255, 107, 157, 0.15); color: var(--accent-affiliate); }

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.activity-content { flex: 1; min-width: 0; }

.activity-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

/* ============================
   Quick Actions
   ============================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: var(--transition);
}

.action-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent-primary);
  box-shadow: 0 10px 25px -5px rgba(124, 106, 255, 0.4), 0 8px 10px -6px rgba(124, 106, 255, 0.4);
}

.action-icon { 
  font-size: 32px;
  margin-bottom: 4px;
}

.action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Helper Classes */
.btn-right-container {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: 16px;
}

.form-inline-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.form-inline-row .form-group {
  margin-bottom: 0;
}

/* ============================
   Forms
   ============================ */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  border: none;
  padding: 0;
}

.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

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

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-action input { flex: 1; }

/* ============================
   Buttons
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #6b5ce7);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-success), #1ab885);
  color: white;
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--accent-success-glow);
}

.btn-warning {
  background: linear-gradient(135deg, var(--accent-warning), #e09520);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-danger), #e0435a);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, var(--accent-info), #2aa5d9);
  color: white;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
}
.btn-ghost:hover { color: var(--accent-primary); }

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

.btn-glow {
  position: relative;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: inherit;
  filter: blur(12px);
  opacity: 0;
  z-index: -1;
  transition: var(--transition);
}

.btn-glow:hover::after {
  opacity: 0.4;
}

.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================
   Tables
   ============================ */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(124, 106, 255, 0.03);
}

.action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.topic-cell {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-cell {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ============================
   Thread Preview
   ============================ */
.thread-preview {
  max-width: 550px;
}

.thread-main,
.thread-reply {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  position: relative;
}

.thread-reply {
  padding-left: 28px;
}

.thread-line {
  position: absolute;
  left: 14px;
  top: -4px;
  bottom: 16px;
  width: 2px;
  background: var(--border-color);
}

.thread-avatar {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.thread-content { flex: 1; min-width: 0; }

.thread-author {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.reply-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent-primary);
  background: rgba(124, 106, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.thread-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-word;
}

.thread-edit {
  width: 100%;
  min-height: 80px;
  background: var(--bg-input);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
}

/* ============================
   Two Column Layout
   ============================ */
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ============================
   Products
   ============================ */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
  gap: 12px;
}

.product-item:hover {
  background: rgba(124, 106, 255, 0.04);
  border-color: var(--border-glow);
}

.product-info { flex: 1; min-width: 0; }

.product-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.product-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.product-link {
  font-size: 12px;
}

.product-link a {
  color: var(--accent-info);
}

.product-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================
   Schedule
   ============================ */
.schedule-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.schedule-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.schedule-input:focus {
  border-color: var(--accent-primary);
}

/* ============================
   Toggle Switch
   ============================ */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::after {
  left: 23px;
  background: white;
}

.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================
   Auto Reply Form
   ============================ */
.auto-reply-form {
  padding: 16px 0;
}

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

.auto-reply-header h4 {
  font-size: 15px;
  color: var(--text-primary);
}

/* ============================
   Info Steps
   ============================ */
.info-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.info-step code {
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent-info);
}

/* ============================
   Modal
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease;
}

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

.modal-body {
  padding: 24px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.detail-content {
  font-size: 14px;
  line-height: 1.7;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.detail-comment {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
}

.comment-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}

.detail-error {
  color: var(--accent-danger);
}

.detail-error pre {
  background: rgba(255, 77, 106, 0.08);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  overflow-x: auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.empty-state a {
  color: var(--accent-primary);
  font-weight: 600;
}

/* ============================
   Auto Pilot Cards
   ============================ */
.autopilot-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.autopilot-card {
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.autopilot-active {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.05), rgba(124, 106, 255, 0.05));
  border-color: rgba(45, 212, 160, 0.2);
}

.autopilot-inactive {
  background: rgba(255, 255, 255, 0.01);
  opacity: 0.7;
}

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

.autopilot-account {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.autopilot-username {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.theme-badge {
  background: rgba(124, 106, 255, 0.12);
  color: var(--accent-primary);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.autopilot-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ap-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ap-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.ap-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.autopilot-last-post {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.autopilot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

  .main-content {
    margin-left: 0;
    padding: 0 16px 16px;
  }

  .menu-toggle {
    display: block;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-footer {
    flex-direction: column;
  }

  .schedule-group {
    margin-left: 0;
    width: 100%;
  }

  .schedule-input { flex: 1; }
}

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

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 22px;
  }
}

/* Content Queue */
.queue-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.queue-account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 24px;
  transition: border-color 0.2s;
}

.queue-account-card:hover {
  border-color: var(--accent-primary);
}

.queue-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.queue-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.queue-stats-bar {
  display: flex;
  gap: 8px;
}

.queue-stat-pill {
  background: rgba(124, 106, 255, 0.12);
  color: var(--accent-primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.queue-stat-pill.used {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.queue-stat-num {
  font-weight: 800;
  margin-right: 4px;
}

.queue-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 16px 0;
}

.queue-settings-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.queue-settings-row .form-group {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.queue-generate-btn {
  height: 42px;
  white-space: nowrap;
  padding: 0 24px;
}

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

.queue-config-box {
  flex: 1;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.config-label {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: block;
}


.queue-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px 20px;
  transition: border-color 0.2s;
}

.queue-item:hover {
  border-color: var(--accent-primary);
}

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

.queue-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.queue-num {
  background: var(--accent-primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.queue-item-actions {
  display: flex;
  gap: 6px;
}

.queue-item-topic {
  font-size: 15px;
  margin-bottom: 6px;
}

.queue-item-preview {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.queue-item-footer {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-primary);
}

