/* AdScope Studio - Ultra-Premium Themeable SaaS Dashboard */

:root {
  --bg-main: #090d16;
  --bg-header: rgba(15, 23, 42, 0.85);
  --bg-sidebar: rgba(15, 23, 42, 0.65);
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(2, 6, 23, 0.6);
  --bg-footer: rgba(2, 6, 23, 0.4);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.4);
  --accent-primary: #10b981;
  --accent-primary-hover: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.25);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --pill-bg: rgba(255, 255, 255, 0.04);
  --pill-border: rgba(255, 255, 255, 0.08);
  --pill-active-bg: rgba(16, 185, 129, 0.15);
  --pill-active-border: rgba(16, 185, 129, 0.4);
  --pill-active-text: #ffffff;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-main: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Light Theme */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-sidebar: rgba(255, 255, 255, 0.75);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-footer: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --border-focus: #10b981;
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.2);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --pill-bg: #f1f5f9;
  --pill-border: #e2e8f0;
  --pill-active-bg: #d1fae5;
  --pill-active-border: #10b981;
  --pill-active-text: #065f46;
  --shadow-card: 0 4px 20px -4px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* RTL Typography Support */
[dir="rtl"] {
  font-family: "Noto Kufi Arabic", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s;
}

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

.brand-logo svg {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.brand-info h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-accent {
  color: var(--accent-primary);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stats in Header */
.header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--pill-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 12px;
}

.stat-pill.stat-highlight {
  background: var(--pill-active-bg);
  border-color: var(--pill-active-border);
}

.stat-pill.stat-highlight .stat-val {
  color: var(--accent-primary);
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.stat-val {
  font-weight: 700;
  color: var(--text-primary);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #022c22;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--pill-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

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

.btn-ghost:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.btn-block {
  width: 100%;
}

.text-button {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.text-button:hover {
  background: var(--pill-bg);
}

/* Body Workspace */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar-panel {
  width: 395px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  overflow-y: auto;
  gap: 11px;
}

[dir="rtl"] .sidebar-panel {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.section-title span {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title h2 {
  font-size: 15.5px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text-primary);
}

.scrape-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 4px;
}

.form-row-dual {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.form-row-dual .flex-1 {
  flex: 1;
  min-width: 0;
}

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

.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

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

.input-wrapper input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  transition: all 0.2s;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-clear-input {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

[dir="rtl"] .btn-clear-input {
  right: auto;
  left: 10px;
}

.form-select {
  height: 35px;
  padding: 0 9px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

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

/* Segment Group */
.segment-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--pill-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  height: 35px;
  box-sizing: border-box;
  width: 100%;
}

.segment-group.segment-status {
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.segment-group.segment-status .segment-btn {
  font-size: 10.5px;
  padding: 0 3px;
}

.segment-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.segment-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.segment-btn span {
  white-space: nowrap;
}

.segment-item input:checked + .segment-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-weight: 700;
}

/* Check Grid */
.check-grid {
  display: grid;
  gap: 5px;
}

.check-grid.two-cols {
  grid-template-columns: 1fr 1fr;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 35px;
  box-sizing: border-box;
  transition: all 0.15s;
  user-select: none;
}

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

.check-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.check-box svg {
  width: 10px;
  height: 10px;
  color: transparent;
}

.check-card input:checked ~ .check-box {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.check-card input:checked ~ .check-box svg {
  color: #ffffff;
}

.option-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Platforms Grid */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.platform-grid.three-cols {
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.platform-card {
  padding: 5px 8px;
  height: 35px;
  gap: 5px;
}

.platform-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.platform-icon svg {
  width: 15px;
  height: 15px;
}

.platform-icon.fb-icon { color: #1877f2; }
.platform-icon.ig-icon { color: #f43f5e; }
.platform-icon.msg-icon { color: #0084ff; }
.platform-icon.an-icon { color: #2563eb; }
.platform-icon.th-icon { color: var(--text-primary); }
.platform-icon.wa-icon { color: #25d366; }

.platform-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact Exclusive Toggle Card */
.exclusive-toggle-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 3px;
  transition: all 0.15s;
}

.exclusive-toggle-compact:hover {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--accent-primary);
}

.exclusive-toggle-compact input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exclusive-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--accent-primary);
}

.exclusive-left strong {
  font-weight: 700;
}

.exclusive-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

.switch-container {
  display: flex;
  align-items: center;
}

.toggle-switch {
  width: 30px;
  height: 16px;
  border-radius: 9999px;
  background: var(--text-muted);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s;
}

[dir="rtl"] .toggle-switch::after {
  left: auto;
  right: 2px;
}

.exclusive-toggle-compact input:checked ~ .toggle-switch {
  background: var(--accent-primary);
}

.exclusive-toggle-compact input:checked ~ .toggle-switch::after {
  transform: translateX(14px);
}

[dir="rtl"] .exclusive-toggle-compact input:checked ~ .toggle-switch::after {
  transform: translateX(-14px);
}

/* Media Selector Structured Grid (2 Rows) */
.media-selector-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.media-grid-row-1 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.media-grid-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.media-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 33px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  white-space: nowrap;
}

.media-pill-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--pill-bg);
}

.chip-radio input:checked + .media-pill-btn {
  background: var(--pill-active-bg);
  border-color: var(--pill-active-border);
  color: var(--pill-active-text);
  font-weight: 700;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Legacy Chips Selector Fallback */
.chips-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-radio-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
  height: 28px;
  box-sizing: border-box;
}

.chip-radio-btn:hover {
  border-color: var(--accent-primary);
}

.chip-radio input:checked + .chip-radio-btn {
  background: var(--pill-active-bg);
  border-color: var(--pill-active-border);
  color: var(--pill-active-text);
  font-weight: 700;
}

.status-dot-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* Date Range */
.date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.date-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.date-inputs-row input {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 11.5px;
  font-family: inherit;
  box-sizing: border-box;
}

/* Slider */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.limit-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--pill-active-bg);
  padding: 2px 7px;
  border-radius: 4px;
}

.range-slider {
  width: 100%;
  height: 18px;
  accent-color: var(--accent-primary);
  margin-top: 3px;
  cursor: pointer;
}

.btn-scrape-compact {
  height: 42px;
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 4px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  gap: 7px;
}

/* Task Progress Card */
.task-card {
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.gallery-task-banner {
  margin: 0 0 16px 0;
  width: 100%;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.task-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  position: relative;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.5);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.task-status-indicator strong {
  font-size: 12px;
  color: var(--text-primary);
}

.btn-cancel-task {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  cursor: pointer;
}

.btn-cancel-task:hover {
  background: rgba(239, 68, 68, 0.3);
}

.progress-bar-wrapper {
  height: 6px;
  background: var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.3s ease;
}

.task-status-text {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Content Panel */
.content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.04) 0%, transparent 60%);
}

/* Gallery Toolbar (Unified Single Row) */
.gallery-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-header);
  position: relative;
  z-index: 50;
}

.gallery-filter-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  width: 100%;
}

