/* TikTok Scraper — 2026 iPhone / AI-agent UI */
:root {
  --ios-bg: #f2f2f7;
  --ios-elevated: rgba(255, 255, 255, 0.82);
  --ios-card: #ffffff;
  --ios-ink: #111113;
  --ios-muted: #8e8e93;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-blue: #007aff;
  --ios-blue-press: #0066d6;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-fill: #e5e5ea;
  --ios-bubble-ai: #ffffff;
  --ios-bubble-user: #007aff;
  --ios-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --ios-radius: 22px;
  --ios-radius-sm: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --phone-max: 430px;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ios-ink);
  background: #0b0b0f;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.trial-seo {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 48px;
  color: #d7d7de;
  font-size: 0.95rem;
  line-height: 1.6;
}
.trial-seo h1 {
  color: #fff;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
}
.trial-seo h2 {
  color: #fff;
  font-size: 1.05rem;
  margin: 1.35rem 0 0.4rem;
}
.trial-seo a { color: #7ab8ff; }
.trial-seo .cite {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  margin: 0.85rem 0 0;
}
.trial-seo ul { margin: 0.4rem 0 0; padding-left: 1.15rem; }
.trial-seo li { margin: 0.25rem 0; }


a { color: var(--ios-blue); text-decoration: none; }

.ios-stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1a2744 0%, transparent 55%),
    linear-gradient(180deg, #0b0b0f, #12121a 60%, #0b0b0f);
}

.ios-phone {
  width: min(100%, var(--phone-max));
  height: min(100dvh - 32px, 920px);
  max-height: 100dvh;
  background: var(--ios-bg);
  border-radius: 42px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  box-shadow:
    0 0 0 11px #1c1c1e,
    0 0 0 13px #3a3a3c,
    var(--ios-shadow);
  display: flex;
  flex-direction: column;
}

.ios-status {
  height: calc(54px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) 22px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, rgba(242,242,247,0.96), rgba(242,242,247,0.72));
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.ios-status .time { font-variant-numeric: tabular-nums; }
.ios-status .pills { display: flex; gap: 6px; color: var(--ios-muted); }

.ios-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 12px;
  background: transparent;
}

.ios-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.ios-nav h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.ios-nav .sub {
  margin: 2px 0 0;
  color: var(--ios-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.ios-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.16);
  color: var(--ios-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.05rem;
}

.ios-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px 16px;
  scroll-behavior: smooth;
}

.ios-phone:has(.tabbar) .ios-body {
  padding-bottom: 96px;
}

.agent-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.45;
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.bubble.ai {
  align-self: flex-start;
  background: var(--ios-bubble-ai);
  color: var(--ios-ink);
  box-shadow: 0 1px 0 var(--ios-separator), 0 8px 24px rgba(0,0,0,0.04);
  border-bottom-left-radius: 8px;
}

.bubble.user {
  align-self: flex-end;
  background: var(--ios-bubble-user);
  color: #fff;
  border-bottom-right-radius: 8px;
}

.bubble .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ios-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bubble.user .label { color: rgba(255,255,255,0.75); }

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ios-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip, .ios-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.12);
  color: var(--ios-blue);
}

.chip:active, .ios-btn:active { transform: scale(0.98); }

.ios-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 1rem;
}

.ios-btn.secondary {
  background: rgba(120, 120, 128, 0.16);
  color: var(--ios-ink);
}

.ios-btn.danger { background: var(--ios-red); }
.ios-btn:disabled { opacity: 0.45; }

.composer {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  transform: none;
  padding: 8px 14px 22px;
  background: linear-gradient(180deg, rgba(242,242,247,0), rgba(242,242,247,0.96) 24%, #f2f2f7);
  backdrop-filter: blur(16px);
  z-index: 80;
  box-sizing: border-box;
}

/* Tool pages (iframe / standalone) — pin to viewport */
body.ios-tool .composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--phone-max));
  bottom: 0;
  z-index: 80;
  padding: 10px 12px calc(16px + var(--safe-bottom));
}

.ios-phone.tool-open .tabbar {
  display: none;
}

.ios-phone.tool-open .ios-frame {
  display: block;
  height: 100%;
}

.composer-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  border-radius: 24px;
  padding: 8px 8px 8px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  border: 1px solid var(--ios-separator);
  width: 100%;
  box-sizing: border-box;
}

.composer input[type="text"],
.composer input[type="email"],
.composer input[type="file"],
.composer textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  padding: 8px 0;
  min-width: 0;
  color: var(--ios-ink);
}

.composer .send {
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--ios-blue);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.tabbar {
  position: absolute;
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-bottom));
  height: 64px;
  border-radius: 22px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px);
  border: 1px solid var(--ios-separator);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 40;
  overflow: hidden;
}

