@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: rgba(22, 27, 34, 0.95);
  --panel-strong: #161b22;
  --card: #1c2128;
  --border: rgba(139, 148, 158, 0.16);
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --accent-glow: rgba(88, 166, 255, 0.06);
  --warn: #d29922;
  --error: #f85149;
  --success: #3fb950;
  --column-width: 380px;
  --header-height: 56px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.is-viewer-open {
  overflow: hidden;
}

/* ─── HEADER ─── */

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 10;
  position: relative;
}

.deck-header-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.deck-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.deck-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  vertical-align: middle;
}

.deck-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.deck-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.deck-meta-label {
  color: var(--muted);
}

.hub-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  margin-left: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.hub-back-link:hover {
  background: rgba(88, 166, 255, 0.22);
  border-color: var(--accent);
}

/* ─── DECK CONTAINER ─── */

.deck-container {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--header-height));
  overflow-x: auto;
  overflow-y: hidden;
  /* proximity: kaydirinca yumusak snap olur ama yeniden boyutlandirmada
     (orn. Yayin tezgahinda iframe kuculurken) tarayici zorla sutuna
     yeniden hizalayip soldaki sutunlari kaydirmaz. */
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}

.deck-container::-webkit-scrollbar {
  height: 6px;
}

.deck-container::-webkit-scrollbar-track {
  background: var(--bg);
}

.deck-container::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.3);
  border-radius: 3px;
}

/* ─── COLUMN ─── */

.deck-column {
  flex: 0 0 var(--column-width);
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border);
  scroll-snap-align: start;
  background: var(--panel-strong);
}

.deck-column:last-child {
  border-right: none;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}

.column-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.column-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

.column-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: var(--header-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: background 150ms ease;
}

.column-title:hover {
  background: rgba(255, 255, 255, 0.1);
}

.column-rename-form {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  height: var(--header-height);
}

.column-title-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 0 4px;
  width: 100%;
  max-width: 150px;
  outline: none;
}

.column-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.column-status-panel {
  padding: 7px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.column-status-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.column-status-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.column-status-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.column-next-attempt,
.column-next-prune {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.column-status-separator {
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 auto;
}

.column-status-note,
.column-error-text {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.column-status-note {
  color: var(--muted);
}

.column-error-text {
  color: var(--error);
}

.column-remove-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.column-remove-btn:hover {
  color: var(--error);
  background: rgba(248, 81, 73, 0.1);
}

.column-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(139, 148, 158, 0.14);
  color: var(--muted);
}

.column-chip-live {
  background: rgba(63, 185, 80, 0.14);
  color: var(--success);
}

.column-chip-degraded {
  background: rgba(210, 153, 34, 0.14);
  color: var(--warn);
}

.column-chip-error {
  background: rgba(248, 81, 73, 0.14);
  color: var(--error);
}

.column-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.column-body::-webkit-scrollbar {
  width: 5px;
}

.column-body::-webkit-scrollbar-track {
  background: transparent;
}

.column-body::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.2);
  border-radius: 3px;
}

.column-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  background: var(--panel);
}

/* ─── DRAG AND DROP STATES ─── */

.deck-column.is-dragging {
  opacity: 0.4;
  background: var(--bg);
}

.deck-column.drag-over {
  border-left: 2px dashed var(--accent);
  background: rgba(88, 166, 255, 0.05);
}

/* ─── ADD COLUMN CARD ─── */

.add-column-card {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  border-left: 1px solid var(--border);
  scroll-snap-align: start;
}

.add-column-inner {
  background: var(--panel);
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: border-color 150ms ease;
}

.add-column-inner:hover {
  border-color: var(--accent);
}

.add-column-inner .column-icon {
  margin: 0 auto 16px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 20px;
}

.add-column-inner h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.add-column-inner p {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
}

#add-list-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 150ms ease;
}

#add-list-form input:focus {
  border-color: var(--accent);
}

#add-list-form button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 150ms ease, opacity 150ms ease;
}

#add-list-form button:hover {
  background: #4096ff;
}

#add-list-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── FEED CARDS ─── */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.feed-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid transparent;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.feed-card:hover {
  border-color: var(--border);
}

.feed-card.is-new {
  border-color: rgba(88, 166, 255, 0.28);
  box-shadow: 0 0 0 2px var(--accent-glow);
  animation: card-in 400ms ease;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feed-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.feed-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  flex: 0 0 auto;
}

.feed-avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.feed-author {
  min-width: 0;
  flex: 1;
}

.feed-author strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-author span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-time-inline {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.feed-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.feed-preview-button {
  position: relative;
  display: block;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  width: 100%;
}

.feed-preview {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  max-height: 200px;
}

.feed-preview-button:hover .feed-preview-hint,
.feed-preview-button:focus-visible .feed-preview-hint {
  opacity: 1;
  transform: translateY(0);
}

.feed-preview-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.feed-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.new-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.feed-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.feed-link:hover {
  text-decoration: underline;
}

/* ─── MEDIA VIEWER ─── */

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
}

.media-viewer-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 32px));
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.media-viewer-stage {
  position: relative;
}

.media-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease;
}

.media-viewer-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.media-viewer-image,
.media-viewer-video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 160px);
  border-radius: var(--radius);
  background: #000;
}

.media-viewer-image {
  object-fit: contain;
}

.media-viewer-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms ease;
}

.media-viewer-play:hover {
  background: rgba(0, 0, 0, 0.92);
}

.media-viewer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-right: 44px;
  color: var(--muted);
  font-size: 13px;
}

/* ─── LOAD MORE ─── */

.load-more-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.load-more-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ─── RESPONSIVE ─── */

@media (max-width: 640px) {
  :root {
    --column-width: calc(100vw - 16px);
  }

  .deck-subtitle {
    display: none;
  }

  .media-viewer-dialog {
    width: calc(100vw - 16px);
    padding: 10px;
  }

  .media-viewer-meta {
    flex-direction: column;
    align-items: start;
    padding-right: 0;
  }
}


:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-strong: #ffffff;
  --card: #ffffff;
  --border: rgba(208, 215, 222, 0.8);
  --text: #1F2328;
  --muted: #656d76;
  --accent: #0969da;
  --accent-soft: rgba(9, 105, 218, 0.12);
  --accent-glow: rgba(9, 105, 218, 0.08);
  --warn: #9a6700;
  --error: #cf222e;
  --success: #1a7f37;
  --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}

.theme-toggle-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 150ms ease;
  margin-left: 8px;
}

.theme-toggle-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
