/* ==========================================================
   BombaszVids – keret (oldalsáv / alsó menü) + közösségi nézetek
   ========================================================== */

:root { --side-w: 248px; --tabbar-h: 62px; }

/* ---------- profilkép, rang ---------- */
.avatar {
  --s: 40px;
  position: relative; flex-shrink: 0;
  width: var(--s); height: var(--s);
  display: inline-grid;
}
.avatar img, .avatar > span {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--s) * .42); color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
}
.online-dot {
  position: absolute; right: 0; bottom: 0;
  width: max(9px, calc(var(--s) * .26)); height: max(9px, calc(var(--s) * .26));
  border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 max(2px, calc(var(--s) * .05)) var(--bg);
}
.avatar-ring img, .avatar-ring > span { box-shadow: 0 0 0 4px var(--surface), 0 12px 30px -8px rgba(0, 0, 0, .8); }

.rank-badge {
  --c: #888;
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  white-space: nowrap;
}
.ranks { display: inline-flex; flex-wrap: wrap; gap: 5px; }

.status { font-size: 13px; color: var(--text-3); }
.status.online { color: var(--ok); }
.status.watching { color: var(--text-2); }
.status.watching b { color: var(--text); font-weight: 600; }

.count-pill { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(61, 214, 140, .14); color: var(--ok); margin-left: 4px; }
.muted { color: var(--text-3); }

/* ---------- oldalsáv (asztal) ---------- */
.sidenav {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
  width: var(--side-w);
  display: flex; flex-direction: column; gap: 22px;
  padding: max(20px, env(safe-area-inset-top)) 14px 14px;
  background: rgba(13, 13, 16, .92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.sidenav > .logo { padding: 0 10px; font-size: 32px; }
.sidenav-nav { display: grid; gap: 2px; }
.sidenav-nav a, .tabbar a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: background .15s, color .15s;
}
.sidenav-nav a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.sidenav-nav a.is-active { background: rgba(229, 72, 77, .12); color: var(--text); }
.sidenav-nav a.is-active svg { color: var(--accent-2); }

.side-online { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-online h4 { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 0 12px 8px; }
.side-online ul { list-style: none; overflow-y: auto; display: grid; gap: 1px; align-content: start; }
.side-online a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); text-decoration: none; }
.side-online a:hover { background: rgba(255, 255, 255, .05); }
.side-online a > span:last-child { display: grid; min-width: 0; line-height: 1.25; }
.side-online b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-online small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-online .more a { font-size: 13px; color: var(--text-3); }

.side-me {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  text-decoration: none;
}
.side-me:hover, .side-me.is-active { border-color: var(--line-2); background: rgba(255, 255, 255, .07); }
.side-me-text { display: grid; line-height: 1.25; min-width: 0; }
.side-me-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me-text small { font-size: 12px; color: var(--text-3); }

.topbar-me { display: none; text-decoration: none; }