.tabbar a, .tabbar button {
  border: none;
  background: transparent;
  color: var(--ios-muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  text-decoration: none;
}

.tabbar .ico { font-size: 1.2rem; line-height: 1; }
.tabbar .active { color: var(--ios-blue); }

.ios-card {
  background: var(--ios-card);
  border-radius: var(--ios-radius);
  padding: 16px;
  box-shadow: 0 1px 0 var(--ios-separator);
}

.ios-list {
  background: var(--ios-card);
  border-radius: var(--ios-radius);
  overflow: hidden;
}

.ios-list a, .ios-list button.row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background: #fff;
  border-bottom: 1px solid var(--ios-separator);
  text-align: left;
  font: inherit;
  color: var(--ios-ink);
  cursor: pointer;
  text-decoration: none;
}

.ios-list a:last-child, .ios-list button.row:last-child { border-bottom: none; }

.ios-list .glyph {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; font-size: 1rem; flex-shrink: 0;
}
.ios-list .glyph.blue { background: var(--ios-blue); }
.ios-list .glyph.green { background: var(--ios-green); }
.ios-list .glyph.orange { background: var(--ios-orange); }
.ios-list .glyph.purple { background: #af52de; }

.ios-list .meta { flex: 1; min-width: 0; }
.ios-list .meta strong { display: block; font-size: 0.98rem; }
.ios-list .meta span { color: var(--ios-muted); font-size: 0.8rem; }
.ios-list .chev { color: var(--ios-muted); }

.progress-pills {
  display: flex; gap: 6px; margin: 4px 0 10px;
}
.progress-pills i {
  height: 4px; flex: 1; border-radius: 999px; background: var(--ios-fill);
}
.progress-pills i.on { background: var(--ios-blue); }

.hidden { display: none !important; }

.ios-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--ios-bg);
}

/* Tool pages inside iframe / standalone */
body.ios-tool {
  background: var(--ios-bg) !important;
  min-height: 100dvh;
  font-family: var(--font) !important;
}

body.ios-tool .centered-content,
body.ios-tool .page-wrap,
body.ios-tool .login-wrap {
  max-width: 430px;
  margin: 0 auto;
  padding: 16px 14px 40px !important;
}

body.ios-tool .input-card,
body.ios-tool .page-card,
body.ios-tool .login-card,
body.ios-tool .modal-content,
body.ios-tool #modalContent {
  border: none !important;
  border-radius: 22px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06) !important;
  background: #fff !important;
}

body.ios-tool .wide-text-input,
body.ios-tool input[type="text"],
body.ios-tool input[type="email"] {
  border-radius: 14px !important;
  border: 1px solid var(--ios-separator) !important;
  background: var(--ios-fill) !important;
  padding: 14px !important;
}

body.ios-tool .btn-next,
body.ios-tool .button-link,
body.ios-tool .btn,
body.ios-tool .redirect-button,
body.ios-tool .scrape-btn,
body.ios-tool .modal-buttons a,
body.ios-tool .modal-buttons button {
  border-radius: 14px !important;
  background: var(--ios-blue) !important;
  min-height: 48px;
  font-weight: 700 !important;
}

body.ios-tool .buy-btn {
  background: var(--ios-fill) !important;
  color: var(--ios-ink) !important;
  border: none !important;
}

@media (max-width: 520px) {
  .ios-stage { padding: 0; background: var(--ios-bg); }
  .ios-phone {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .composer {
    padding-bottom: calc(14px + var(--safe-bottom));
  }
}

/* ===== Agent results, tables, progress, sheets ===== */
.agent-screen {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 14px 14px 40px;
  background: var(--ios-bg);
}

.agent-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--ios-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.ios-progress {
  background: var(--ios-fill);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin: 10px 0 14px;
  position: relative;
}

.ios-progress .progress-bar,
.ios-progress #progress-bar,
.progress-bar {
  height: 100% !important;
  background: linear-gradient(90deg, #5ac8fa, var(--ios-blue)) !important;
  border-radius: 999px !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  border: none !important;
  transition: width 0.2s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.progress-meta #progressPercent,
.progress-meta .pct {
  color: var(--ios-blue);
}

.id-sheet {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--ios-separator);
  max-height: 52vh;
  overflow-y: auto;
}

.id-sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 !important;
}

.id-sheet th {
  position: sticky;
  top: 0;
  background: #f9f9fb !important;
  color: var(--ios-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none !important;
  padding: 10px 14px !important;
  text-align: left !important;
}

.id-sheet td {
  border: none !important;
  border-bottom: 1px solid var(--ios-separator) !important;
  padding: 12px 14px !important;
  text-align: left !important;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.id-sheet tr:last-child td { border-bottom: none !important; }
.id-sheet td:first-child {
  color: var(--ios-muted);
  width: 52px;
  font-weight: 650;
}

/* Agent modal / sheet */
.modal,
#popup-modal,
#activateModal,
#trialModal {
  background: rgba(15, 15, 20, 0.45) !important;
  backdrop-filter: blur(10px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal[style*="block"],
#popup-modal[style*="block"],
#activateModal[style*="block"],
#trialModal[style*="block"] {
  display: flex !important;
}

.modal-content,
#modalContent,
#activateModalContent,
#popup-modal .modal-content {
  width: min(100%, 430px) !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 28px 28px 0 0 !important;
  padding: 18px 16px calc(22px + var(--safe-bottom)) !important;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.18) !important;
  text-align: left !important;
  background: #f2f2f7 !important;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(120,120,128,0.18);
  display: grid !important;
  place-items: center;
  color: var(--ios-ink) !important;
  font-weight: 700;
  top: 14px !important;
  right: 14px !important;
}

.modal-title,
#modalContent h2,
#activateModalContent h2 {
  font-size: 1.25rem !important;
  letter-spacing: -0.02em;
  margin: 8px 0 10px !important;
}

