/* AutoPoster — X/Twitter benzeri arayüz */
:root {
  --bg: #000;
  --bg-elev: #16181c;
  --bg-hover: #080808;
  --border: #2f3336;
  --text: #e7e9ea;
  --muted: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --like: #f91880;
  --repost: #00ba7c;
  --danger: #f4212e;
  --radius: 16px;
  --col-nav: 275px;
  --col-main: 600px;
  --col-side: 350px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fff;
    --bg-elev: #f7f9f9;
    --bg-hover: #f7f7f7;
    --border: #eff3f4;
    --text: #0f1419;
    --muted: #536471;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { fill: currentColor; stroke: none; }

/* ---------------- düzen ---------------- */
.app {
  display: grid;
  grid-template-columns: var(--col-nav) minmax(0, var(--col-main)) var(--col-side);
  justify-content: center;
  gap: 0;
  max-width: 1265px;
  margin: 0 auto;
}

/* ---------------- sol nav ---------------- */
.nav { position: sticky; top: 0; height: 100dvh; }
.nav-inner {
  display: flex; flex-direction: column; gap: 4px;
  height: 100%; padding: 4px 8px 16px; align-items: flex-start;
}
.logo { padding: 12px; border-radius: 999px; }
.logo:hover { background: var(--bg-elev); }
.logo svg { width: 30px; height: 30px; }
.nav nav { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }
.nav-item {
  display: flex; align-items: center; gap: 18px;
  padding: 12px; margin: 2px 0; border-radius: 999px;
  font-size: 20px; transition: background .15s;
}
.nav-item:hover { background: var(--bg-elev); }
.nav-item svg { width: 26px; height: 26px; flex: none; }
.nav-item.active { font-weight: 700; }
.btn-post {
  margin-top: 16px; width: 90%;
  background: var(--accent); color: #fff; border: 0;
  border-radius: 999px; padding: 15px 0; font-size: 17px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.btn-post:hover:not(:disabled) { background: var(--accent-hover); }
.btn-post:disabled { opacity: .5; cursor: default; }
.nav-me { margin-top: auto; width: 100%; }
.nav-me .me-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 999px; cursor: pointer;
}
.nav-me .me-card:hover { background: var(--bg-elev); }
.nav-me .avatar { width: 40px; height: 40px; }

/* ---------------- orta sütun ---------------- */
.main {
  border-inline: 1px solid var(--border);
  min-height: 100dvh;
  min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px; min-height: 53px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .sub { font-size: 13px; color: var(--muted); }
.back-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 0; background: none; cursor: pointer; }
.back-btn:hover { background: var(--bg-elev); }
.back-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button {
  flex: 1; background: none; border: 0; padding: 16px 0; cursor: pointer;
  color: var(--muted); font-weight: 600; position: relative;
}
.tabs button:hover { background: var(--bg-elev); }
.tabs button.active { color: var(--text); font-weight: 700; }
.tabs button.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 56px; height: 4px; border-radius: 999px; background: var(--accent);
}