/* Call to Action (CTA) Interactive Filter Sub-Bar */
.gallery-cta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.72);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 45;
  flex-wrap: wrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cta-opt-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.cta-opt-name {
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
}

.multiselect-opt-count {
  margin-inline-start: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 6px;
  border-radius: 9999px;
  min-width: 18px;
  text-align: center;
}

[data-theme="light"] .multiselect-opt-count {
  background: #f1f5f9;
  color: #64748b;
}

[data-theme="light"] .gallery-cta-bar {
  background: rgba(248, 250, 252, 0.95);
  border-bottom-color: #e2e8f0;
}

.cta-bar-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  user-select: none;
}

.cta-bar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.cta-bar-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

[data-theme="light"] .cta-bar-title {
  color: #475569;
}

.cta-filter-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
  min-width: 0;
}

.cta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 11px;
  border-radius: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
}

.cta-chip:hover {
  background: var(--bg-card-hover);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.cta-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.cta-chip-icon {
  font-size: 12px;
  line-height: 1;
}

.cta-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
}

[data-theme="light"] .cta-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .cta-chip:hover {
  background: #f1f5f9;
  border-color: #10b981;
  color: #0f172a;
}

[data-theme="light"] .cta-chip-badge {
  background: #f1f5f9;
  color: #64748b;
}