.modal-text,
#modalContent p,
#activateModalContent p {
  color: var(--ios-muted) !important;
  line-height: 1.45;
  font-size: 0.95rem !important;
}

.modal-buttons {
  display: grid !important;
  gap: 8px !important;
  margin-top: 14px !important;
}

.modal-buttons a,
.modal-buttons button,
.modal-btn,
.save-csv-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px !important;
  background: var(--ios-blue) !important;
  color: #fff !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border: none !important;
}

.modal-buttons a#modal-buy,
.buy-btn {
  background: rgba(120,120,128,0.16) !important;
  color: var(--ios-ink) !important;
}

/* Progress overlay as agent card */
#progressOverlay {
  background: rgba(242,242,247,0.96) !important;
  backdrop-filter: blur(18px);
  padding: 24px !important;
}

#progressOverlay h3 {
  font-size: 1.2rem !important;
  letter-spacing: -0.02em;
}

#progressOverlay .progress-container,
.progress-container {
  width: 100% !important;
  max-width: 320px;
  height: 12px !important;
  border: none !important;
  background: var(--ios-fill) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  overflow: hidden;
}

/* Error / info cards → agent look */
body.ios-tool .centered-content,
body.ios-tool .input-card {
  max-width: 430px !important;
  border-radius: 22px !important;
  box-shadow: none !important;
}

body.ios-tool .page-title,
body.ios-tool h3 {
  letter-spacing: -0.03em;
}

.info-table,
.csv-table {
  width: 100% !important;
  border-collapse: collapse !important;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
}

.info-table th,
.info-table td,
.csv-table th,
.csv-table td {
  border: none !important;
  border-bottom: 1px solid var(--ios-separator) !important;
  padding: 12px 14px !important;
}

.info-table th { background: transparent !important; color: var(--ios-muted); text-align: left !important; }
.csv-table th { background: #f9f9fb !important; }

/* ===== Add / filter agent panels ===== */
.chat-hero {
  text-align: center;
}

.chat-hero .chat-photo,
.chat-photo {
  width: 84px !important;
  height: 84px !important;
  max-width: 84px !important;
  object-fit: cover;
  border-radius: 22px !important;
  margin: 0 auto 12px !important;
  display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.chat-photo.placeholder {
  background: linear-gradient(145deg, #5ac8fa, var(--ios-blue));
}

.control-sheet .control-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ios-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--ios-blue);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--ios-fill);
  border-radius: 14px;
  padding: 8px;
}

.segmented .seg-label {
  width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ios-muted);
  padding: 0 4px 2px;
}

.segmented .seg-opt {
  flex: 1;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 650;
  font-size: 0.92rem;
}

.segmented .seg-opt input {
  margin-right: 4px;
}

#intervalControls,
#simulationControls {
  text-align: left;
}

#activateSoftware.button-link,
#activateBtn {
  width: 100%;
  border-radius: 14px !important;
  background: var(--ios-blue) !important;
  color: #fff !important;
  border: none !important;
  min-height: 52px;
  font-weight: 700 !important;
}

#accountPopup {
  display: none;
  position: fixed !important;
  inset: 0;
  z-index: 1000;
  background: rgba(15,15,20,0.45) !important;
  backdrop-filter: blur(10px);
  align-items: flex-end;
  justify-content: center;
}

#accountPopup[style*="flex"] {
  display: flex !important;
}

#accountPopup .popup-card,
#accountPopup .modal-content,
#ttLoginPopup .popup-card,
#ttLoginPopup .modal-content {
  width: min(100%, 430px) !important;
  max-height: min(94vh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 28px 28px 0 0 !important;
  background: #f2f2f7 !important;
  padding: 18px 12px calc(22px + var(--safe-bottom)) !important;
  text-align: left !important;
}

/* TikTok QR login page is desktop-width; scale into the mobile sheet */
.tt-qr-embed {
  --tt-qr-w: 450px;
  --tt-qr-h: 560px;
  --tt-qr-scale: 0.84;
  position: relative;
  width: 100%;
  height: calc(var(--tt-qr-h) * var(--tt-qr-scale));
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
}
.tt-qr-embed iframe {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--tt-qr-w);
  height: var(--tt-qr-h);
  border: 0;
  background: #fff;
  transform: translateX(-50%) scale(var(--tt-qr-scale));
  transform-origin: top center;
}
@media (max-width: 390px) {
  .tt-qr-embed {
    --tt-qr-scale: 0.74;
  }
}
@media (max-width: 340px) {
  .tt-qr-embed {
    --tt-qr-scale: 0.68;
  }
}

#telegramLoginWidget {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

#progressOverlay {
  position: relative !important;
  inset: auto !important;
  min-height: auto !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  display: block;
}

#removedLine { display: none; }

.agent-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
