/* Settings tab: Instagram publishing quota panel. */

.quota-panel {
  --quota-accent: var(--accent-emerald);
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
}
.quota-panel.warn { --quota-accent: var(--accent-amber); }
.quota-panel.full { --quota-accent: var(--accent-rose); }
.quota-panel.error { border-color: rgba(244, 63, 94, 0.35); background: rgba(244, 63, 94, 0.06); }

.quota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.quota-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
}
.quota-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.quota-checked { font-size: 12px; color: var(--text-faint); }

.quota-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.quota-stat {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}
.quota-value { font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.quota-stat.primary .quota-value { color: var(--quota-accent); }
.quota-label { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

.quota-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.quota-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--quota-accent);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.quota-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.quota-error-title { font-size: 14px; font-weight: 700; color: var(--accent-rose); }
.quota-panel.error .quota-note { margin-top: 6px; }

@media (max-width: 480px) {
  .quota-stats { gap: 8px; }
  .quota-stat { padding: 10px; }
  .quota-value { font-size: 20px; }
}

/* Instagram connection card */
.ig-loading { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

.ig-notice {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.07);
}
.ig-notice-title { font-size: 14px; font-weight: 700; color: var(--accent-amber); }
.ig-notice .quota-note { margin-top: 6px; }

button.btn.ig-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 18px;
  border: none;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  box-shadow: 0 6px 18px -6px rgba(220, 39, 67, 0.6);
}
button.btn.ig-connect-btn:hover {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  filter: brightness(1.08);
  transform: translateY(-1px);
}
button.btn.ig-connect-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.ig-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
}
.ig-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
}
.ig-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ig-account-info { flex: 1; min-width: 0; }
.ig-username { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-since { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
button.btn.ig-disconnect-btn {
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #f87171;
  box-shadow: none;
}
button.btn.ig-disconnect-btn:hover { background: rgba(244, 63, 94, 0.1); color: #fca5a5; }

.status-pill.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* In-card guide for connecting Instagram */
.ig-guide {
  margin-top: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}
.ig-guide[open] { background: var(--bg-card-elevated); }
.ig-guide summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.ig-guide summary::-webkit-details-marker { display: none; }
.ig-guide summary::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.ig-guide[open] summary::before { transform: rotate(45deg); }
.ig-guide-time { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-faint); }

.ig-guide-body { padding: 2px 18px 16px 34px; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.ig-guide-body h3 { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--text-main); }
.ig-guide-body h3:first-child { margin-top: 4px; }
.ig-guide-body p { margin: 0 0 8px; }
.ig-guide-body strong { color: var(--text-main); font-weight: 600; }
.ig-guide-path {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.ig-guide-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.ig-guide-steps li::marker { color: #f472b6; font-weight: 700; }

.ig-guide-perms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ig-guide-perms ul { margin: 0; padding: 10px 12px; list-style: none; border-radius: var(--radius-md); display: grid; gap: 6px; align-content: start; }
.ig-guide-perms li { position: relative; padding-left: 20px; }
.ig-can { background: rgba(16, 185, 129, 0.07); border: 1px solid rgba(16, 185, 129, 0.2); }
.ig-cannot { background: rgba(244, 63, 94, 0.06); border: 1px solid rgba(244, 63, 94, 0.18); }
.ig-guide-perms li::before { position: absolute; left: 0; font-weight: 800; }
.ig-can li::before { content: "✓"; color: var(--accent-emerald); }
.ig-cannot li::before { content: "✕"; color: var(--accent-rose); }

.ig-guide-faq { margin: 0; display: grid; gap: 2px; }
.ig-guide-faq dt { margin-top: 8px; font-weight: 600; color: var(--text-main); }
.ig-guide-faq dd { margin: 2px 0 0; }
.ig-guide-footnote { margin-top: 14px !important; padding-top: 12px; border-top: 1px solid var(--border-subtle); font-size: 12px; }

@media (max-width: 640px) {
  .ig-guide-body { padding-left: 16px; }
  .ig-guide-perms { grid-template-columns: 1fr; }
}

.ig-admin-tag {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 1px;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
}
.ig-setup-steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.ig-setup-steps strong { color: var(--text-main); font-weight: 600; }
.ig-setup-steps code, .ig-notice code {
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  word-break: break-all;
}

/* Studio publishing step: prompt to connect Instagram */
.ig-publish-connect {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid rgba(220, 39, 67, 0.35);
  background: linear-gradient(135deg, rgba(240, 148, 51, 0.08), rgba(188, 24, 136, 0.08));
}
.ig-publish-connect[hidden] { display: none; }
.ig-publish-connect-sub { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.ig-publish-connect button.btn.ig-connect-btn { margin-top: 0; padding: 8px 14px; }


/* Facebook Page connection card (reuses the Instagram card layout) */
button.btn.fb-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 18px;
  border: none;
  color: #fff;
  font-weight: 700;
  background: #1877f2;
  box-shadow: 0 6px 18px -6px rgba(24, 119, 242, 0.6);
}
button.btn.fb-connect-btn:hover { background: #1877f2; filter: brightness(1.08); transform: translateY(-1px); }
button.btn.fb-connect-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.ig-avatar.fb-avatar { background: #1877f2; }
.fb-page-picker { display: grid; gap: 6px; margin: 0 0 14px; }
.fb-page-picker[hidden] { display: none; }
.fb-page-picker select {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-main);
  font: inherit;
}
