/* ========================================================
   INSTAGRAM LIVE DEVICE PREVIEW MODAL
   ======================================================== */
.ig-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
  overflow-y: auto;
}

.ig-modal-backdrop.open {
  display: flex;
}

.ig-modal-container {
  background: #0d111a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99, 102, 241, 0.2);
  max-width: 920px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 94vh;
}

.ig-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #090c13;
  gap: 14px;
  flex-wrap: wrap;
}

.ig-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ig-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(220, 39, 67, 0.4);
}

.ig-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.ig-modal-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.ig-view-toggle-nav {
  display: flex;
  background: #141926;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
}

.ig-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.ig-toggle-btn.active {
  background: var(--bg-card-elevated);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ig-close-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.ig-close-btn:hover {
  background: rgba(239,68,68,0.2);
  color: #f87171;
  border-color: rgba(239,68,68,0.4);
}

.ig-modal-body {
  display: flex;
  padding: 24px;
  gap: 28px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
}

@media (max-width: 800px) {
  .ig-modal-body {
    flex-direction: column;
    padding: 16px;
  }
}

/* Phone Mockup Frame */
.ig-phone-frame {
  width: min(350px, 100%);
  height: 680px;
  max-width: 100%;
  max-height: min(80vh, 80dvh);
  background: #000;
  border-radius: 46px;
  border: 8px solid #1a1e28;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.9),
              0 0 0 1px rgba(255, 255, 255, 0.15),
              inset 0 0 2px rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  flex-shrink: 0;
}

/* Dynamic Island Notch */
.ig-dynamic-island {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 22px;
  background: #000;
  border-radius: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.ig-island-cam {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0c1829;
  border: 1px solid #162a45;
}

.ig-island-sensor {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #060910;
}

/* Status Bar */
.ig-status-bar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  z-index: 40;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

.ig-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

/* Home Bar */
.ig-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  z-index: 50;
  pointer-events: none;
}

/* REELS VIEW */
.ig-reels-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ig-reels-media-wrap {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-reels-media-wrap video,
.ig-reels-media-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Reels Top Header */
.ig-reels-top-bar {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.ig-reels-header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Reels Right Action Bar */
.ig-reels-actions {
  position: absolute;
  right: 12px;
  bottom: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  z-index: 30;
  color: white;
}

.ig-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.ig-action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
  transition: transform 0.15s ease;
}

.ig-action-btn:hover {
  transform: scale(1.15);
}

.ig-action-count {
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.ig-disc-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  background: radial-gradient(circle, #333 40%, #111 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spinDisc 3s linear infinite;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

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

/* Reels Bottom Overlay */
.ig-reels-bottom-overlay {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 50px;
  padding: 16px 14px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  z-index: 30;
  color: white;
  font-size: 12.5px;
}

.ig-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ig-avatar-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ig-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #222;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #000;
}

.ig-username {
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.ig-follow-pill {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.7);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.ig-reels-caption-box {
  font-size: 12px;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  max-height: 48px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: max-height 0.25s ease;
}

.ig-reels-caption-box.expanded {
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0,0,0,0.65);
  padding: 6px 8px;
  border-radius: 6px;
}

.ig-more-toggle {
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  margin-left: 4px;
}

.ig-audio-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.9);
}

/* FEED / CAROUSEL VIEW */
.ig-feed-container {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding-top: 36px;
  overflow-y: auto;
}

.ig-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1c1c1e;
}

.ig-feed-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ig-feed-media-viewport {
  width: 100%;
  aspect-ratio: 1/1;
  position: relative;
  background: #111;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-feed-media-viewport img,
.ig-feed-media-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-slide-counter-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.75);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.ig-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 15;
  transition: background 0.15s;
}

.ig-carousel-arrow:hover {
  background: rgba(0,0,0,0.85);
}

.ig-carousel-arrow.left { left: 8px; }
.ig-carousel-arrow.right { right: 8px; }

.ig-feed-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}

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

.ig-feed-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ig-feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: background 0.2s, transform 0.2s;
}

.ig-feed-dot.active {
  background: #0095f6;
  transform: scale(1.25);
}

.ig-feed-likes {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ig-feed-caption-block {
  padding: 0 14px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.ig-hashtag-link {
  color: #e0f1ff;
  font-weight: 500;
}

.ig-feed-comments-link {
  padding: 6px 14px;
  font-size: 11.5px;
  color: #8e8e93;
  cursor: pointer;
}

.ig-feed-time {
  padding: 2px 14px 14px;
  font-size: 10px;
  color: #8e8e93;
  text-transform: uppercase;
}

/* Right-side Preview Controls panel */
.ig-preview-side-panel {
  flex: 1;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ig-preview-info-box {
  background: #080b12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.ig-preview-info-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Topbar User Pill */
.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.topbar-user-pill:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}
.topbar-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.topbar-user-details {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user-plan {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.topbar-user-plan.free {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.topbar-user-plan.paid {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(99, 102, 241, 0.2));
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

/* Free Limit Banner in Step 2 */
.free-limit-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.free-limit-pill.limit-reached {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  50% { box-shadow: 0 0 10px 2px rgba(244, 63, 94, 0.3); }
}

.limit-warning-banner {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #fecdd3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.limit-warning-banner a {
  color: #f43f5e;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Feed view scrolls like Instagram: the photo keeps its full frame and the caption follows below,
   instead of everything being squeezed to fit the phone screen. */
.ig-feed-container > * { flex-shrink: 0; }
.ig-feed-container { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.ig-feed-container::-webkit-scrollbar { width: 3px; }
.ig-feed-container::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
/* Keep the caption's own line breaks. */
#igFeedCaptionText,
#igMockupReelCaptionText { white-space: pre-line; }
