/* ============================================================
   JETTEILE.COM — Black + Gold Theme
   ============================================================ */

@font-face {
  font-family: 'SeaDog2001';
  src: url('../static/fonts/SeaDog2001.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold:        #c9a84c;
  --gold-bright: #e0c068;
  --gold-dark:   #8a7434;
  --gold-muted:  #6b5a28;
  --gold-glow:   rgba(201,168,76,.25);
  --bg:          #000000;
  --bg-1:        #0a0a0a;
  --bg-2:        #111111;
  --bg-3:        #1a1a1a;
  --bg-4:        #222222;
  --border:      #2a2a2a;
  --border-gold: rgba(201,168,76,.3);
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --text-dim:    #64748b;
  --online:      #00ff99;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --success:     #22c55e;
  --info:        #3b82f6;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,.6);
  --shadow-gold: 0 0 20px rgba(201,168,76,.15);
  --transition:  .18s ease;
  --font-main:   'Inter', system-ui, -apple-system, sans-serif;
  --font-brand:  'SeaDog2001', serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; overscroll-behavior-y: none; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); margin-top: 1.4em; margin-bottom: .5em; }
h1:first-child,h2:first-child,h3:first-child { margin-top: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
a  { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-bright); }
p  { color: var(--text-muted); line-height: 1.7; margin-bottom: .9em; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.5em; margin-bottom: .9em; color: var(--text-muted); }
li { margin-bottom: .3em; line-height: 1.6; }
strong { color: var(--text); }
code, pre {
  font-family: 'Fira Code', 'Consolas', monospace;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
}
code  { padding: 2px 6px; font-size: .875em; }
pre   { padding: 16px; overflow-x: auto; }
hr    { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar          { width: 8px; height: 8px; }
::-webkit-scrollbar-track    { background: var(--bg-1); }
::-webkit-scrollbar-thumb    { background: var(--bg-4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-muted); }

/* ══════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-gold);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 32px;
  flex-shrink: 0;
}
.nav-brand img   { height: 36px; width: auto; }
.nav-brand-text  { font-family: var(--font-brand); font-size: 1.1rem; color: var(--gold); letter-spacing: .05em; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  color: var(--gold);
  background: var(--gold-glow);
}
.nav-link .icon { font-size: 1rem; line-height: 1; }
.nav-link-mobile-only { display: none; }

/* Desktop: ikoni isompana ylhäällä, teksti pienemmällä alla — säästää leveyttä */
@media (min-width: 769px) {
  .nav-links > .nav-link {
    flex-direction: column;
    gap: 2px;
    padding: 5px 10px;
    font-size: .68rem;
  }
  .nav-links > .nav-link .icon { font-size: 1.35rem; }
}

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

/* SOS-hätänappi headerissa (globaali) */
.sos-nav-btn {
  background: #dc2626;
  color: #fff;
  font-weight: 900;
  font-size: .7rem;
  letter-spacing: .04em;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  font-family: monospace;
}
.sos-nav-btn:hover { background: #ef4444; }
/* Järjestys nav-rightissä: kello → SOS → avatar-valikko → hamppari.
   Valikko (desktop: avatar, mobiili: hamppari) on AINA äärioikealla, SOS sen vasemmalla puolella */
.nav-right .notif-dd    { order: 1; }
.nav-right .sos-nav-btn { order: 2; }
.nav-right .dropdown    { order: 3; }
.nav-right .nav-toggle  { order: 4; }

/* Hätänumerorivit (map/_emergency — käytössä myös globaalissa SOS-modalissa) */
.e-row { display:flex; justify-content:space-between; align-items:center; padding:5px 0; border-bottom:1px solid #1a1a1a; font-size:.75rem; color:#94a3b8; gap:6px; }
.e-row:last-child { border-bottom:none; }
.e-num { font-family:monospace; color:#c9a84c; font-weight:700; font-size:.8rem; white-space:nowrap; }
.flag { display:inline-block; vertical-align:middle; margin-right:4px; }
.flag img { display:block; width:18px; height:13px; border-radius:2px; }
.flag-sos { display:inline-block; vertical-align:middle; margin-right:4px; font-size:.58rem; font-weight:900; background:#dc2626; color:#fff; border-radius:3px; padding:2px 4px; font-family:monospace; }
.flag-vhf { display:inline-block; vertical-align:middle; margin-right:4px; font-size:.58rem; font-weight:900; background:#1d4ed8; color:#fff; border-radius:3px; padding:2px 4px; font-family:monospace; }

.nav-badge-wrap { position: relative; }
.nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-gold);
  object-fit: cover;
  cursor: pointer;
  transition: border-color var(--transition);
}
.nav-avatar:hover { border-color: var(--gold); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  min-width: 200px;
  padding: 8px;
  box-shadow: var(--shadow);
  z-index: 200;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .875rem;
  transition: all var(--transition);
  cursor: pointer;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
}
.dropdown-item:hover { color: var(--gold); background: var(--gold-glow); }
.dropdown-item.danger:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}
.main-content.wide { max-width: 1400px; }
.main-content.narrow { max-width: 800px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px 24px; box-sizing: border-box; }
.table-responsive { overflow-x: auto; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.three-col {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 24px;
  align-items: start;
}

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
  padding: 24px;
}
.card:hover { border-color: var(--border-gold); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  margin: -24px -24px 24px;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body  { padding: 0; }
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  margin: 24px -24px -24px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 14px;
  margin-top: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.card-gold {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-gold); transform: translateY(-2px); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--gold); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm  { padding: 6px 14px; font-size: .8rem; }
.btn-lg  { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

.btn-primary {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: #000; }
.btn-gold { background: var(--gold); color: #000; border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: #000; }

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--border-gold);
}
.btn-outline:hover { background: var(--gold-glow); border-color: var(--gold); }

.btn-danger {
  background: rgba(239,68,68,.1);
  color: var(--danger);
  border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.2); border-color: var(--danger); }

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

.btn-share-fb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: #1877f2;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-share-fb:hover { background: #1464d0; color: #fff; text-decoration: none; }
.btn-share-fb.btn-xs { padding: 3px 8px; font-size: .72rem; }
.btn-share-fb.btn-sm { padding: 4px 10px; font-size: .78rem; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font-main);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .8rem; color: var(--text-dim); margin-top: 6px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: .9rem; font-family: var(--font-main); transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.form-input::placeholder { color: var(--text-dim); }
textarea.form-input { min-height: 120px; resize: vertical; }
select.form-input { cursor: pointer; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: 6px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Rich text editor */
.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.editor-btn {
  padding: 5px 10px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: .8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.editor-btn:hover { border-color: var(--gold); color: var(--gold); }
.editor-content {
  min-height: 200px;
  padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.7;
}
.editor-content:focus { border-color: var(--gold); }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger   { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning  { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-info     { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #93c5fd; }

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: middle;
}
tbody tr:hover td { background: var(--bg-2); }
tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════
   BADGES & TAGS
══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-gold    { background: rgba(201,168,76,.15); color: var(--gold); border: 1px solid var(--border-gold); }
.badge-success { background: rgba(34,197,94,.1);  color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.badge-danger  { background: rgba(239,68,68,.1);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.badge-muted   { background: var(--bg-3); color: var(--text-dim); border: 1px solid var(--border); }
.badge-info    { background: rgba(59,130,246,.1); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }

/* Role badges */
.role-owner     { background: linear-gradient(135deg,#c9a84c,#8a7434); color: #000; }
.role-admin     { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.role-moderator { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
.role-advertiser{ background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }

/* ══════════════════════════════════════════
   AVATAR
══════════════════════════════════════════ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 40px; height: 40px; }
.avatar-lg  { width: 56px; height: 56px; }
.avatar-xl  { width: 80px; height: 80px; }
.avatar-2xl { width: 120px; height: 120px; }

.avatar-wrap { position: relative; display: inline-block; }
.online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--bg);
}

/* ══════════════════════════════════════════
   USER ROW
══════════════════════════════════════════ */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-row-info { flex: 1; min-width: 0; }
.user-row-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row-sub { font-size: .8rem; color: var(--text-dim); }

/* ══════════════════════════════════════════
   FORUM
══════════════════════════════════════════ */
.forum-category {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}
.forum-category:hover { border-color: var(--border-gold); }

.forum-cat-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: center;
  padding: 18px 24px;
  text-decoration: none;
}
.forum-cat-icon {
  font-size: 1.5rem;
  margin-right: 14px;
  flex-shrink: 0;
}
.forum-cat-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.forum-cat-desc { font-size: .82rem; color: var(--text-dim); margin-top: 2px; }
.forum-cat-stats { text-align: right; }
.forum-cat-num   { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
.forum-cat-label { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }

/* Thread list */
.thread-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.thread-item:hover { background: var(--bg-2); }
.thread-item:last-child { border-bottom: none; }
.thread-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition);
}
.thread-title:hover { color: var(--gold); }
.thread-meta { font-size: .78rem; color: var(--text-dim); margin-top: 4px; }
.thread-meta a { color: var(--text-muted); }
.thread-meta a:hover { color: var(--gold); }
.thread-stats { text-align: right; font-size: .82rem; color: var(--text-dim); white-space: nowrap; }

/* Thread view */
.post-item {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.post-item:target { border-color: var(--gold); }
.post-author-col {
  padding: 20px;
  border-right: 1px solid var(--border);
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.post-layout { display: flex; }
.post-body-col { flex: 1; min-width: 0; padding: 20px; }
.post-content { line-height: 1.75; color: var(--text); }
.post-content img { max-width: 100%; border-radius: var(--radius); }
.post-content a   { color: var(--gold); }
.post-content blockquote {
  border-left: 3px solid var(--gold-muted);
  padding: 8px 16px;
  background: var(--bg-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 0;
  color: var(--text-muted);
}
.post-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .8rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}
.like-btn:hover, .like-btn.liked { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }

/* ══════════════════════════════════════════
   FEED
══════════════════════════════════════════ */
/* ── Feed cards (Facebook-style) ── */
.feed-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
  margin-bottom: 16px;
}
.feed-card:hover { border-color: var(--border-gold); }
.feed-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 8px;
}
.feed-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
}
.feed-card-meta { flex: 1; min-width: 0; }
.feed-card-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: .9rem;
}
.feed-card-name a { color: var(--text); }
.feed-card-name a:hover { color: var(--gold); }
.feed-card-time { font-size: .75rem; color: var(--text-dim); margin-top: 2px; }
.feed-card-body { padding: 0 16px 10px; }
.feed-card-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
  text-decoration: none;
}
.feed-card-title:hover { color: var(--gold); }
.feed-card-excerpt {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.feed-card-img-wrap {
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--bg-3);
  position: relative;
}
.feed-card-img-wrap.ratio-16-9 { aspect-ratio: 16/9; }
.feed-card-img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
  display: block;
  background: var(--bg-2);
}
.ratio-16-9 .feed-card-img { height: 100%; max-height: unset; object-fit: cover; }
.feed-card-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  font-size: 2.5rem;
  color: #fff;
  pointer-events: none;
}
.feed-card-stats {
  display: flex;
  gap: 14px;
  padding: 4px 16px;
  font-size: .75rem;
  color: var(--text-dim);
  min-height: 24px;
}
.feed-card-actions {
  display: flex;
  border-top: 1px solid var(--border);
  padding: 2px 8px;
  gap: 2px;
}
.feed-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: .82rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
  font-family: var(--font-main);
  text-decoration: none;
  white-space: nowrap;
}
.feed-act-btn:hover { background: var(--bg-3); color: var(--text); }
.feed-act-btn.liked { color: var(--danger); }
.feed-act-btn.ml-auto { margin-left: auto; }
.badge-new { background: rgba(34,197,94,.2); color: var(--success); font-size: .65rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
/* News card — horizontal layout */
.feed-news-card { border-color: #2563eb !important; }
.feed-news-card:hover { border-color: #3b82f6 !important; }
.feed-news-body { display:flex; gap:12px; padding:12px 14px; align-items:flex-start; }
.feed-news-thumb { flex-shrink:0; width:220px; height:148px; border-radius:6px; overflow:hidden; background:var(--bg-3); }
.feed-news-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.feed-news-text { flex:1; min-width:0; }
.feed-news-source { font-size:.68rem; color:#3b82f6; font-weight:600; margin-bottom:5px; text-transform:uppercase; letter-spacing:.03em; }
.feed-news-title { display:block; font-size:.95rem; font-weight:700; color:var(--text); line-height:1.35; margin-bottom:4px; text-decoration:none; }
.feed-news-title:hover { color:#3b82f6; }
.feed-news-excerpt { font-size:.8rem; color:var(--text-muted); line-height:1.45; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin:0; }
/* Ad slot in feed */
.feed-ad-slot { background:var(--bg-2); border:1px dashed var(--border); border-radius:var(--radius-lg); margin-bottom:16px; display:flex; align-items:center; justify-content:center; min-height:80px; color:var(--text-dim); font-size:.75rem; }
/* legacy compat */
.feed-item { display: none; }
.feed-item-title { display: block; font-weight: 700; color: var(--text); font-size: .95rem; margin-bottom: 4px; }
.feed-item-title:hover { color: var(--gold); }
.feed-item-body { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* ══════════════════════════════════════════
   CHAT
══════════════════════════════════════════ */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 60px - 64px);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-contacts { flex: 1; overflow-y: auto; }
.chat-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.chat-contact:hover, .chat-contact.active { background: var(--bg-2); }
.chat-contact-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.chat-contact-preview { font-size: .78rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main {
  display: flex;
  flex-direction: column;
}
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-bubble {
  display: flex;
  gap: 10px;
  max-width: 70%;
}
.msg-bubble.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble.mine .msg-body {
  background: var(--gold-glow);
  border-color: var(--border-gold);
  color: var(--text);
}
.msg-body {
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .9rem;
  max-width: 100%;
  word-break: break-word;
}
.msg-time { font-size: .72rem; color: var(--text-dim); align-self: flex-end; flex-shrink: 0; }

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: .9rem;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--gold); }

/* ══════════════════════════════════════════
   PROFILE
══════════════════════════════════════════ */
.profile-hero {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.profile-banner {
  height: 160px;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1200 50%, #0a0a0a 100%);
  position: relative;
  overflow: hidden;
}
.profile-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(201,168,76,.03) 40px,
    rgba(201,168,76,.03) 41px
  );
}
.profile-info {
  padding: 0 24px 24px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
}
.profile-avatar-wrap {
  margin-top: -48px;
  position: relative;
  z-index: 1;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--bg-1);
  object-fit: cover;
}
.profile-meta { flex: 1; padding-top: 12px; }
.profile-name { font-size: 1.4rem; font-weight: 800; }
.profile-username { color: var(--text-dim); font-size: .9rem; }
.profile-stats { display: flex; gap: 24px; margin-top: 8px; }
.profile-stat-val { font-weight: 700; color: var(--gold); }
.profile-stat-label { font-size: .78rem; color: var(--text-dim); }

/* ══════════════════════════════════════════
   ADMIN
══════════════════════════════════════════ */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.admin-nav {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 80px;
}
.admin-nav-section { margin-bottom: 20px; }
.admin-nav-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding: 0 8px;
}
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .875rem;
  transition: all var(--transition);
}
.admin-nav-link:hover, .admin-nav-link.active { color: var(--gold); background: var(--gold-glow); }

/* ══════════════════════════════════════════
   MODULE TOGGLE (Admin)
══════════════════════════════════════════ */
.module-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color var(--transition);
}
.module-card.enabled  { border-color: var(--border-gold); }
.module-card.core     { opacity: .7; }
.module-info h4       { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.module-info p        { font-size: .8rem; color: var(--text-dim); }

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-4);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--gold-muted); border-color: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--gold); }

/* ══════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.page-item:hover  { border-color: var(--gold); color: var(--gold); }
.page-item.active { background: var(--gold); border-color: var(--gold); color: #000; }
.page-item.disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow), var(--shadow-gold);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ══════════════════════════════════════════
   HONOR / LEVELS
══════════════════════════════════════════ */
.honor-bar {
  height: 6px;
  background: var(--bg-4);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.honor-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 3px;
  transition: width .5s ease;
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg  { font-size: .875rem; color: var(--text); flex: 1; }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  padding: 40px 24px 24px;
  margin-top: auto;
}
.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand img   { height: 40px; }
.footer-brand p     { font-size: .875rem; color: var(--text-dim); margin-top: 10px; }
.footer-col h4      { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col a       { display: block; font-size: .875rem; color: var(--text-dim); margin-bottom: 8px; }
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom p { font-size: .8rem; color: var(--text-dim); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: .8rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--gold); }

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.flex { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .78rem; }
.text-lg  { font-size: 1.1rem; }
.font-bold { font-weight: 700; }
.font-brand { font-family: var(--font-brand); }
.w-full { width: 100%; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hidden { display: none !important; }
.relative { position: relative; }
.grid { display: grid; }

/* Gold divider */
.divider-gold {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 32px 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .post-layout { flex-direction: column; }
  .post-author-col { width: 100%; flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 768px) {
  .navbar { padding: 0 12px; }
  .nav-links { display: none !important; }
  .nav-links.open { display: flex !important; flex-direction: column; position: fixed; top: 60px; left: 0; right: 0; background: var(--bg-1); border-bottom: 1px solid var(--border-gold); padding: 12px; z-index: 99; }
  .nav-toggle { display: flex; }
  .nav-link-mobile-only { display: flex; }
  /* Mobiilissa piilota chat-ikoni ja ilmoituskello navbarista */
  .nav-badge-wrap:has(#chatNavBtn) { display: none !important; }
  .nav-desktop-only { display: none !important; }
  /* Vain avatar + hampurilainen nav-rightissä */
  .nav-right { gap: 6px; }
  .nav-brand-text { display: none; }
  .main-content { padding: 20px 16px; }
  .forum-cat-header { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .forum-cat-stats { display: none; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
/* Pull-to-refresh */
#ptr-indicator {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  height: 0; overflow: hidden;
  background: var(--bg-2); border-bottom: 1px solid var(--border-gold);
  transition: height .15s ease; color: var(--gold); font-size: .85rem; gap: 8px;
}
#ptr-indicator.ptr-visible { height: 48px; }
#ptr-indicator.ptr-loading .ptr-spinner { animation: spin .7s linear infinite; }
.ptr-spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; }

/* PWA install hint */
.pwa-install-hint {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--border-gold);
  border-radius: 14px; padding: 14px 18px; max-width: 320px; width: calc(100vw - 32px);
  z-index: 9999; font-size: .85rem; text-align: center; box-shadow: var(--shadow);
}
.pwa-install-hint strong { color: var(--gold); }
.pwa-install-hint .hint-close {
  position: absolute; top: 8px; right: 12px; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 1rem;
}
.pwa-install-hint .hint-icon { font-size: 2rem; display: block; margin-bottom: 8px; }

@keyframes pulse-gold {
  0%,100% { box-shadow: 0 0 0 0 var(--gold-glow); }
  50%      { box-shadow: 0 0 0 8px transparent; }
}
.pulse-gold { animation: pulse-gold 2s infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.fade-in { animation: fadeIn .25s ease forwards; }

/* Gold shimmer for loading */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ══════════════════════════════════════════
   FEED LAYOUT
══════════════════════════════════════════ */
.feed-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 24px;
  align-items: start;
  max-width: 960px;
  margin: 0 auto;
}
.feed-main  { min-width: 0; }
.feed-sidebar { position: sticky; top: 80px; }
.feed-item-type {
  width: 4px;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 4px 0 0 4px;
}
.feed-item-type.forum { background: var(--gold); }
.feed-item-type.news  { background: #3b82f6; }
.feed-item-type.video { background: #ef4444; }
.feed-item { position: relative; }
.feed-item-title { display: block; font-weight: 700; color: var(--text); font-size: .95rem; margin-bottom: 4px; }
.feed-item-title:hover { color: var(--gold); }
.feed-item-body { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-item { text-align: center; }
.stat-number { font-size: 1.3rem; font-weight: 800; color: var(--gold); }
.stat-label  { font-size: .75rem; color: var(--text-dim); }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.ml-auto { margin-left: auto; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.pagination-wrap { display: flex; justify-content: center; }

/* ══════════════════════════════════════════
   FORUM POST LAYOUT
══════════════════════════════════════════ */
.forum-post-layout {
  display: flex;
}
.post-user-col {
  width: 100px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
}
.post-content-col {
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
}
.post-meta { font-size: .78rem; }
.post-body { line-height: 1.75; color: var(--text); white-space: pre-wrap; }
.listing-body { line-height: 1.75; color: var(--text); white-space: pre-wrap; }
.post-body a { color: var(--gold); }
.post-body blockquote {
  border-left: 3px solid var(--gold-muted);
  padding: 8px 16px;
  background: var(--bg-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 10px 0;
  color: var(--text-muted);
}
.post-body pre { background: var(--bg-3); padding: 12px; border-radius: var(--radius); overflow-x: auto; }
.post-body code { font-family: monospace; background: var(--bg-3); padding: 1px 5px; border-radius: 3px; }

/* ══════════════════════════════════════════
   TAB NAVIGATION
══════════════════════════════════════════ */
.tab-btn {
  padding: 8px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ══════════════════════════════════════════
   DATA TABLE
══════════════════════════════════════════ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-dim);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { color: var(--text); }

/* ══════════════════════════════════════════
   FORM CHECK & HINT
══════════════════════════════════════════ */
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
}
.form-check input[type=radio] {
  accent-color: var(--gold);
}
.form-hint { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }

/* ══════════════════════════════════════════
   BTN EXTRA SIZES
══════════════════════════════════════════ */
.btn-xs { padding: 3px 8px; font-size: .72rem; }
.btn-icon { padding: 6px; line-height: 1; border-radius: var(--radius); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(239,68,68,.1); border-color: var(--danger); }
.dropdown-item.danger { color: var(--danger); }
.nav-badge-wrap { position: relative; }
.nav-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; background: var(--gold); color: #000; border-radius: 9px; font-size: .65rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ══════════════════════════════════════════
   RESPONSIVE FEED
══════════════════════════════════════════ */
@media (max-width: 1000px) {
  .feed-layout { grid-template-columns: 1fr; }
  .feed-sidebar { position: static; }
}
@media (max-width: 768px) {
  .forum-post-layout { flex-direction: column; }
  .post-user-col { width: 100%; flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ───────── User grid ───────── */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.15s;
  text-align: center;
}
.user-card:hover { border-color: var(--gold); }
.user-card-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 0.75rem;
}
.user-card:hover .user-card-avatar { border-color: var(--gold); }
.user-card-name { font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.user-card-meta { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }

/* ───────── Role badges ───────── */
.role-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.role-owner   { background: #7c3aed; color: #fff; }
.role-system  { background: #1d4ed8; color: #fff; }
.role-admin   { background: var(--gold); color: #000; }
.role-moderator { background: #059669; color: #fff; }
.role-advertiser { background: #b45309; color: #fff; }
.role-basic   { background: var(--bg-2); color: var(--text-muted); }

/* ───────── Badge variants ───────── */
.badge-forum { background: rgba(201,168,76,0.2); color: var(--gold); }
.badge-news  { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-user  { background: rgba(156,163,175,0.2); color: var(--text-muted); }

/* ───────── Search results ───────── */
.search-results { display: flex; flex-direction: column; gap: 0; }
.search-result-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  margin-bottom: 0.25rem;
}
.search-result-title:hover { text-decoration: underline; }

/* ───────── FAQ ───────── */
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--gold);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::after { content: '+'; font-size: 1.2rem; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 0 1rem; color: var(--text-muted); }

/* ───────── Guidelines ───────── */
.guideline-item { border-bottom: 1px solid var(--border); padding: 1.25rem 0; }
.guideline-item:last-child { border-bottom: none; }
.guideline-item h2 { color: var(--gold); font-size: 1.05rem; margin-bottom: 0.4rem; }

/* ───────── DL grid (key/value pairs) ───────── */
.dl-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}
.dl-grid dt { color: var(--text-muted); font-size: 0.875rem; }
.dl-grid dd { margin: 0; }

/* ───────── Feature boxes (what-we-are page) ───────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  text-align: center;
}
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-box h3 { color: var(--gold); margin-bottom: 0.5rem; font-size: 1rem; }

/* ───────── Radio group ───────── */
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }

/* ───────── Alert variants ───────── */
.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.4);
  color: #86efac;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* ── Video embeds (YouTube / Vimeo auto-detected from links) ── */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 12px 0;
  border-radius: var(--radius);
  background: var(--bg-2);
}
.video-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── Forum editor toolbar ── */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.editor-toolbar + .form-control {
  border-radius: 0 0 var(--radius) var(--radius);
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tb-btn:hover { background: var(--bg-3); border-color: var(--gold-dark); color: var(--gold); }
.tb-upload { cursor: pointer; }
.tb-sep { display: inline-block; width: 1px; background: var(--border); margin: 4px 3px; align-self: stretch; }

/* ══════════════════════════════════════════
   AJOSEURA
══════════════════════════════════════════ */
.riding-areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.riding-area-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.riding-area-card:hover {
  border-color: var(--gold-dark);
  box-shadow: var(--shadow-gold);
  color: var(--text);
}
.riding-area-top    { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.riding-area-name   { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.riding-area-region { font-size: .78rem; color: var(--text-dim); margin-top: 2px; }
.riding-area-badge  { background: var(--gold-glow); border: 1px solid var(--border-gold); color: var(--gold); border-radius: 20px; padding: 2px 10px; font-size: .72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.riding-area-desc   { font-size: .85rem; color: var(--text-muted); flex: 1; }
.riding-area-footer { font-size: .75rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* Kirjoituslomake */
.riding-type-toggle { display: flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.riding-type-btn {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-3);
  border: none;
  color: var(--text-dim);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.riding-type-btn.active  { background: var(--gold); color: #000; }
.riding-type-btn:hover:not(.active) { background: var(--bg-4); color: var(--text); }

/* Postauskortti */
.riding-post {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.riding-post:hover { border-color: var(--border-gold); }
.riding-post-header { display: flex; gap: 10px; align-items: flex-start; padding: 14px 14px 0; }
.riding-post-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.riding-post-body   { padding: 10px 14px; font-size: .9rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }
.riding-post-footer { display: flex; gap: 8px; align-items: center; padding: 8px 14px 12px; flex-wrap: wrap; }
.riding-badge-now     { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); color: #22c55e; border-radius: 20px; padding: 1px 9px; font-size: .72rem; font-weight: 700; }
.riding-badge-planned { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.25); color: #60a5fa; border-radius: 20px; padding: 1px 9px; font-size: .72rem; font-weight: 700; }

/* Vastaukset */
.riding-replies-wrap { border-top: 1px solid var(--border); background: var(--bg-1); }
.riding-replies-list { padding: 8px 0; }
.riding-reply {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.riding-reply:last-child { border-bottom: none; }
.riding-reply-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.riding-reply-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

@media (max-width: 768px) {
  .riding-areas-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   NOTIFICATION DROPDOWN
══════════════════════════════════════════ */
.notif-dd { position: relative; }
.notif-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 300;
  overflow: hidden;
}
.notif-menu.open { display: flex; flex-direction: column; }
.notif-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.notif-menu-list { max-height: 300px; overflow-y: auto; }
.notif-menu-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.notif-menu-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}
.notif-menu-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background var(--transition);
  color: var(--text);
}
.notif-menu-item:last-child { border-bottom: none; }
.notif-menu-item:hover { background: var(--bg-3); color: var(--text); }
.notif-menu-unread { background: rgba(201,168,76,.06); }
.notif-menu-unread::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.notif-menu-title { font-size: .85rem; font-weight: 500; color: var(--text); }
.notif-menu-body  { font-size: .78rem; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Notification list page */
.notif-list-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-list-item:last-child { border-bottom: none; }
.notif-list-item:hover { background: var(--bg-2); }
.notif-list-unread { background: rgba(201,168,76,.05); }
.notif-list-unread .notif-list-title { font-weight: 600; }
.notif-list-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.notif-list-body { min-width: 0; flex: 1; }
.notif-list-title { color: var(--text); font-size: .9rem; }
a.notif-list-title:hover { color: var(--gold); }

/* ══════════════════════════════════════════
   PWA BOTTOM NAV
══════════════════════════════════════════ */
.pwa-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border-top: 2px solid var(--border-gold);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}
.pwa-nav-spacer {
  display: none;
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}
.pwa-bottom-nav-inner {
  display: flex;
  height: 72px;
}
.pwa-bottom-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: color var(--transition), background var(--transition);
  padding: 8px 4px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.pwa-bottom-link .pwa-icon {
  font-size: 1.55rem;
  line-height: 1;
}
.pwa-bottom-link:hover { color: var(--gold-bright); background: var(--gold-glow); }
.pwa-bottom-link.active { color: var(--gold); }
.pwa-bottom-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--gold);
  border-radius: 0 0 3px 3px;
}
.pwa-bottom-badge-wrap {
  flex: 1;
  position: relative;
  display: flex;
}
.pwa-bottom-badge-wrap .pwa-bottom-link {
  flex: 1;
}
.pwa-bottom-badge {
  position: absolute;
  top: 9px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  background: var(--gold);
  color: #000;
  border-radius: 9px;
  font-size: .6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}

@media (max-width: 768px) {
  .pwa-bottom-nav  { display: block; }
  .pwa-nav-spacer  { display: block; }
}
@media (display-mode: standalone) {
  .pwa-bottom-nav  { display: block; }
  .pwa-nav-spacer  { display: block; }
}
.tb-uploading { opacity: .5; pointer-events: none; }
