/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --border:   #2e2e2e;
  --rage:     #e53e3e;
  --text:     #e8e8e8;
  --muted:    #888;
  --ok:       #38a169;
  --warn:     #d69e2e;
  --radius:   8px;
  --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--rage); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* ===== Header ===== */
.site-header { background: #000; border-bottom: 2px solid var(--rage); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }

.logo { font-size: 1.25rem; font-weight: 900; color: #fff; letter-spacing: -0.5px; white-space: nowrap; flex-shrink: 0; }
.logo span { color: var(--rage); }
.logo .tld { color: var(--muted); font-weight: 400; font-size: 0.9rem; }

.nav-search { display: flex; flex: 1; max-width: 280px; min-width: 0; }
.nav-search input[type="search"] { flex: 1; min-width: 0; background: #1a1a1a; border: 1px solid #333; border-right: none; color: #fff; border-radius: 4px 0 0 4px; padding: 6px 10px; font-size: 0.82rem; font-family: var(--font); width: auto; }
.nav-search input[type="search"]:focus { outline: none; border-color: var(--rage); }
.nav-search button { background: var(--rage); border: none; padding: 6px 10px; border-radius: 0 4px 4px 0; cursor: pointer; font-size: 0.9rem; flex-shrink: 0; }

nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.nav-link { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-user { color: var(--muted); font-size: 0.82rem; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* ===== Buttons ===== */
.btn { display: inline-block; padding: 9px 18px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; text-decoration: none; line-height: 1.2; touch-action: manipulation; }
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-rage    { background: var(--rage); color: #fff; }
.btn-sm      { padding: 6px 12px; font-size: 0.8rem; }
.btn-xs      { padding: 4px 9px; font-size: 0.75rem; }
.btn-lg      { padding: 13px 28px; font-size: 1rem; }
.btn-full    { width: 100%; text-align: center; display: block; }
.btn-approve { background: var(--ok);   color: #fff; }
.btn-reject  { background: var(--warn); color: #000; }
.btn-delete  { background: var(--rage); color: #fff; }
.btn-back    { display: inline-block; margin-top: 24px; color: var(--muted); font-size: 0.9rem; }

/* ===== Main ===== */
main.container { padding-top: 28px; padding-bottom: 48px; flex: 1; }

/* ===== Hero ===== */
.page-hero { text-align: center; padding: 40px 16px 32px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.page-hero h1 { font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 900; line-height: 1.2; margin-bottom: 10px; color: #fff; }
.page-hero p  { color: var(--muted); margin-bottom: 22px; font-size: 1rem; }

/* ===== Ad slots ===== */
.ad-slot { min-height: 60px; margin: 16px 0; text-align: center; }
.ad-slot:empty { display: none; }

/* ===== Feed controls ===== */
.feed-controls { margin-bottom: 20px; }
.sort-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.sort-tab { padding: 7px 16px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); background: var(--surface); touch-action: manipulation; }
.sort-tab:hover, .sort-tab.active { background: var(--rage); border-color: var(--rage); color: #fff; text-decoration: none; }

/* ===== Filter bar ===== */
.filter-bar { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-pill { padding: 5px 13px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; touch-action: manipulation; }
.filter-pill:hover, .filter-pill.active { background: var(--rage); border-color: var(--rage); color: #fff; text-decoration: none; }

/* ===== Post Grid ===== */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
.post-card:hover { border-color: var(--rage); transform: translateY(-2px); text-decoration: none; }
.card-img { width: 100%; height: 200px; background-size: cover; background-position: center; background-color: #222; flex-shrink: 0; }
.card-img--none { display: flex; align-items: center; justify-content: center; font-size: 3rem; height: 120px; }
.card-body    { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-top-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card-title   { font-size: 0.95rem; font-weight: 700; color: #fff; line-height: 1.3; }
.card-excerpt { font-size: 0.83rem; color: var(--muted); line-height: 1.5; flex: 1; }
.card-meta    { font-size: 0.73rem; color: #666; margin-top: auto; }
.card-score   { font-size: 0.75rem; font-weight: 700; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.score-up     { color: var(--ok); }
.score-down   { color: var(--rage); }

/* ===== Badge ===== */
.badge { display: inline-block; background: rgba(229,62,62,0.15); color: var(--rage); border: 1px solid rgba(229,62,62,0.3); padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.badge-lg      { font-size: 0.78rem; padding: 4px 10px; }
.badge-pending { background: rgba(214,158,46,0.15); color: var(--warn); border-color: rgba(214,158,46,0.3); }
.badge-count   { background: var(--rage); color: #fff; border-radius: 10px; padding: 1px 6px; font-size: 0.7rem; font-weight: 700; margin-left: 4px; }

/* ===== Single Post ===== */
.single-post   { max-width: 780px; margin: 0 auto; }
.post-badges   { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.post-header   { margin-bottom: 24px; }
.post-header h1 { font-size: clamp(1.4rem, 4vw, 2.4rem); font-weight: 900; color: #fff; margin: 10px 0 8px; line-height: 1.25; }
.post-meta     { color: var(--muted); font-size: 0.88rem; }
.post-gallery  { margin-bottom: 24px; }
.gallery-single .gallery-item { display: block; border-radius: var(--radius); overflow: hidden; }
.gallery-single .gallery-item img { width: 100%; max-height: 560px; object-fit: contain; background: #000; display: block; }
.post-rant { font-size: 1.05rem; line-height: 1.8; color: #ccc; margin-bottom: 28px; white-space: pre-wrap; word-break: break-word; }

/* ===== Vote Widget ===== */
.vote-widget { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.vote-btn { display: flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius); font-size: 1rem; font-weight: 700; cursor: pointer; border: 2px solid var(--border); background: transparent; color: var(--muted); transition: all 0.15s; min-width: 64px; justify-content: center; touch-action: manipulation; }
.vote-btn--up:hover   { border-color: var(--ok);   color: var(--ok); }
.vote-btn--down:hover { border-color: var(--rage);  color: var(--rage); }
.vote-btn--up.active   { border-color: var(--ok);   color: var(--ok);   background: rgba(56,161,105,0.1); }
.vote-btn--down.active { border-color: var(--rage);  color: var(--rage);  background: rgba(229,62,62,0.1); }
.vote-score { font-size: 1.1rem; font-weight: 900; color: var(--muted); min-width: 36px; text-align: center; }
.vote-login-hint { font-size: 0.8rem; color: var(--muted); }

/* ===== Share bar ===== */
.share-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.share-label { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.share-btn { padding: 5px 12px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; border: 1px solid var(--border); color: var(--muted); background: transparent; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.share-btn:hover { background: var(--rage); border-color: var(--rage); color: #fff; text-decoration: none; }
.share-copy.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ===== Report section ===== */
.report-section { margin-bottom: 20px; }
.report-toggle { background: none; border: none; color: var(--muted); font-size: 0.82rem; cursor: pointer; padding: 0; text-decoration: underline; }
.report-toggle:hover { color: var(--rage); }
.report-form { display: none; margin-top: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.report-form.visible { display: block; }
.report-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.report-form textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 4px; padding: 8px; font-family: var(--font); font-size: 0.9rem; width: 100%; resize: vertical; }
.report-form-actions { display: flex; gap: 8px; }
.report-done { font-size: 0.82rem; color: var(--muted); }

/* ===== Admin actions ===== */
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }

/* ===== Bulk controls ===== */
.bulk-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.bulk-select-all { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.bulk-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--rage); flex-shrink: 0; margin-right: 8px; }

/* ===== Auth Pages ===== */
.auth-wrap { max-width: 420px; margin: 0 auto; padding-top: 16px; }
.auth-wrap h1 { margin-bottom: 8px; color: #fff; }
.auth-wrap > p { color: var(--muted); margin-bottom: 20px; }
.auth-alt { margin-top: 18px; font-size: 0.88rem; color: var(--muted); text-align: center; }
.forgot-link { text-align: right; margin-top: -4px; font-size: 0.82rem; }
.auth-form, .submit-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label, .submit-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--muted); font-weight: 500; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 1rem; font-family: var(--font); padding: 11px 14px; width: 100%; transition: border-color 0.15s; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rage); }
textarea { resize: vertical; min-height: 160px; }

/* ===== File Upload ===== */
.file-label { cursor: pointer; }
input[type="file"] { padding: 8px 0; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; }
.file-hint { font-size: 0.75rem; color: #555; }
.preview-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.preview-row img { width: 88px; height: 88px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* ===== Submit Page ===== */
.submit-wrap { max-width: 680px; margin: 0 auto; }
.submit-wrap h1 { margin-bottom: 8px; color: #fff; }
.submit-note { color: var(--muted); margin-bottom: 24px; font-size: 0.88rem; }

/* ===== Search Page ===== */
.search-page { max-width: 900px; margin: 0 auto; }
.search-page h1 { color: #fff; margin-bottom: 20px; }
.search-form-lg { display: flex; gap: 10px; margin-bottom: 24px; }
.search-form-lg input { flex: 1; }
.search-form-lg .btn { flex-shrink: 0; }

/* ===== Profile Page ===== */
.profile-page { max-width: 900px; margin: 0 auto; }
.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.profile-avatar { font-size: 4rem; line-height: 1; }
.profile-header h1 { color: #fff; font-size: 1.8rem; }
.profile-meta { color: var(--muted); font-size: 0.88rem; }
.profile-stats { margin-bottom: 28px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ===== Legal Pages ===== */
.legal-page { max-width: 720px; margin: 0 auto; }
.legal-page h1 { color: #fff; margin-bottom: 6px; }
.legal-updated { color: var(--muted); font-size: 0.85rem; margin-bottom: 28px; }
.legal-page h2 { color: #fff; font-size: 1.1rem; margin: 24px 0 8px; }
.legal-page p, .legal-page li { color: #bbb; margin-bottom: 8px; line-height: 1.7; }
.legal-page ul { padding-left: 20px; margin-bottom: 12px; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.88rem; line-height: 1.5; }
.alert-error   { background: rgba(229,62,62,0.12); border: 1px solid rgba(229,62,62,0.35); color: #fc8181; }
.alert-success { background: rgba(56,161,105,0.12); border: 1px solid rgba(56,161,105,0.35); color: #68d391; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 32px; justify-content: center; }
.pagination a { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; color: var(--muted); }
.pagination a.active, .pagination a:hover { background: var(--rage); border-color: var(--rage); color: #fff; text-decoration: none; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 12px; min-width: 520px; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.status-approved { color: var(--ok);   font-weight: 600; }
.status-pending  { color: var(--warn); font-weight: 600; }
.status-rejected { color: var(--rage); font-weight: 600; }

/* ===== My Rants ===== */
.my-rants { max-width: 900px; margin: 0 auto; }
.my-rants h1 { margin-bottom: 20px; color: #fff; }

/* ===== Admin Dashboard ===== */
.admin-dashboard { padding-top: 4px; }
.admin-dashboard h1 { color: #fff; margin-bottom: 18px; }
.admin-dashboard h2 { color: #fff; margin: 24px 0 14px; font-size: 1.15rem; }
.admin-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-nav .btn-sm { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.admin-nav .btn-sm.active, .admin-nav .btn-sm:hover { background: var(--rage); border-color: var(--rage); color: #fff; text-decoration: none; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; text-align: center; min-width: 90px; flex: 1; }
.stat-card.stat-warn { border-color: rgba(214,158,46,0.4); }
.stat-card.stat-ok   { border-color: rgba(56,161,105,0.4); }
.stat-card.stat-bad  { border-color: rgba(229,62,62,0.3); }
.stat-num { font-size: 1.8rem; font-weight: 900; color: #fff; line-height: 1; margin-bottom: 4px; }
.stat-card div:last-child { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Mod Queue ===== */
.mod-queue { display: flex; flex-direction: column; gap: 14px; }
.mod-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: flex-start; gap: 12px; padding: 14px; }
.mod-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.mod-body { flex: 1; min-width: 0; }
.mod-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.mod-body h3 { font-size: 0.95rem; margin-bottom: 4px; }
.mod-body h3 a { color: #fff; }
.mod-body p { font-size: 0.82rem; color: var(--muted); }
.mod-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 5px; }
.mod-actions form { display: flex; flex-direction: column; gap: 5px; }

/* ===== Analytics charts ===== */
.analytics-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-block h2 { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.bar-chart { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: 0.72rem; color: var(--muted); width: 44px; text-align: right; flex-shrink: 0; white-space: nowrap; }
.bar-track { flex: 1; background: #222; border-radius: 3px; height: 18px; overflow: hidden; }
.bar-fill { background: var(--rage); height: 100%; border-radius: 3px; display: flex; align-items: center; padding: 0 5px; min-width: 4px; }
.bar-fill--ok { background: var(--ok); }
.bar-fill span { font-size: 0.68rem; color: #fff; white-space: nowrap; }

/* ===== Search bar (admin) ===== */
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.search-bar input { flex: 1; min-width: 160px; }
.search-bar select { width: auto; }
.record-count { color: var(--muted); font-size: 0.83rem; margin-bottom: 6px; }
.empty-state { color: var(--muted); text-align: center; padding: 48px 0; font-size: 1rem; }

/* ===== Footer ===== */
.site-footer { background: #000; border-top: 1px solid var(--border); padding: 20px 0; margin-top: auto; }
.site-footer p { font-size: 0.78rem; color: #555; text-align: center; line-height: 1.7; }
.site-footer a { color: #666; }
.footer-links { margin-top: 4px; }

/* ===== Responsive: tablet ===== */
@media (max-width: 768px) {
  .analytics-charts { grid-template-columns: 1fr; }
  .vote-widget { flex-wrap: wrap; }
  .nav-search { max-width: 200px; }
}

/* ===== Responsive: mobile ===== */
@media (max-width: 600px) {
  .header-inner { gap: 6px; padding: 11px 12px; flex-wrap: wrap; align-items: center; }
  .logo { font-size: 1.1rem; flex-shrink: 0; }
  .logo .tld { display: none; }
  .nav-search { order: 3; flex: 0 0 100%; width: 100%; max-width: none; margin-top: 4px; }
  .nav-search input[type="search"] { padding-top: 9px; padding-bottom: 9px; font-size: 0.88rem; }
  .nav-search button { padding-top: 9px; padding-bottom: 9px; }
  nav { gap: 8px; margin-left: auto; flex-wrap: nowrap; }
  .nav-user { display: none; }

  main.container { padding-top: 20px; padding-bottom: 32px; }
  .page-hero { padding: 24px 8px 20px; }
  .post-grid { grid-template-columns: 1fr; }
  .card-img { height: 180px; }

  .single-post { padding: 0; }
  .post-header h1 { font-size: 1.4rem; }
  .gallery-single .gallery-item img { max-height: 300px; }

  .vote-widget { gap: 8px; padding: 12px; }
  .vote-btn { padding: 9px 14px; font-size: 0.9rem; min-width: 54px; }

  .share-bar { gap: 6px; }
  .share-btn { padding: 4px 8px; font-size: 0.72rem; }

  .mod-card { flex-direction: column; }
  .mod-thumb { width: 100%; height: 140px; border-radius: var(--radius); }
  .mod-actions { flex-direction: row; flex-wrap: wrap; }
  .mod-actions form { flex-direction: row; flex-wrap: wrap; }

  .stat-row { gap: 6px; }
  .stat-card { padding: 10px 12px; }
  .stat-num { font-size: 1.4rem; }

  .bulk-controls { gap: 8px; }

  .profile-avatar { font-size: 2.5rem; }
  .profile-header { gap: 12px; }
  .profile-header h1 { font-size: 1.3rem; }

  .search-form-lg { flex-direction: column; }

  .auth-wrap h1 { font-size: 1.4rem; }
  .data-table { font-size: 0.78rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .pagination a { min-width: 32px; height: 32px; }
  .admin-nav { gap: 6px; }
  .sort-tab { padding: 6px 11px; font-size: 0.78rem; }
}

@media (max-width: 380px) {
  .logo { font-size: 0.9rem; }
}
