* { box-sizing: border-box; }

:root {
  --bg: #000000;
  --card: #121212;
  --card-hover: #181818;
  --border: #2a2a2a;
  --text: #f4f4f5;
  --muted: #9ca3af;
  --input-bg: #1a1a1a;
  --yt: #ff0a0a;
  --ig-1: #f9ce34;
  --ig-2: #ee2a7b;
  --ig-3: #a259ff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, "Segoe UI", Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 32px 16px 80px;
}

.app {
  max-width: 880px;
  margin: 0 auto;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.logo h1 {
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.02em;
}
.app-header p {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 14px;
}

.main-nav {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  position: sticky;
  top: 12px;
  z-index: 30;
}
.main-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.main-nav-btn:hover { color: var(--text); background: var(--card-hover); }
.main-nav-btn.active {
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.main-nav-btn svg { flex-shrink: 0; }

.view { display: none; }
.view.active { display: block; }

#banner .banner {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
}
.banner.ok { background: #0a2e1c; color: #4ade80; }
.banner.error { background: #2e0a0a; color: #f87171; }

.video-picker {
  background: var(--card);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.15s;
}
.video-picker:hover { border-color: #a259ff; }
.video-picker.dragover { border-color: #a259ff; background: #17101f; }
.video-picker-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.video-picker-empty strong { color: var(--text); font-size: 15px; }
.video-picker-empty span { font-size: 13px; }
.video-picker video {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--card);
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.youtube.active { background: var(--yt); color: #fff; }
.tab-btn.instagram.active {
  background: linear-gradient(90deg, var(--ig-1), var(--ig-2), var(--ig-3));
  color: #fff;
}

.platforms-grid {
  margin-bottom: 20px;
}

.platform-card {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-top: 4px solid transparent;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.platform-card.active { display: block; }
.platform-card.youtube { border-top-color: var(--yt); }
.platform-card.instagram {
  border-image: linear-gradient(90deg, var(--ig-1), var(--ig-2), var(--ig-3)) 1;
}

.platform-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.platform-header h2 {
  font-size: 16px;
  margin: 0;
  flex: 1;
}
.add-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.add-btn:hover { background: var(--card-hover); }

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.accounts-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--input-bg);
  font-size: 14px;
}
.account-row .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.platform-card.youtube .avatar { background: var(--yt); }
.platform-card.instagram .avatar { background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3)); }
.account-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row .remove-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.account-row .remove-btn:hover { color: #f87171; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 4px;
}
input[type="text"], textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
input[type="text"]::placeholder, textarea::placeholder { color: #6b7280; }
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: #a259ff;
  box-shadow: 0 0 0 3px rgba(162, 89, 255, 0.2);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  margin-top: 14px;
}
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #3f3f46;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: left 0.15s;
}
.switch-row input:checked + .switch { background: var(--yt); }
.switch-row input:checked + .switch::after { left: 16px; }

.pool-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 28px;
  border-top: 4px solid transparent;
  border-image: linear-gradient(90deg, #7c3aed, #ec4899) 1;
}
.pool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pool-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pool-title h2 {
  font-size: 19px;
  margin: 0;
}
.pool-master-toggle {
  margin-top: 0;
}
.pool-master-toggle #poolMasterEnabledLabel {
  color: #9ca3af;
}
.pool-master-toggle input:checked ~ #poolMasterEnabledLabel {
  color: var(--yt);
}
.pool-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  transition: filter 0.15s ease;
}
.pool-upload-btn:hover { filter: brightness(1.1); }
.pool-upload-btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.pool-videos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0 24px;
}
@media (max-width: 700px) {
  .pool-videos-grid { grid-template-columns: 1fr; }
}
.pool-videos-col {
  background: var(--input-bg);
  border-radius: 12px;
  padding: 16px;
  border-top: 3px solid transparent;
}
.pool-videos-col.youtube { border-top-color: var(--yt); }
.pool-videos-col.instagram {
  border-image: linear-gradient(90deg, var(--ig-1), var(--ig-2), var(--ig-3)) 1;
}
.pool-videos-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.pool-videos-col-header .livecomment-subtitle { margin: 0; }
.pool-videos-col .pool-upload-btn.small {
  background: var(--card-hover);
  color: var(--text);
  box-shadow: none;
}
.pool-videos-col.youtube .pool-upload-btn.small:hover { background: var(--yt); color: #fff; }
.pool-videos-col.instagram .pool-upload-btn.small:hover {
  background: linear-gradient(90deg, var(--ig-1), var(--ig-2), var(--ig-3));
  color: #fff;
}

.pool-videos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
}
.pool-video {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--input-bg);
  font-size: 12.5px;
  max-width: 220px;
}
.pool-video svg { color: var(--muted); flex-shrink: 0; }
.pool-video-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pool-video-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  margin-left: 2px;
  flex-shrink: 0;
}
.pool-video-remove:hover { color: #f87171; }

.pool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 700px) {
  .pool-grid { grid-template-columns: 1fr; }
}
.pool-accounts-box,
.pool-config-box {
  background: var(--input-bg);
  border-radius: 12px;
  padding: 16px;
}
.pool-accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pool-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card-hover);
  font-size: 13px;
  cursor: pointer;
}
.pool-account-row .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.pool-account-row.youtube .avatar { background: var(--yt); }
.pool-account-row.instagram .avatar { background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3)); }
.pool-account-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-account-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--input-bg);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.pool-config-box label:first-of-type { margin-top: 0; }
.pool-config-box textarea { min-height: 60px; }
#savePoolConfigBtn { margin-top: 12px; }