/* Active CTA Chip State */
.cta-chip.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.cta-chip.active .cta-chip-dot {
  background: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
}

.cta-chip.active .cta-chip-badge {
  background: var(--accent-primary);
  color: #ffffff;
}

[data-theme="light"] .cta-chip.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: #059669;
  color: #065f46;
  font-weight: 700;
}

[data-theme="light"] .cta-chip.active .cta-chip-badge {
  background: #059669;
  color: #ffffff;
}

/* Favorites Filter Button */
.gallery-favorites-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.gallery-favorites-btn:hover {
  border-color: #f43f5e;
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.08);
}

.gallery-favorites-btn .heart-icon {
  width: 13px;
  height: 13px;
  color: #f43f5e;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.gallery-favorites-btn:hover .heart-icon {
  transform: scale(1.15);
}

.gallery-favorites-btn.active {
  background: rgba(244, 63, 94, 0.16);
  border-color: #f43f5e;
  color: #f43f5e;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
  font-weight: 700;
}

.gallery-favorites-btn.active .heart-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.6));
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-primary) !important;
  outline-offset: 2px !important;
}

.gallery-meta-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-inline-start: auto;
}

.gallery-count-badge {
  padding: 3px 9px;
  background: var(--pill-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  white-space: nowrap;
}

.btn-reset-gallery {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-reset-gallery:hover {
  color: var(--text-primary);
  background: var(--pill-bg);
  border-color: var(--accent-primary);
}

.search-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 30px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  min-width: 180px;
  flex: 1;
  max-width: 260px;
  position: relative;
}

.search-mini svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-mini input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 11.5px;
  font-family: inherit;
  width: 100%;
}

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

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

/* ==========================================================================
   Custom Glassmorphic Single-Select & Multi-Select Dropdowns
   ========================================================================== */

.custom-select-container {
  position: relative;
  display: inline-block;
}

.custom-select-trigger {
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.custom-select-trigger:hover {
  border-color: var(--accent-primary);
  background: var(--pill-bg);
}

.custom-select-container.open .custom-select-trigger,
.custom-multiselect-container.open .custom-select-trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: var(--bg-card);
}

.custom-select-container.open .dropdown-chevron,
.custom-multiselect-container.open .dropdown-chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

.select-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.select-label {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-chevron {
  width: 11px;
  height: 11px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 350;
  min-width: 170px;
  max-height: 290px;
  overflow-y: auto;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 36px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
  padding: 5px;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: dropdownSlideIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-container.open .custom-select-menu {
  display: flex;
}

.custom-select-menu[hidden] {
  display: none !important;
}

[dir="rtl"] .custom-select-menu {
  left: auto;
  right: 0;
}

.custom-select-container.align-right .custom-select-menu {
  left: auto;
  right: 0;
}

[dir="rtl"] .custom-select-container.align-right .custom-select-menu {
  right: auto;
  left: 0;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6.5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-primary);
  transition: all 0.12s ease;
  user-select: none;
}

.custom-select-option:hover {
  background: var(--pill-bg);
}

.custom-select-option.active {
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-primary);
  font-weight: 700;
}

.option-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.option-icon {
  font-size: 12px;
  flex-shrink: 0;
  line-height: 1;
}

.option-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-check {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-primary);
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.custom-select-option.active .option-check {
  opacity: 1;
  transform: scale(1);
}

/* Custom Multi-Select Dropdown */
.custom-multiselect-container {
  position: relative;
  display: inline-block;
}

.multiselect-badge {
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 9999px;
  line-height: 1;
}

.multiselect-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 350;
  min-width: 210px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 36px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  animation: dropdownSlideIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-multiselect-container.open .multiselect-dropdown-menu {
  display: flex;
}

.multiselect-dropdown-menu[hidden] {
  display: none !important;
}

[dir="rtl"] .multiselect-dropdown-menu {
  left: auto;
  right: 0;
}

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

