/* ==========================================================================
   Sosyalog CP - Enterprise Design System
   Themes: Dark (Default), Light, Midnight (OLED)
   Inspiration: Linear / Vercel / GitHub / Stripe
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-app: #0c0d0e;
  --bg-sidebar: #111214;
  --bg-surface: #141518;
  --bg-surface-elevated: #1a1b1f;
  --bg-surface-hover: #202227;
  --bg-input: #141518;
  --bg-input-focus: #18191d;

  --border-subtle: #22242a;
  --border-muted: #2d3038;
  --border-focus: #3b82f6;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #09090b;

  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-subtle: rgba(37, 99, 235, 0.12);

  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-text: #34d399;
  --status-success-border: rgba(16, 185, 129, 0.25);

  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-text: #fbbf24;
  --status-warning-border: rgba(245, 158, 11, 0.25);

  --status-error-bg: rgba(239, 68, 68, 0.12);
  --status-error-text: #f87171;
  --status-error-border: rgba(239, 68, 68, 0.25);

  --status-info-bg: rgba(59, 130, 246, 0.12);
  --status-info-text: #60a5fa;
  --status-info-border: rgba(59, 130, 246, 0.25);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

  --code-bg: #090a0c;
  --badge-bg: #1f2127;
  --badge-text: #d4d4d8;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;

  --border-subtle: #e2e8f0;
  --border-muted: #cbd5e1;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-subtle: rgba(37, 99, 235, 0.08);

  --status-success-bg: #ecfdf5;
  --status-success-text: #059669;
  --status-success-border: #a7f3d0;

  --status-warning-bg: #fffbeb;
  --status-warning-text: #d97706;
  --status-warning-border: #fde68a;

  --status-error-bg: #fef2f2;
  --status-error-text: #dc2626;
  --status-error-border: #fecaca;

  --status-info-bg: #eff6ff;
  --status-info-text: #2563eb;
  --status-info-border: #bfdbfe;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  --code-bg: #0f172a;
  --badge-bg: #f1f5f9;
  --badge-text: #334155;
}

[data-theme="midnight"] {
  --bg-app: #000000;
  --bg-sidebar: #050505;
  --bg-surface: #0a0a0a;
  --bg-surface-elevated: #121212;
  --bg-surface-hover: #1a1a1a;
  --bg-input: #0a0a0a;
  --bg-input-focus: #121212;

  --border-subtle: #1c1c1c;
  --border-muted: #2a2a2a;
  --border-focus: #ffffff;

  --text-primary: #ffffff;
  --text-secondary: #888888;
  --text-muted: #555555;
  --text-inverse: #000000;

  --brand-primary: #ffffff;
  --brand-primary-hover: #e5e5e5;
  --brand-subtle: rgba(255, 255, 255, 0.1);

  --status-success-bg: rgba(255, 255, 255, 0.08);
  --status-success-text: #ffffff;
  --status-success-border: #333333;

  --status-warning-bg: rgba(255, 255, 255, 0.08);
  --status-warning-text: #f59e0b;
  --status-warning-border: #333333;

  --status-error-bg: rgba(255, 255, 255, 0.08);
  --status-error-text: #ef4444;
  --status-error-border: #333333;

  --status-info-bg: rgba(255, 255, 255, 0.08);
  --status-info-text: #38bdf8;
  --status-info-border: #333333;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.9);

  --code-bg: #050505;
  --badge-bg: #141414;
  --badge-text: #cccccc;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Common Helpers */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  max-width: 440px;
  font-size: 13px;
  font-weight: 500;
  animation: toastSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 3px solid #10b981; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid #3b82f6; }

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

/* ==========================================================================
   Authentication Screen (Minimalist & Clean)
   ========================================================================== */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--brand-subtle);
  color: var(--brand-primary);
  margin-bottom: 14px;
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-title span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 4px;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.auth-footer-hint {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.auth-footer-hint code {
  background: var(--bg-surface-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-primary);
}

/* ==========================================================================
   Layout Architecture
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

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

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--text-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.sidebar-logo-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-logo-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 10px 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

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

.nav-item:hover svg {
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--brand-primary);
}

[data-theme="midnight"] .nav-item.active svg {
  color: #ffffff;
}

.badge-role {
  margin-left: auto;
  font-size: 10px;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.2;
}

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

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 36px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.page-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}

.status-pulse.online {
  background: #10b981;
}

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

/* Theme Switcher Segmented Control */
.theme-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-btn svg {
  width: 14px;
  height: 14px;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Tab Panels & Sections
   ========================================================================== */

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.15s ease;
}

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

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

.section-desc h2, .section-desc-row h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.section-desc p, .section-desc-row p {
  color: var(--text-muted);
  font-size: 13px;
}

.section-desc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

/* ==========================================================================
   Cards & Data Metrics (Linear Style)
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.metric-card:hover {
  border-color: var(--border-muted);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.metric-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.metric-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.metric-badge.shorts {
  color: var(--status-info-text);
}

.metric-badge.video {
  color: var(--text-secondary);
}

/* Grids */
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
}

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

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

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

