/* dropit — stylesheet */

:root {
  --bg: #0b0d10;
  --bg-elevated: #14171c;
  --bg-hover: #1b1f26;
  --border: #24282f;
  --border-soft: #1c2026;
  --text: #e8eaed;
  --text-dim: #9aa3ad;
  --text-faint: #6b7280;
  --accent: #7c5cff;
  --accent-hover: #8f74ff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --up: #ff5a3c;
  --down: #4c9aff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }

.muted { color: var(--text-dim); }

/* ------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }

.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #b06cff);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4);
}

.search {
  flex: 1;
  max-width: 460px;
  position: relative;
}
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-faint);
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search input:focus { border-color: var(--accent); background: var(--bg-hover); }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  background: var(--bg-elevated);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(0.98); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }

.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--bg-hover); }

/* ------------------------------------------------------------ layout */

main { max-width: var(--maxw); margin: 0 auto; padding: 22px 20px 80px; }

.layout { display: grid; grid-template-columns: 264px 1fr; gap: 24px; align-items: start; }

.sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.side-card h3 {
  margin: 0;
  padding: 14px 16px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 700;
}
.side-card .side-body { padding: 0 8px 10px; }

.community-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.community-link:hover { background: var(--bg-hover); }
.community-link .dot-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b06cff);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.community-link .cl-name { font-weight: 600; }
.community-link .cl-meta { margin-left: auto; color: var(--text-faint); font-size: 12px; }

/* ------------------------------------------------------------ cards */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ------------------------------------------------------------ feed */

.feed-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.sort-tabs { display: flex; gap: 4px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.sort-tabs .tab {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}
.sort-tabs .tab:hover { color: var(--text); }
.sort-tabs .tab.active { background: var(--accent-soft); color: var(--accent-hover); }

.feed { display: flex; flex-direction: column; gap: 10px; }

.post {
  display: flex;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 12px 10px;
  transition: border-color 0.15s;
}
.post:hover { border-color: #303540; }

.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 34px;
  padding-top: 2px;
}
.vote {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}
.vote:hover { background: var(--bg-hover); }
.vote.up:hover, .vote.up.active { color: var(--up); }
.vote.down:hover, .vote.down.active { color: var(--down); }
.vote-col .score { font-size: 13px; font-weight: 700; }
.vote-col .score.pos { color: var(--up); }
.vote-col .score.neg { color: var(--down); }

.post-body { flex: 1; min-width: 0; }

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.post-meta a { font-weight: 600; color: var(--text); }
.post-meta a:hover { color: var(--accent-hover); }
.post-meta .dot { color: var(--text-faint); }

.post-title {
  display: block;
  margin: 7px 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.post-title:hover { color: var(--accent-hover); }

.post-text { margin: 4px 0 6px; color: var(--text-dim); font-size: 14px; }

.post-link {
  display: inline-block;
  margin: 4px 0 6px;
  font-size: 13px;
  color: var(--accent-hover);
  word-break: break-all;
}

.post-actions { display: flex; gap: 14px; margin-top: 8px; }
.action {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
}
.action:hover { background: var(--bg-hover); color: var(--text); }

/* ------------------------------------------------------------ community banner */

.community-banner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, 0.22), transparent 60%),
    var(--bg-elevated);
}
.community-banner h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.community-banner p { margin: 2px 0; }
.community-banner-info { min-width: 0; }

/* ------------------------------------------------------------ comments */

.comment-box { margin-top: 20px; }
.comment-box h3, .section-title { font-size: 16px; margin: 0 0 14px; }

.comment-form textarea,
.form-card textarea,
.form-card input,
.form-card select,
.inline-reply textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}
.comment-form textarea:focus, .form-card textarea:focus, .form-card input:focus,
.form-card select:focus, .inline-reply textarea:focus { border-color: var(--accent); }

.comment-form, .inline-reply { margin-bottom: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

.comment { display: flex; gap: 10px; margin-top: 12px; }

.comment-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 26px;
  padding-top: 2px;
}
.comment-vote .score { font-size: 12px; font-weight: 700; }

.comment-main {
  flex: 1;
  min-width: 0;
  border-left: 2px solid var(--border-soft);
  padding-left: 12px;
}
.comment-meta { font-size: 12.5px; color: var(--text-dim); }
.comment-meta a { font-weight: 600; color: var(--text); }
.comment-text { margin: 3px 0 4px; white-space: pre-wrap; word-wrap: break-word; }
.reply-btn { padding: 2px 6px; }
.inline-reply { margin: 10px 0 4px; }

/* ------------------------------------------------------------ forms */

.form-card { max-width: 640px; }
.form-card h1 { margin: 0 0 18px; font-size: 22px; letter-spacing: -0.02em; }
.form-card label {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.form-card label input,
.form-card label select,
.form-card label textarea { margin-top: 6px; font-weight: 400; color: var(--text); }

/* ------------------------------------------------------------ profile */

.profile-card { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-card h1 { margin: 0 0 2px; font-size: 22px; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--bg-hover); }
.avatar.sm { width: 26px; height: 26px; }
.avatar.md { width: 40px; height: 40px; }
.avatar.lg { width: 72px; height: 72px; }

/* ------------------------------------------------------------ user chip */

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip a {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.user-chip a:hover { background: var(--bg-hover); }

/* ------------------------------------------------------------ communities grid */

.community-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.community-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s, transform 0.08s;
}
.community-card:hover { border-color: #303540; transform: translateY(-1px); }
.community-card h3 { margin: 0 0 4px; font-size: 16px; }
.community-card p { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); }

/* ------------------------------------------------------------ misc */

.empty, .skeleton {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.signin-hint {
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: #22262e;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hide-sm { display: none; }
  .brand-name { display: none; }
  main { padding: 16px 14px 70px; }
  .post-title { font-size: 16px; }
  .community-banner { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------------- auth pages */

.auth-card { max-width: 440px; }
.auth-lead { margin: -10px 0 20px; font-size: 14px; line-height: 1.5; }
.auth-card button[type="submit"] { width: 100%; margin-top: 6px; }
.auth-card input { width: 100%; }
.auth-switch { margin: 16px 0 0; font-size: 14px; }
.auth-switch a, .signin-hint a { color: var(--accent); font-weight: 600; }
.auth-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- bottom nav */

body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: rgba(20, 23, 28, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item span { line-height: 1; }
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--text); }
.nav-item.active svg { stroke: var(--accent); }

.nav-item.nav-create svg {
  width: 19px;
  height: 19px;
  padding: 6px;
  box-sizing: content-box;
  stroke-width: 2.6;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
}
.nav-item.nav-create:hover svg,
.nav-item.nav-create.active svg { stroke: #fff; }

@media (min-width: 900px) {
  body { padding-bottom: 104px; }
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 18px;
    width: min(520px, calc(100% - 48px));
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow);
  }
  .nav-item { border-radius: 999px; }
}