/* ---------------- composer ---------------- */
.composer {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.composer-body { flex: 1; min-width: 0; }
.composer-text {
  width: 100%; border: 0; outline: 0; resize: none; overflow: hidden;
  background: transparent; color: var(--text);
  font-family: inherit; font-size: 20px; line-height: 1.4;
  padding: 12px 0; min-height: 52px;
}
.composer-text::placeholder { color: var(--muted); }
.reply-hint { color: var(--muted); font-size: 14px; padding-top: 12px; }
.reply-hint b { color: var(--accent); font-weight: 400; }
.composer-media { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin: 8px 0; }
.composer-media:has(> :only-child) { grid-template-columns: 1fr; }
.composer-media figure { position: relative; margin: 0; }
.composer-media img {
  width: 100%; max-height: 320px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border); display: block;
}
.composer-media button {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border: 0; border-radius: 999px; background: rgba(0,0,0,.7); color: #fff; cursor: pointer;
}
.composer-media button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.composer-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px;
}
.composer-tools { display: flex; gap: 2px; }
.composer-actions { display: flex; align-items: center; gap: 12px; }
.composer .btn-post { width: auto; margin: 0; padding: 9px 18px; font-size: 15px; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; background: none; border-radius: 999px; cursor: pointer;
}
.icon-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.icon-btn.accent { color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.counter { position: relative; display: grid; place-items: center; width: 30px; height: 30px; }
.counter .ring { width: 26px; height: 26px; transform: rotate(-90deg); fill: none; }
.ring-bg { stroke: var(--border); stroke-width: 2.5; }
.ring-fg {
  stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 62.83; stroke-dashoffset: 62.83; transition: stroke-dashoffset .2s, stroke .2s;
}
.counter.warn .ring-fg { stroke: #ffd400; }
.counter.over .ring-fg { stroke: var(--danger); }
.counter-num { position: absolute; font-size: 11px; color: var(--muted); }
.counter:not(.warn):not(.over) .counter-num { display: none; }
.counter.over .counter-num { color: var(--danger); }

/* ---------------- post ---------------- */
.post {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s;
}
.post:hover { background: var(--bg-hover); }
.post-col { flex: none; display: flex; flex-direction: column; align-items: center; }
.thread-line { width: 2px; flex: 1; background: var(--border); margin: 4px 0 -12px; border-radius: 2px; }
.avatar {
  width: 40px; height: 40px; border-radius: 999px; object-fit: cover;
  background: var(--bg-elev); flex: none; display: block;
}
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 4px; font-size: 15px; white-space: nowrap; }
.post-head .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.post-head .name:hover { text-decoration: underline; }
.post-head .handle, .post-head .dot, .post-head time { color: var(--muted); }
.post-head time:hover { text-decoration: underline; }
.post-head .spacer { flex: 1; }
.badge { width: 18px; height: 18px; color: var(--accent); flex: none; }
.repost-label {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: 13px; font-weight: 700; padding-left: 28px; margin-bottom: 2px;
}
.repost-label svg { width: 16px; height: 16px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 0; font-size: 15px; }
.post-text a { color: var(--accent); }
.post-text a:hover { text-decoration: underline; }
.post-media { display: grid; gap: 2px; margin-top: 12px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post-media.n1 { grid-template-columns: 1fr; }
.post-media.n2 { grid-template-columns: 1fr 1fr; }
.post-media.n3 { grid-template-columns: 1fr 1fr; }
.post-media.n3 img:first-child { grid-row: span 2; height: 100%; }
.post-media.n4 { grid-template-columns: 1fr 1fr; }
.post-media img { width: 100%; height: 100%; max-height: 510px; object-fit: cover; display: block; }
.post-media.n2 img, .post-media.n3 img, .post-media.n4 img { aspect-ratio: 1.1; }

.actions { display: flex; justify-content: space-between; max-width: 425px; margin-top: 12px; color: var(--muted); }
.action { display: flex; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; color: inherit; padding: 0; font-size: 13px; }
.action .hit { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; margin: -8px; transition: background .15s, color .15s; }
.action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action:hover { color: var(--accent); }
.action:hover .hit { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.action.like:hover, .action.like.on { color: var(--like); }
.action.like:hover .hit { background: color-mix(in srgb, var(--like) 12%, transparent); }
.action.like.on svg { fill: var(--like); stroke: var(--like); }
.action.repost:hover, .action.repost.on { color: var(--repost); }
.action.repost:hover .hit { background: color-mix(in srgb, var(--repost) 12%, transparent); }
.action.bookmark.on svg { fill: var(--accent); stroke: var(--accent); }
.action.bookmark.on { color: var(--accent); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
.action.pop svg { animation: pop .35s ease; }

/* ---------------- post detay ---------------- */
.post.detail { display: block; cursor: default; }
.post.detail:hover { background: none; }
.detail-head { display: flex; gap: 12px; align-items: center; }
.detail-head .who { min-width: 0; }
.detail-head .name { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.detail-head .handle { color: var(--muted); }
.post.detail .post-text { font-size: 23px; line-height: 1.3; margin-top: 12px; }
.detail-meta { color: var(--muted); font-size: 15px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.detail-stats { display: flex; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.detail-stats b { color: var(--text); }
.post.detail .actions { max-width: none; padding: 4px 0; margin-top: 4px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
  font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px;
}

/* ---------------- profil ---------------- */
.banner { height: 200px; background: var(--bg-elev); object-fit: cover; width: 100%; display: block; }
.profile-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.profile-head .avatar-lg {
  width: 133px; height: 133px; border-radius: 999px; border: 4px solid var(--bg);
  margin-top: -80px; object-fit: cover; background: var(--bg-elev);
}
.profile-head h2 { margin: 8px 0 0; font-size: 20px; display: flex; align-items: center; gap: 4px; }
.profile-head .handle { color: var(--muted); }
.profile-head .bio { margin: 12px 0; white-space: pre-wrap; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 15px; }
.profile-meta svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }

/* ---------------- sağ sütun ---------------- */
.side { padding: 0 0 24px 24px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.side::-webkit-scrollbar { width: 0; }
.search {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  background: var(--bg); padding: 6px 0;
}
.search svg { width: 18px; height: 18px; color: var(--muted); position: absolute; left: 16px; }
.search input {
  width: 100%; border-radius: 999px; border: 1px solid transparent; background: var(--bg-elev);
  padding: 11px 12px 11px 44px; color: var(--text); outline: 0;
}
.search input:focus { background: var(--bg); border-color: var(--accent); }
.card { background: var(--bg-elev); border-radius: var(--radius); margin-top: 16px; overflow: hidden; }
.card h2 { font-size: 20px; margin: 0; padding: 12px 16px; }
.trend { padding: 10px 16px; cursor: pointer; }
.trend:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.trend .k { font-size: 13px; color: var(--muted); }
.trend .t { font-weight: 700; }
.target-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.pill { font-size: 12px; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--border); color: var(--muted); }
.pill.on { color: var(--repost); border-color: color-mix(in srgb, var(--repost) 50%, transparent); }
.side-footer { color: var(--muted); font-size: 13px; padding: 16px; }

/* ---------------- ortak ---------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.spinner { margin: 40px auto; width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 999px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-title { padding: 12px 16px; font-size: 20px; font-weight: 800; border-bottom: 1px solid var(--border); }

/* ---------------- modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 5vh; }
.modal[hidden], .toast[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(91,112,131,.4); }
.modal-box {
  position: relative; width: min(600px, 94vw); background: var(--bg);
  border-radius: var(--radius); box-shadow: 0 0 24px rgba(0,0,0,.5); overflow: hidden;
}
.modal-head { padding: 8px; }
.modal-box .composer { border-bottom: 0; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: 12px 20px; border-radius: 6px;
  z-index: 200; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.toast.err { background: var(--danger); }

/* ---------------- mobil ---------------- */
.tabbar, .fab { display: none; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 88px minmax(0, 600px); }
  .side { display: none; }
  .nav-item span, .btn-post, .nav-me .meta { display: none; }
  .nav-inner { align-items: center; }
  .nav-item { justify-content: center; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { display: none; }
  .main { border: 0; padding-bottom: 64px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    justify-content: space-around; padding: 10px 0 max(10px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  }
  .tabbar svg { width: 26px; height: 26px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: 76px; z-index: 51;
    width: 56px; height: 56px; border-radius: 999px; border: 0;
    background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4);
  }
  .fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .banner { height: 130px; }
  .profile-head .avatar-lg { width: 90px; height: 90px; margin-top: -50px; }
}
