:root {
  --bg-main: #0c0f17;
  --bg-surface: #141923;
  --bg-card: #1b212f;
  --bg-card-hover: #222a3c;
  --border-color: #273042;
  --border-focus: #4f6bff;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-ig-1: #833ab4;
  --accent-ig-2: #fd1d1d;
  --accent-ig-3: #fcb045;
  --ig-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  
  --color-green: #10b981;
  --color-blue: #3b82f6;
  --color-amber: #f59e0b;
  --color-red: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

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

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

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

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

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--ig-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 3px 10px rgba(220, 39, 67, 0.35);
}

.brand-text .title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: block;
}

.brand-text .subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.indicator-dot.green { background-color: var(--color-green); }
.indicator-dot.gray { background-color: var(--text-muted); }
.indicator-dot.red { background-color: var(--color-red); }

.indicator-dot.pulse {
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

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

.btn-primary {
  background: #3b82f6;
  color: #fff;
  border-color: #2563eb;
}
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #3b465c;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-magic {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}
.btn-magic:hover {
  opacity: 0.92;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.5);
}

.btn-save {
  background: #1e293b;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-save:hover {
  background: #334155;
}

.btn-instagram {
  background: var(--ig-gradient);
  color: white;
  border: none;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(220, 39, 67, 0.4);
}
.btn-instagram:hover {
  opacity: 0.93;
  box-shadow: 0 5px 18px rgba(220, 39, 67, 0.6);
}

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

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

/* Layout */
.main-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: 100%;
  height: calc(100vh - 64px);
  max-height: calc(100vh - 64px);
  overflow: hidden;
}

/* Gallery Pane */
.gallery-pane {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Gallery Source Switcher */
.gallery-source-bar {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.source-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.source-icon {
  color: #22c55e;
  flex-shrink: 0;
}

.source-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 8px;
  width: 100%;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.15s;
}

.source-select:hover, .source-select:focus {
  border-color: #6366f1;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-delete-gallery {
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
}

.btn-delete-gallery:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--color-red) !important;
}

