/* navigation.css — sidebar, ზედა ზოლი, მობილური header/tabs/bottom-nav, ძიების overlay */

/* ── ლოგო ─────────────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
}
.brand-mark { width: 30px; height: 30px; }
.brand-word {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--c-text);
}
.brand-word em { font-style: normal; color: var(--c-accent-text); }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--c-bg-sidebar);
  border-right: 1px solid var(--c-line);
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 26px 14px 18px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  margin-bottom: 30px;
}

.sidebar .sidebar-close { display: none; }

.nav-list { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  color: var(--c-text-2);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link .icon { color: var(--c-text-2); }
.nav-link:hover { background: rgba(255, 255, 255, 0.035); color: var(--c-text); }
.nav-link[aria-current="page"] {
  background: var(--c-surface-2);
  color: var(--c-text);
  font-weight: 500;
}
.nav-link[aria-current="page"] .icon { color: var(--c-accent-text); }

.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 700;
}

.nav-section-label {
  margin: 26px 14px 10px;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.user-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  transition: background-color var(--dur-fast) var(--ease);
}
.user-card:hover { background: rgba(255, 255, 255, 0.035); }
.user-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--c-surface-3);
  color: var(--c-text-2);
  font-weight: 600;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { display: block; font-weight: 600; font-size: var(--fs-md); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sub { display: block; font-size: var(--fs-xs); color: var(--c-text-3); }
.user-card > .icon { color: var(--c-text-3); }

/* იურიდიული ბმულები sidebar-ის ბოლოში: წესები · კონფიდენციალურობა · კონტაქტი · TMDB */
.legal-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--fs-2xs); line-height: 1.6; color: var(--c-text-3); }
.legal-links a { color: var(--c-text-3); transition: color var(--dur-fast) var(--ease); }
.legal-links a:hover { color: var(--c-text-2); }
.sidebar-legal { padding: 10px 10px 0; border-top: 1px solid var(--c-line); margin-top: 8px; }
.legal-credit { opacity: 0.8; }

/* დაბალ ეკრანებზე (ლეპტოპი/ტაბლეტი) მენიუ კომპაქტურია, რომ პროფილის ბარათი ჩანდეს */
@media (min-width: 900px) and (max-height: 860px) {
  .sidebar-inner { padding-top: 20px; padding-bottom: 12px; }
  .sidebar-head { margin-bottom: 18px; }
  .nav-list { gap: 2px; }
  .nav-link { min-height: 36px; }
  .nav-section-label { margin: 16px 14px 6px; }
  .user-card { padding-top: 8px; padding-bottom: 8px; }
}

/* აქტიური „მთავარი“ — შევსებული სახლი (დიზაინის მიხედვით) */
.nav-link[aria-current="page"] .icon-home path:first-child,
.bottom-nav-item[aria-current="page"] .icon-home path:first-child { fill: currentColor; }
.nav-link[aria-current="page"] .icon-home path:last-child { stroke: var(--c-surface-2); }
.bottom-nav-item[aria-current="page"] .icon-home path:last-child { stroke: var(--c-bg-sidebar); }

/* ── Desktop ზედა ზოლი (hero-ს ზემოთ) ─────────────────────── */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter) 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .search-box { width: min(500px, 46%); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-random {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--c-line-strong);
  background: rgba(8, 11, 17, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.topbar-random .icon { color: var(--c-accent-soft); transition: transform var(--dur) var(--ease); }
.topbar-random:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.24); }
.topbar-random:hover .icon { transform: rotate(-18deg) scale(1.08); }
.topbar-random:active { transform: scale(0.97); }
.topbar-bell { position: relative; }
.bell-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-danger);
  box-shadow: 0 0 0 2px var(--c-bg);
}

/* ── მობილური ელემენტები (დამალულია desktop-ზე) ──────────── */
.mobile-header,
.mobile-tabs,
.bottom-nav { display: none; }

@media (max-width: 899px) {
  /* Sidebar → გამოსაწევი drawer */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(86vw, 312px);
    border-right-color: var(--c-line-strong);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  /* გახსნისას visibility ტრანზიციის გარეშე იცვლება — focus მაშინვე მუშაობს */
  .sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .sidebar-inner { padding-top: calc(18px + var(--safe-top)); padding-bottom: calc(18px + var(--safe-bottom)); }
  .sidebar-head { margin-bottom: 20px; }
  .sidebar .sidebar-close { display: inline-grid; }

  .topbar { display: none; }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 88px 1fr 88px;
    align-items: center;
    height: calc(var(--mobile-header-h) + var(--safe-top));
    padding: var(--safe-top) 8px 0;
    background: rgba(8, 11, 17, 0.84);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
  }
  .mobile-header .brand { justify-self: center; }
  .mobile-header-actions { display: flex; justify-content: flex-end; }
  .mobile-header [data-drawer-open] { position: relative; }
  .mobile-header .brand-mark { width: 26px; height: 26px; }
  .mobile-header .brand-word { font-size: 1.25rem; }

  .mobile-tabs {
    display: block;
    padding: 6px 12px 2px;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(11, 15, 23, 0.92);
    backdrop-filter: saturate(140%) blur(16px);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    border-top: 1px solid var(--c-line);
  }
}

/* ── მობილური ტაბები (segmented control) ──────────────────── */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented-item {
  flex: 1 0 auto;
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.segmented-item[aria-pressed="true"] {
  background: var(--c-surface-3);
  border-color: var(--c-line-strong);
  color: var(--c-text);
  font-weight: 600;
}

/* ── Bottom nav ───────────────────────────────────────────── */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  font-size: var(--fs-2xs);
  color: var(--c-text-2);
}
.bottom-nav-item[aria-current="page"] { color: var(--c-accent-text); font-weight: 600; }
.bottom-nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── ძიების overlay (მობილური) ─────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 9, 0.7);
  backdrop-filter: blur(3px);
}
.search-overlay-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 6px;
  padding: calc(10px + var(--safe-top)) 10px 10px 12px;
  background: var(--c-bg-sidebar);
  border-bottom: 1px solid var(--c-line);
}