.multiselect-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.multiselect-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.multiselect-link-btn {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.15s;
}

.multiselect-link-btn:hover {
  background: var(--pill-bg);
}

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

.multiselect-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-primary);
  transition: background 0.15s;
  user-select: none;
}

.multiselect-option:hover {
  background: var(--pill-bg);
}

.multiselect-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box-mini {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
  background: var(--bg-input);
}

.multiselect-option input:checked ~ .check-box-mini {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.multiselect-option input:checked ~ .check-box-mini::after {
  content: "✓";
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.plat-opt-icon {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.plat-opt-icon svg {
  width: 14px;
  height: 14px;
}

/* Gallery Exclusive Match Toggle Button */
.gallery-exclusive-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.gallery-exclusive-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.gallery-exclusive-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
  font-weight: 700;
}

.exclusive-dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.2s;
}

.gallery-exclusive-btn.active .exclusive-dot-mini {
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

.gallery-custom-dates {
  display: flex;
  align-items: center;
  gap: 4px;
}

.gallery-custom-dates[hidden] {
  display: none !important;
}

.gallery-custom-dates input {
  height: 30px;
  padding: 0 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 10.5px;
  font-family: inherit;
  box-sizing: border-box;
}

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

/* Pagination Bar */
.gallery-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-header);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  user-select: none;
}

.btn-page {
  padding: 5px 12px;
  height: 30px;
  background: var(--pill-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-page:hover:not(:disabled) {
  background: var(--border-subtle);
  border-color: var(--accent-primary);
}

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

.page-indicator {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-page-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--pill-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-page-num:hover:not(.active) {
  border-color: var(--accent-primary);
}

.btn-page-num.active {
  background: var(--accent-primary);
  color: #022c22;
  border-color: var(--accent-primary);
  font-weight: 700;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ==========================================================================
   Ads Grid & Facebook / Meta Ad Library Card Styles
   ========================================================================== */

.ads-grid,
.catalog-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-rows: max-content;
  gap: 20px;
  align-items: start;
  align-content: start;
}

/* Ad Card (Outer Meta Container) */
.ad-card.meta-library-card,
.creative-card.meta-library-card,
.creative-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: fit-content;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
}

[data-theme="light"] .ad-card.meta-library-card,
[data-theme="light"] .creative-card.meta-library-card,
[data-theme="light"] .creative-card {
  background: #ffffff;
  border-color: #dddfe2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ad-card.meta-library-card:hover,
.creative-card.meta-library-card:hover,
.creative-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.3);
  border-color: rgba(16, 185, 129, 0.35);
}

/* 1. Meta Ad Library Header Section */
.ad-library-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ad-library-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lib-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
}

[data-theme="light"] .lib-status {
  color: #00a400;
}

.lib-status-check {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #10b981;
}

[data-theme="light"] .lib-status-check {
  color: #00a400;
}

.lib-status-check svg {
  width: 14px;
  height: 14px;
}

.ad-library-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Dedicated SD & HD Download Buttons */
.ad-dl-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .ad-dl-group {
  background: #f0f2f5;
  border-color: #ccd0d5;
}

.btn-dl-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.btn-dl-badge svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