/* SmugMug Gallery Stream Banner */
.smugmug-banner {
  margin: 10px 16px 0;
  padding: 10px 12px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.smugmug-banner-text {
  min-width: 0;
}

.smugmug-banner-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4ade80;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smugmug-banner-subtitle {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
}

.pane-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.tabs {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.watch-info {
  margin-top: 10px;
}

.folder-path-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Dropzone */
.dropzone {
  margin: 12px 16px 0;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: all 0.2s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.dropzone-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Cards Grid */
.cards-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.card-item:hover {
  background: var(--bg-card-hover);
  border-color: #3b465c;
  transform: translateY(-1px);
}

.card-item.selected {
  border-color: #6366f1;
  box-shadow: 0 0 0 1.5px #6366f1, 0 4px 14px rgba(99, 102, 241, 0.25);
  background: #1e2436;
}

.card-thumb {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #090c12;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-filename {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-caption-snippet {
  font-size: 0.74rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge.ready { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.ready_for_review { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.pending_caption { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.posting { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge.posted { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.failed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge.unimported { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.badge.smugmug { background: rgba(34, 197, 94, 0.12); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.25); }

/* AI Tone Pills & Badges */
.badge-ai-tone {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.caption-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(168, 85, 247, 0.12);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
}

.pill-tone-manual {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

.badge-ai-tone-mini {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}

.card-item {
  position: relative;
}

.card-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #60a5fa;
  font-weight: 600;
  z-index: 2;
  backdrop-filter: blur(2px);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state p { font-weight: 600; margin-bottom: 6px; }
.empty-state small { font-size: 0.78rem; }

/* Editor Pane */
.editor-pane {
  background: var(--bg-main);
  height: 100%;
  min-height: 0;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.empty-editor {
  margin: auto;
  text-align: center;
  max-width: 420px;
  padding: 40px;
}
.empty-illustration {
  color: var(--text-muted);
  margin-bottom: 16px;
}
.empty-editor h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.empty-editor p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

.editor-container {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
}

.editor-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.post-meta-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.meta-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.editor-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  padding: 28px;
  flex: 1;
  align-items: start;
}

.editor-form-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Format & Aspect Ratio Card */
.format-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.format-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.flex-1 {
  flex: 1;
  min-width: 140px;
}

.pill-group {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
  margin-top: 4px;
}

.pill-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}

.pill-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.pill-btn.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

.pill-btn.active.reel-active {
  background: var(--ig-gradient);
}

.ratio-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  min-width: 44px;
}

.ratio-icon-btn svg {
  display: block;
  pointer-events: none;
}

.form-control-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
  height: 34px;
}

/* AI Box */
.ai-box {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.03) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.ai-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a78bfa;
  font-size: 0.9rem;
}

.ai-controls-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
}

.visual-summary {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  color: #cbd5e1;
}

.summary-label {
  font-weight: 700;
  color: #a78bfa;
  margin-right: 6px;
}

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

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

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.btn-text-action {
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-text-action:hover { text-decoration: underline; }

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

.btn-regen-tags {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818cf8;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-regen-tags:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
  text-decoration: none;
}

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

.btn-regen-tags .regen-icon.spinning {
  animation: spin 0.8s linear infinite;
}

.hashtag-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  transition: all 0.15s ease;
  user-select: none;
}

.hashtag-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(99, 102, 241, 0.4);
}

.hashtag-chip-tag {
  color: #93c5fd;
  font-family: monospace;
  font-weight: 600;
}

.hashtag-chip-count {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 600;
}

.hashtag-chip-tier {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.hashtag-chip-tier.tier-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.hashtag-chip-tier.tier-med {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.hashtag-chip-tier.tier-low,
.hashtag-chip-tier.tier-niche {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: #6366f1;
}

textarea.form-control {
  resize: vertical;
  line-height: 1.5;
}

.publish-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.publish-action-bar .btn-instagram {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.95rem;
}

.live-post-banner {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #34d399;
}

.live-post-banner a {
  color: #6ee7b7;
  text-decoration: underline;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Instagram Phone Mockup */
.editor-preview-col {
  display: flex;
  justify-content: center;
  position: sticky;
  top: 24px;
}

.ig-mockup {
  width: 100%;
  max-width: 360px;
  background: #000;
  border: 1px solid #262626;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: fit-content;
}

.ig-mockup-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ig-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  overflow: hidden;
}

.ig-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-user-info {
  flex: 1;
}

.ig-username {
  font-size: 0.82rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.ig-location {
  font-size: 0.68rem;
  color: #8e8e8e;
}

.ig-more-dots {
  color: #8e8e8e;
  font-size: 0.85rem;
}

.ig-photo-container {
  width: 100%;
  aspect-ratio: 4 / 5; /* 4:5 Portrait Feed Post size (Default) */
  background: #121212;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: aspect-ratio 0.25s ease-in-out;
  position: relative;
}

.ig-photo-container.ratio-portrait { aspect-ratio: 4 / 5; }
.ig-photo-container.ratio-square { aspect-ratio: 1 / 1; }
.ig-photo-container.ratio-landscape { aspect-ratio: 1.91 / 1; }
.ig-photo-container.ratio-story,
.ig-photo-container.ratio-reel { aspect-ratio: 9 / 16; }

.ig-photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

/* Story / Reel overlay badges */
.story-indicator-bar {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  height: 2.5px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}
.story-indicator-fill {
  width: 65%;
  height: 100%;
  background: white;
}

.reel-audio-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  color: white;
  display: none;
  align-items: center;
  gap: 5px;
}

.ig-action-bar {
  padding: 10px 12px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.ig-actions-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ig-mockup-caption {
  padding: 6px 12px 14px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.ig-mockup-caption strong {
  margin-right: 6px;
}

.ig-mockup-tags {
  margin-top: 6px;
  color: #0095f6;
  font-size: 0.78rem;
  word-break: break-word;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 18px;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.form-hint a { color: #60a5fa; }

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ig-test-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* User Profile Badge in Header */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px 3px 4px;
  border-radius: 20px;
  margin-left: 6px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #334155;
}

.user-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

/* Fullscreen Google Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 40px rgba(99, 102, 241, 0.15);
  overflow: hidden;
  text-align: center;
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
  padding: 36px 30px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo-circle {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 18px;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.login-body {
  padding: 20px 30px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.login-error-banner {
  width: 100%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.8rem;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: left;
  line-height: 1.4;
}

.g-signin-wrapper {
  display: flex;
  justify-content: center;
  min-height: 44px;
  width: 100%;
}

.login-footer {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
}