/* ---------- alsó menüsor (telefon) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  background: rgba(13, 13, 16, .94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.tabbar a { position: relative; flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11.5px; justify-content: center; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.is-active { color: var(--text); }
.tabbar a.is-active svg { color: var(--accent-2); }
.tab-dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- oldalak ---------- */
.page { min-height: 100vh; padding: 92px var(--gutter) 48px; }
.page-inner { max-width: 1100px; margin: 0 auto; }
.page-inner.narrow { max-width: 640px; }
.page-head { margin-bottom: 26px; display: grid; gap: 4px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.page-section { margin-top: 34px; }
.page-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.section-row h2 { margin: 0; }
.search-sm { height: 38px; width: min(280px, 100%); margin: 0; }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.person-card {
  display: grid; justify-items: center; gap: 7px; text-align: center;
  padding: 18px 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s;
}
.person-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.person-card b { font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-card .status { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.member-list { list-style: none; display: grid; gap: 4px; }
.member { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--r-md); text-decoration: none; transition: background .15s; }
.member:hover { background: rgba(255, 255, 255, .04); }
.member-main { display: grid; gap: 2px; min-width: 0; }
.member-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 600; font-size: 15px; }

/* profil */
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.profile-cover {
  --h: 0;
  height: 150px;
  background:
    radial-gradient(ellipse at 20% 0%, hsl(var(--h) 70% 45% / .55), transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(229, 72, 77, .35), transparent 60%),
    var(--surface-2);
}
.profile-body { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 0 26px; margin-top: -56px; }
.profile-id { flex: 1; min-width: 200px; display: grid; gap: 6px; padding-bottom: 6px; }
.profile-id h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.profile-actions { padding-bottom: 8px; }
.profile-bio { padding: 18px 26px 0; color: #d2d2d8; white-space: pre-line; line-height: 1.6; }
.profile-facts { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 26px 26px; }
.profile-facts div { padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.profile-facts dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.profile-facts dd { font-size: 14.5px; font-weight: 600; }
.profile-facts .link-btn { color: var(--text); font-weight: 600; }

/* profil szerkesztő */
.profile-form { display: grid; gap: 4px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); }
.avatar-edit { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.avatar-edit-actions { display: grid; gap: 8px; justify-items: start; }
.avatar-edit-actions label { cursor: pointer; }
.profile-form .field input, .profile-form .field textarea {
  width: 100%; padding: 12px 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); border-radius: var(--r-md);
  outline: none; font: inherit; color: inherit; resize: vertical;
}
.profile-form .field input:focus, .profile-form .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(229, 72, 77, .15); }
.profile-form .field em { font-style: normal; }
.ranks-line { margin: 4px 0 6px; }
.form-msg { min-height: 20px; font-size: 14px; color: var(--ok); }
.form-msg.is-error { color: var(--accent-2); }
.form-actions { display: flex; justify-content: flex-end; }
.danger-zone { display: flex; justify-content: center; }

/* ---------- elrendezés ---------- */
body:not([data-view="films"]) .topbar .search { visibility: hidden; }

@media (min-width: 960px) {
  .app { padding-left: var(--side-w); }
  .topbar { left: var(--side-w); }
  .topbar-logo { display: none; }
}

@media (max-width: 959px) {
  .sidenav { display: none; }
  .tabbar { display: grid; }
  .app { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar-me { display: block; margin-left: 4px; }
  body:not([data-view="films"]) .topbar-me { margin-left: auto; }
  .topbar #logoutBtn { display: none; }
  body:not([data-view="films"]) .topbar .search { display: none; }
  .page { padding-top: 80px; }
  .footer { margin-bottom: 8px; }
  /* a lejátszó és az adatlap az alsó menü fölött legyen */
  .sheet { z-index: 500; }
}

@media (max-width: 640px) {
  .topbar-me { margin-left: auto; }
  .page { padding-top: 76px; }
  .profile-body { padding: 0 18px; justify-content: center; text-align: center; }
  .profile-id { justify-items: center; min-width: 0; }
  .profile-actions { width: 100%; display: flex; justify-content: center; }
  .profile-bio { padding: 16px 18px 0; text-align: center; }
  .profile-facts { padding: 18px; justify-content: center; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-form { padding: 18px; }
}

/* ---------- rangok kezelése ---------- */
.small { font-size: 13px; margin-bottom: 10px; }
.danger-zone { gap: 10px; flex-wrap: wrap; }
.rank-list { list-style: none; display: grid; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
}
.rank-row .rank-badge { font-size: 13px; padding: 4px 11px; }
.rank-perms { flex: 1; min-width: 140px; font-size: 13.5px; color: var(--text-2); }
.rank-count { font-size: 13px; }
.rank-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn.danger:hover { background: rgba(229, 72, 77, .15); color: var(--accent-2); }

.rank-form { padding: 16px; margin-bottom: 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); display: grid; gap: 10px; }
.rank-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.rank-form .field { flex: 1; min-width: 180px; margin: 0; }
.rank-form .field input { width: 100%; padding: 10px 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line-2); border-radius: var(--r-md); outline: none; font: inherit; color: inherit; }
.rank-form .field-color { flex: 0 0 90px; min-width: 0; }
.rank-form .field-color input { height: 42px; padding: 4px; cursor: pointer; }
.perm-list { display: grid; gap: 6px; }
.perm { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.perm:hover { background: rgba(255,255,255,.04); }
.perm input { width: 18px; height: 18px; accent-color: var(--accent); }
.perm span { display: grid; }
.perm small { color: var(--text-3); font-size: 12.5px; }

.rank-member { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md); flex-wrap: wrap; }
.rank-member > b { min-width: 120px; }
.rank-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.rank-toggle {
  --c: #888;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  color: var(--text-3); border: 1px dashed var(--line-2);
  transition: all .15s;
}
.rank-toggle:hover { color: var(--text-2); border-color: var(--c); }
.rank-toggle.is-on { color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
@media (max-width: 640px) { .rank-toggles { margin-left: 50px; } }