/* SD Button */
.btn-dl-badge.btn-dl-sd {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .btn-dl-badge.btn-dl-sd {
  background: #e4e6eb;
  color: #475569;
  border-color: #cbd5e1;
}

.btn-dl-badge.btn-dl-sd:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

[data-theme="light"] .btn-dl-badge.btn-dl-sd:hover {
  background: #cbd5e1;
  color: #0f172a;
}

/* HD Button (Distinct, Premium Emerald) */
.btn-dl-badge.btn-dl-hd {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

[data-theme="light"] .btn-dl-badge.btn-dl-hd {
  background: #dcfce7;
  color: #059669;
  border-color: #86efac;
}

.btn-dl-badge.btn-dl-hd:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-dl-badge.btn-dl-hd.no-hd {
  opacity: 0.6;
  border-style: dashed;
}

/* Single Image Download Button */
.btn-dl-badge.btn-dl-img {
  background: rgba(59, 130, 246, 0.16);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.btn-dl-badge.btn-dl-img:hover {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

.btn-lib-action {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-lib-action:hover {
  background: var(--pill-bg);
  color: var(--text-primary);
}

.btn-lib-action.btn-bookmark.favorited svg {
  fill: #f43f5e !important;
  stroke: #f43f5e !important;
}

.ad-library-meta-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 1px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
}

[data-theme="light"] .meta-row {
  color: #65676b;
}

.meta-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

[data-theme="light"] .meta-label {
  color: #65676b;
}

.meta-val {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
}

[data-theme="light"] .meta-val {
  color: #050505;
}

.meta-val-id {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

[data-theme="light"] .meta-val-id {
  color: #050505;
}

.meta-val-id:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.meta-platforms-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-platform-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lib-plat-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

[data-theme="light"] .lib-plat-icon {
  color: #65676b;
}

.lib-plat-icon svg {
  width: 13px;
  height: 13px;
}

.lib-plat-icon.fb { color: #1877f2; }
.lib-plat-icon.ig { color: #e1306c; }
.lib-plat-icon.wa { color: #25d366; }
.lib-plat-icon.msg { color: #0084ff; }

.meta-version-note {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}

[data-theme="light"] .meta-version-note {
  color: #050505;
}

.meta-info-circle {
  font-size: 11px;
  color: var(--text-muted);
}

/* Full-width "See ad details" Button */
.btn-see-details {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s;
}

[data-theme="light"] .btn-see-details {
  background: #e4e6eb;
  color: #050505;
  border: none;
}

[data-theme="light"] .btn-see-details:hover {
  background: #d8dadf;
  color: #050505;
}

.btn-see-details:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* 2. Inner Facebook Post Simulation Box */
.feed-post-preview {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-input);
  overflow: hidden;
  height: auto;
  flex-shrink: 0;
}

[data-theme="light"] .feed-post-preview {
  border: 1px solid #ced0d4;
  background: #ffffff;
}

.preview-page-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px 8px;
}

.feed-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: #1e293b;
}

[data-theme="light"] .feed-avatar {
  border-color: #dddfe2;
  background: #f0f2f5;
}

.preview-page-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.preview-page-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.feed-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

[data-theme="light"] .feed-name {
  color: #050505;
}

.feed-sponsored {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

[data-theme="light"] .feed-sponsored {
  color: #65676b;
}

.ad-ig-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ad-ig-badge svg {
  width: 9px;
  height: 9px;
}

/* Feed Copy / Primary Text */
.feed-copy-wrap {
  padding: 2px 12px 10px;
}

.feed-copy-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
}

[data-theme="light"] .feed-copy-text {
  color: #050505;
}

.feed-copy-text.clamp-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-toggle-copy {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0 0;
  font-family: inherit;
}

[data-theme="light"] .btn-toggle-copy {
  color: #1877f2;
}

.btn-toggle-copy:hover {
  text-decoration: underline;
}

/* Feed Media Box */
.feed-media-box {
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: 340px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.feed-media-box img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  display: block;
}

.feed-media-box video {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  display: block;
  background: #000000;
}

/* Center Play Button for Videos (Exact Facebook Style) */
.fb-play-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 2.5px solid rgba(255, 255, 255, 0.95);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.fb-play-overlay-btn svg {
  width: 20px;
  height: 20px;
  margin-inline-start: 3px;
  fill: #ffffff;
}

.fb-play-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0, 0, 0, 0.85);
}

/* Facebook Custom Video Controls Bar */
.fb-video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.45) 70%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 20;
  user-select: none;
  direction: ltr !important;
  opacity: 0.95;
  transition: opacity 0.2s ease;
}

.feed-media-box.video-box:hover .fb-video-controls {
  opacity: 1;
}

.fb-ctrl-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fb-ctrl-btn {
  background: none;
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.fb-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.fb-ctrl-btn svg {
  width: 17px;
  height: 17px;
}

.btn-fb-playpause svg {
  fill: #ffffff;
}

.fb-ctrl-time {
  font-size: 11px;
  font-weight: 600;
  color: #f0f2f5;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  margin-right: 4px;
}

.fb-progress-container {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0 4px;
  position: relative;
}

.fb-progress-track {
  width: 100%;
  height: 3.5px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  position: relative;
  transition: height 0.12s ease;
}

.fb-progress-container:hover .fb-progress-track {
  height: 5.5px;
}

.fb-progress-fill {
  height: 100%;
  width: 0%;
  background: #2d88ff;
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 0;
  transition: width 0.04s linear;
}

.fb-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.fb-progress-container:hover .fb-progress-thumb {
  opacity: 1;
}

.fb-ctrl-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Settings Gear & Popover */
.fb-settings-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.fb-settings-wrap .fb-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 25, 26, 0.92);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fb-settings-wrap:hover .fb-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Facebook Two-Level Settings Popover Menu (Exact Native Style) */
.fb-settings-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  right: -10px;
  background: #242526;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 195px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 100;
  direction: ltr !important;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.fb-settings-popover[hidden] {
  display: none !important;
}

.fb-menu-view {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.fb-menu-view[hidden] {
  display: none !important;
}

/* Level 1 Menu Items (Quality sd >, Playback speed 1 >) */
.fb-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #e4e6eb;
  transition: background 0.12s ease;
}

.fb-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.fb-item-label {
  color: #e4e6eb;
}

.fb-item-value {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #b0b3b8;
  font-size: 13px;
  text-transform: lowercase;
}

.fb-item-value svg {
  stroke: #b0b3b8;
  flex-shrink: 0;
}

/* Submenu Header (< Quality / < Playback speed) */
.fb-submenu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #e4e6eb;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.12s ease;
}

.fb-submenu-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fb-back-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fb-back-arrow svg {
  stroke: #e4e6eb;
}

/* Radio Button Options (hd / sd / speed choices) */
.fb-radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  font-size: 13px;
  color: #e4e6eb;
  cursor: pointer;
  transition: background 0.12s ease;
}