.pool-log-title { margin-top: 0; }
.pool-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.pool-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--input-bg);
  font-size: 12.5px;
}
.pool-log-row .badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  flex-shrink: 0;
}
.pool-log-row.youtube .badge { background: var(--yt); }
.pool-log-row.instagram .badge { background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3)); }
.pool-log-row.hata { background: #2e0a0a; color: #f87171; }
.pool-log-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-log-time { color: var(--muted); flex-shrink: 0; font-size: 11px; }

.livecomment-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border-top: 4px solid var(--yt);
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 960px) {
  .livecomment-section {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
  }
}
.livecomment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.livecomment-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.livecomment-title h2 {
  font-size: 19px;
  margin: 0;
}
.livecomment-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-top: 18px;
}
@media (max-width: 700px) {
  .livecomment-grid { grid-template-columns: 1fr; }
}
.livecomment-watch,
.livecomment-chat {
  background: var(--input-bg);
  border-radius: 12px;
  padding: 16px;
}
.livecomment-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 10px;
}
.livecomment-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.livecomment-chat-header .livecomment-subtitle { margin: 0; }
.livecomment-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}
.livecomment-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.livecomment-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--card-hover);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.livecomment-account:hover { color: var(--text); }
.livecomment-account.active {
  border-color: var(--yt);
  color: var(--text);
  background: #2a0a0a;
}
.livecomment-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
}
.livecomment-remove:hover { color: #f87171; }
.livecomment-account .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--yt);
  flex-shrink: 0;
}
.livecomment-accounts-empty {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.watch-search { margin-bottom: 12px; }
.watch-search-form {
  display: flex;
  gap: 8px;
}
.watch-search-form input {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
.watch-search-form input:focus {
  outline: none;
  border-color: #a259ff;
  box-shadow: 0 0 0 3px rgba(162, 89, 255, 0.2);
}
.watch-search-form button {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: var(--yt);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.watch-search-form button:disabled { background: #3f3f46; cursor: not-allowed; }
.watch-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.watch-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card-hover);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.watch-search-item:hover { background: var(--input-bg); }
.watch-search-item .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--yt);
  flex-shrink: 0;
}

.live-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
}
.live-video-wrap[hidden] { display: none; }
.live-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.livechat-status {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
.livechat-status.error { color: #f87171; }
.livechat-status.live { color: #4ade80; }
.livechat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 10px;
}
.livechat-messages[hidden] { display: none; }
.livechat-msg {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--card-hover);
}
.livechat-msg .author {
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.livechat-msg.owner .author { color: var(--yt); }
.livechat-msg .text { word-break: break-word; }
.livechat-form {
  display: flex;
  gap: 8px;
}
.livechat-form[hidden] { display: none; }
.livechat-form input {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
.livechat-form input:focus {
  outline: none;
  border-color: #a259ff;
  box-shadow: 0 0 0 3px rgba(162, 89, 255, 0.2);
}
.livechat-form button {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: var(--yt);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.livechat-form button:disabled { background: #3f3f46; cursor: not-allowed; }

#publishBtn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}
#publishBtn:disabled { background: #3f3f46; color: #9ca3af; box-shadow: none; cursor: not-allowed; }

#log {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.log-line {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.log-line-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-name { font-weight: 600; flex: 1; }
.log-status { text-transform: capitalize; opacity: 0.9; }
.log-line .badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  flex-shrink: 0;
}
.log-line.youtube .badge { background: var(--yt); }
.log-line.instagram .badge { background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3)); }
.log-line.yukleniyor { background: #2e2408; color: #fbbf24; }
.log-line.basarili { background: #0a2e1c; color: #4ade80; }
.log-line.hata { background: #2e0a0a; color: #f87171; }
.log-extra { margin-top: 4px; }
.log-extra:empty { display: none; }
.log-line a { color: inherit; font-weight: 600; }

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 10px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  transition: width 0.4s ease;
}
.log-line.youtube .progress-fill {
  background: linear-gradient(90deg, #b30000, var(--yt));
  box-shadow: 0 0 10px rgba(255, 10, 10, 0.6);
}
.log-line.instagram .progress-fill {
  background: linear-gradient(90deg, var(--ig-1), var(--ig-2), var(--ig-3));
  box-shadow: 0 0 10px rgba(238, 42, 123, 0.55);
}
.log-line.basarili .progress-fill { background: #4ade80; box-shadow: 0 0 10px rgba(74, 222, 128, 0.5); }
.log-line.hata .progress-fill { background: #f87171; box-shadow: none; }
.progress-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate-slide 1.1s ease-in-out infinite;
}
@keyframes indeterminate-slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.log-status { position: relative; }
.log-line.yukleniyor .log-status {
  animation: status-pulse 1.4s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(540deg); opacity: 0; }
}