/* Platform Connection Status Cards */
.platform-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-title h4 {
  font-size: 14px;
  font-weight: 600;
}

.platform-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.platform-badge-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  flex-shrink: 0;
}

.platform-badge-icon.ig {
  color: #e1306c;
}

.platform-badge-icon.yt {
  color: #ef4444;
}

.connected-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  background: var(--bg-surface-elevated);
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.connected-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-muted);
}

.connected-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.connected-info p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.connected-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Accounts Grid in Accounts Tab */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}

.account-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
}

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

.empty-state-card {
  text-align: center;
  padding: 12px 0;
}

.empty-state-card p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

.actions-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.divider::before { margin-right: 12px; }
.divider::after { margin-left: 12px; }

.token-direct-box {
  text-align: left;
  background: var(--bg-surface-elevated);
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.token-direct-box label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Status Pills & Badges (Clean Enterprise Style)
   ========================================================================== */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.online, .status-pill.completed {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.status-pill.offline {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.status-pill.processing, .status-pill.uploading, .status-pill.pending {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
}

.status-pill.failed {
  background: var(--status-error-bg);
  color: var(--status-error-text);
  border: 1px solid var(--status-error-border);
}

/* Format Badges */
.format-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.format-badge.short {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
}

.format-badge.video {
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Forms & Controls
   ========================================================================== */

.form-group {
  margin-bottom: 14px;
}

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

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-wrap input {
  padding-left: 36px;
}

.input-with-button, .input-with-copy {
  display: flex;
  gap: 6px;
}

.input-with-copy input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.checkbox-wrap label {
  margin-bottom: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

/* ==========================================================================
   Buttons (Linear / Vercel Minimalist)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* Primary Button */
.btn-primary {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

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

/* Accent (Sync) Button */
.btn-accent {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.btn-accent:hover {
  background: var(--brand-primary-hover);
}

/* Danger Button */
.btn-danger {
  background: var(--status-error-bg);
  color: var(--status-error-text);
  border-color: var(--status-error-border);
}

.btn-danger:hover {
  filter: brightness(1.1);
}

/* Outline & Ghost Buttons */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: var(--bg-surface-elevated);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 5px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.icon-sync.spinning {
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Tables (Clean & Crisp)
   ========================================================================== */

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
}

.table tr:hover td {
  background: var(--bg-surface-hover);
}

.table-filters {
  display: flex;
  gap: 8px;
}

.select-filter {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  outline: none;
}

/* ==========================================================================
   Terminal & Logs
   ========================================================================== */

.terminal-card {
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.terminal-header {
  background: var(--bg-surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.terminal-body {
  padding: 16px;
  max-height: 460px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #d4d4d8;
}

.log-line {
  word-break: break-all;
}

.log-time {
  color: #71717a;
  margin-right: 8px;
}

.log-type {
  font-weight: 600;
  margin-right: 8px;
}

.log-type.sync { color: #38bdf8; }
.log-type.auth { color: #818cf8; }
.log-type.upload { color: #34d399; }
.log-type.error { color: #f87171; }
.log-type.system { color: #fbbf24; }

.code-box {
  background: var(--bg-surface-elevated);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  word-break: break-all;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ==========================================================================
   Help & Documentation Styles
   ========================================================================== */

.help-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 960px;
}

.help-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 24px;
}

.help-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.help-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.help-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-badge.recommended {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.help-badge.warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.help-badge.info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
}

.callout-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.callout-box.warning {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning-text);
}

.callout-box.info {
  background: var(--status-info-bg);
  border-color: var(--status-info-border);
  color: var(--status-info-text);
}

.callout-box.success {
  background: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success-text);
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-muted);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content {
  flex: 1;
}

.step-content h4 {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.code-snippet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-primary);
}

.code-snippet code {
  color: var(--status-info-text);
  word-break: break-all;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.faq-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px 16px;
}

.faq-question {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ==========================================================================
   Instagram Media Explorer & Manual Transfer Styles
   ========================================================================== */

.ig-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ig-media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
  position: relative;
}

.ig-media-card:hover {
  border-color: var(--border-muted);
}

.ig-media-card.selected {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary);
}

.ig-media-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.ig-media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ig-media-badge-type {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ig-media-check-label {
  position: absolute;
  top: 8px;
  right: 8px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.65);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.ig-media-check-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.ig-media-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.ig-media-caption {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 38px;
}

.ig-media-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.ig-media-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.ig-media-actions .btn {
  flex: 1;
}

@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }
  .nav-section-title {
    display: none;
  }
  .nav-item {
    white-space: nowrap;
    padding: 6px 10px;
  }
  .main-content {
    padding: 18px 20px;
  }
}