.fb-radio-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.fb-radio-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.8px solid #8a8d91;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  background: transparent;
}

.fb-radio-option.selected .fb-radio-dot {
  border-color: #ffffff;
}

.fb-radio-option.selected .fb-radio-dot::after {
  content: "";
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #ffffff;
}

.fb-radio-label {
  flex: 1;
}

/* Volume Wrap & Slider */
.fb-volume-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

.fb-volume-slider-box {
  width: 0;
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
}

.fb-volume-wrap:hover .fb-volume-slider-box {
  width: 55px;
  margin-left: 4px;
}

.fb-volume-slider {
  width: 50px;
  height: 3px;
  accent-color: #2d88ff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.4);
}

/* Post Bottom CTA Bar */
.preview-cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-footer);
  border-top: 1px solid var(--border-subtle);
  min-height: 48px;
  box-sizing: border-box;
}

[data-theme="light"] .preview-cta-bar {
  background: #f0f2f5;
  border-color: #e4e6eb;
}

.preview-cta-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

a.preview-cta-left {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.preview-cta-left:hover .feed-headline {
  text-decoration: underline;
}

.preview-domain {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .preview-domain {
  color: #65676b;
}

.feed-headline {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .feed-headline {
  color: #050505;
}

.feed-cta-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

[data-theme="light"] .feed-cta-btn {
  background: #e4e6eb;
  color: #050505;
  border-color: #ccd0d5;
}

[data-theme="light"] .feed-cta-btn:hover {
  background: #d8dadf;
  color: #050505;
  border-color: #bec3c9;
}

.feed-cta-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}


/* Empty State */
.empty-state {
  margin: auto;
  padding: 60px 20px;
  text-align: center;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon svg {
  width: 54px;
  height: 54px;
  stroke: var(--text-muted);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

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

[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}

.toast {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.25s ease;
}

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

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

/* Responsive */
@media (max-width: 960px) {
  .app-body {
    flex-direction: column;
  }
  .sidebar-panel {
    width: 100%;
    max-height: 48vh;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .header-stats {
    display: none;
  }
}
