/* ==========================================================================
   Теплоход Памяти / Канал Памяти — Веб-Читалка и Каталог (app.css)
   ========================================================================== */

:root {
  /* Dark Theme (Default) */
  --bg-app: #0b0e14;
  --bg-sidebar: #0f131c;
  --bg-surface: #151923;
  --bg-surface-hover: #1b212f;
  --bg-surface-active: #232b3d;
  --bg-card: #131722;
  --bg-input: #111520;
  --border-subtle: #1e2433;
  --border-strong: #2c354a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-rgb: 56, 189, 248;
  --accent-hover: #7dd3fc;
  --accent-light: rgba(56, 189, 248, 0.12);
  --accent-warm: #f59e0b;
  --accent-warm-light: rgba(245, 158, 11, 0.15);
  --tag-bg: #1e2433;
  --tag-text: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Merriweather", "Georgia", "Cambria", serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
  --reader-font: var(--font-sans);
  --reader-font-size: 16px;
  --reader-line-height: 1.7;
  --reader-max-width: 820px;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-surface-active: #e2e8f0;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-rgb: 2, 132, 199;
  --accent-hover: #0369a1;
  --accent-light: rgba(2, 132, 199, 0.08);
  --accent-warm: #d97706;
  --accent-warm-light: rgba(217, 119, 6, 0.1);
  --tag-bg: #f1f5f9;
  --tag-text: #334155;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.15);
}

[data-theme="sepia"] {
  --bg-app: #f7f2e7;
  --bg-sidebar: #eee7d5;
  --bg-surface: #fdfaf3;
  --bg-surface-hover: #f3ecda;
  --bg-surface-active: #e9e0cb;
  --bg-card: #fdfaf3;
  --bg-input: #fdfaf3;
  --border-subtle: #e2d7c0;
  --border-strong: #caba9f;
  --text-primary: #2d241e;
  --text-secondary: #635449;
  --text-muted: #9c8979;
  --accent: #b45309;
  --accent-rgb: 180, 83, 9;
  --accent-hover: #92400e;
  --accent-light: rgba(180, 83, 9, 0.1);
  --accent-warm: #b45309;
  --accent-warm-light: rgba(180, 83, 9, 0.12);
  --tag-bg: #eee7d5;
  --tag-text: #4b3b2f;
  --shadow-sm: 0 1px 3px rgba(80, 50, 20, 0.08);
  --shadow-md: 0 4px 12px rgba(80, 50, 20, 0.1);
  --shadow-lg: 0 12px 28px rgba(80, 50, 20, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Top Navbar
   -------------------------------------------------------------------------- */
.navbar {
  height: 58px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  user-select: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Search Box in Navbar */
.nav-search-container {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.nav-search {
  width: 100%;
  height: 38px;
  padding: 0 40px 0 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

.nav-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: none;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  font-family: var(--font-mono);
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-icon.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.view-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.view-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.view-tab-btn:hover {
  color: var(--text-primary);
}

.view-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   App Layout (Sidebar + Main Workspace)
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* --------------------------------------------------------------------------
   Sidebar (Рубрикатор)
   -------------------------------------------------------------------------- */
.sidebar {
  width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: 30;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
  visibility: hidden;
}

.sidebar-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-reset-btn {
  background: transparent;
  border: none;
  font-size: 11.5px;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: none;
}

.sidebar-reset-btn:hover {
  text-decoration: underline;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
}

.filter-group-title svg {
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.9;
}

/* Sections List (Tree/Buttons) */
.section-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  border: 1px solid transparent;
}

.section-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.section-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.25);
  font-weight: 600;
}

.section-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-item-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.section-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.section-item.active .section-badge {
  background: var(--accent);
  color: #ffffff;
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.section-item.section-item-internal {
  border-left: 2px solid rgba(244, 63, 94, 0.45);
}

.section-item.section-item-internal:hover {
  border-left-color: #f43f5e;
}

.section-item.section-item-internal.active {
  border-left-color: #f43f5e;
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
}

.section-item.section-item-internal.active .section-badge {
  background: #f43f5e;
  color: #ffffff;
}

.section-item.section-item-aux {
  opacity: 0.85;
}

.section-item.section-item-aux:hover {
  opacity: 1;
}

/* Pills & Chips (Years, Types, People, Tags) */
.years-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar-chip,
.filter-chip,
.chip {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
  text-align: left;
}

.sidebar-chip:hover,
.filter-chip:hover,
.chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.sidebar-chip:active,
.filter-chip:active,
.chip:active {
  transform: translateY(0);
}

.sidebar-chip.active,
.filter-chip.active,
.chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(var(--accent-rgb), 0.15);
}

.sidebar-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.sidebar-chip-count,
.filter-chip-count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-app);
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.15s ease;
  margin-left: auto;
}

.sidebar-chip.active .sidebar-chip-count,
.filter-chip.active .sidebar-chip-count,
.chip.active .sidebar-chip-count {
  background: var(--accent);
  color: #ffffff;
}

.sidebar-chip-icon {
  font-size: 11px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-chip-hash {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

/* Year chip specializations */
.year-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
}

.year-chip.all-years-btn {
  grid-column: 1 / -1;
  font-family: var(--font-sans);
  font-weight: 500;
  justify-content: space-between;
}

.year-chip.all-years-btn .sidebar-chip-label {
  max-width: none;
}

/* --------------------------------------------------------------------------
   Main Workspace
   -------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background: var(--bg-app);
}

/* --------------------------------------------------------------------------
   View: Catalog / Cards View
   -------------------------------------------------------------------------- */
.catalog-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.catalog-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.catalog-stats-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.catalog-stats-count {
  font-weight: 700;
  color: var(--text-primary);
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.active-filter-tag {
  background: var(--accent-light);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.active-filter-tag-remove {
  cursor: pointer;
  font-weight: bold;
}

.catalog-sort-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.catalog-sort-select:focus {
  border-color: var(--accent);
}

/* Cards Container */
.catalog-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.cards-grid.list-mode {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Card Component (Harmonized River/Memorial Aesthetic) */
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease,
              background-color 0.2s ease;
}

.doc-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.doc-card:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.45), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
}

.doc-card:hover::before {
  opacity: 1;
}

/* Card Header */
.doc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.doc-card-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Badges Base & Types */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.doc-card-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  background: none;
}

.doc-card-type {
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  line-height: 1;
}

.doc-card-type:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.doc-type-icon {
  font-size: 12px;
  line-height: 1;
}

.doc-type-text {
  font-size: 11px;
  font-weight: 600;
}

.doc-card-year {
  padding: 3px 8px;
  background: var(--accent-warm-light);
  color: var(--accent-warm);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 11px;
}

.doc-card-year:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.45);
  transform: translateY(-1px);
}

/* Bookmark Button */
.doc-bookmark-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.doc-bookmark-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warm);
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.doc-bookmark-btn.active {
  background: var(--accent-warm-light);
  color: var(--accent-warm);
  border-color: var(--accent-warm);
}

.doc-bookmark-btn.active svg {
  fill: currentColor;
}

/* Card Body */
.doc-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.doc-card-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.doc-card:hover .doc-card-title {
  color: var(--accent);
}

.doc-card-excerpt {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

/* Tags Container & Chips */
.doc-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.doc-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.doc-tag-hash {
  color: var(--accent);
  opacity: 0.75;
  font-weight: 600;
}

.doc-tag-chip:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.35);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.doc-tag-chip:hover .doc-tag-hash {
  opacity: 1;
}

/* Card Footer */
.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: auto;
}

.doc-card-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.doc-card:hover .doc-card-section {
  color: var(--text-secondary);
}

.doc-section-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.doc-card-words,
.doc-card-readtime {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.doc-footer-icon {
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.doc-card:hover .doc-footer-icon {
  opacity: 0.95;
}

/* Search Highlights */
.doc-card-match {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--accent-warm);
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

mark {
  background: #fde047;
  color: #1e293b;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* List Mode Overrides */
.cards-grid.list-mode .doc-card {
  flex-direction: row;
  align-items: center;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  gap: 16px;
}

.cards-grid.list-mode .doc-card::before {
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.cards-grid.list-mode .doc-card-header {
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cards-grid.list-mode .doc-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cards-grid.list-mode .doc-card-title {
  margin-bottom: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.cards-grid.list-mode .doc-card-excerpt {
  margin-bottom: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.cards-grid.list-mode .doc-card-tags {
  display: none;
}

.cards-grid.list-mode .doc-card-footer {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  flex-shrink: 0;
  gap: 12px;
  width: auto;
}

.cards-grid.list-mode .doc-card-section {
  max-width: 140px;
}

.cards-grid.list-mode .doc-card-words {
  display: none;
}

@media (max-width: 900px) {
  .cards-grid.list-mode .doc-card-excerpt {
    display: none;
  }
}

@media (max-width: 680px) {
  .cards-grid.list-mode .doc-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }
  .cards-grid.list-mode .doc-card-header {
    width: 100%;
    justify-content: space-between;
  }
  .cards-grid.list-mode .doc-card-footer {
    width: 100%;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
  }
  .cards-grid.list-mode .doc-card-section {
    max-width: 60%;
  }
}

.btn-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-card:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-card-primary {
  background: var(--accent);
  color: #ffffff !important;
  border-color: var(--accent);
}

.btn-card-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   View: Markdown Reader
   -------------------------------------------------------------------------- */
.reader-view {
  flex: 1;
  display: none;
  flex-direction: column;
  background: var(--bg-surface);
  overflow: hidden;
  z-index: 20;
}

.reader-view.active {
  display: flex;
}

/* Reader Toolbar */
.reader-toolbar {
  height: 52px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.reader-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-breadcrumb-link {
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}

.reader-breadcrumb-link:hover {
  color: var(--accent);
}

.reader-breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Reading Progress Bar */
.reader-progress-bar {
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  position: absolute;
  top: 52px;
  left: 0;
  z-index: 30;
  transition: width 0.1s linear;
}

/* Reader Workspace (Content + TOC) */
.reader-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.reader-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 36px 32px 80px;
  display: flex;
  justify-content: center;
}

.reader-article {
  width: 100%;
  max-width: var(--reader-max-width);
  font-family: var(--reader-font);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: var(--text-primary);
}

/* Table of Contents (TOC) Sidebar in Reader */
.reader-toc-sidebar {
  width: 270px;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  padding: 20px 12px 36px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.reader-toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.reader-toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.reader-toc-sidebar.hidden {
  display: none !important;
}

.reader-toc-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  user-select: none;
}

.reader-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.toc-item {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

/* Interactive TOC Links & Buttons */
.toc-link,
.reader-toc-link {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 450;
  color: var(--text-secondary);
  text-decoration: none;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  outline: none;
}

.toc-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.45;
  margin-top: 6px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.toc-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Level Indentation & Visual Hierarchy */
.toc-link.toc-level-1 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.toc-link.toc-level-2 {
  padding-left: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.toc-link.toc-level-2 .toc-bullet {
  width: 4px;
  height: 4px;
  opacity: 0.35;
}

.toc-link.toc-level-3,
.reader-toc-link.level-3 {
  padding-left: 22px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.toc-link.toc-level-3 .toc-bullet {
  width: 3px;
  height: 3px;
  opacity: 0.3;
}

.toc-link.toc-level-4 {
  padding-left: 28px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Hover States (User Request: "выделяются пункты на подведение и курсор") */
.toc-link:hover,
.reader-toc-link:hover,
.toc-item:hover .toc-link {
  color: var(--accent);
  background: var(--bg-surface-hover);
  border-left-color: rgba(var(--accent-rgb), 0.5);
  cursor: pointer;
}

.toc-link:hover .toc-bullet {
  background: var(--accent);
  opacity: 0.9;
  transform: scale(1.4);
}

/* Active State (ScrollSpy & Selected Anchor) */
.toc-link.active,
.reader-toc-link.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.toc-link.active .toc-bullet {
  background: var(--accent);
  opacity: 1;
  transform: scale(1.5);
}

.toc-link.active .toc-text {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Markdown Typography & Formatting (Prose)
   -------------------------------------------------------------------------- */
.reader-article h1 {
  font-size: 2.1em;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
  scroll-margin-top: 20px;
}

.reader-article h2 {
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 36px;
  margin-bottom: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  scroll-margin-top: 20px;
}

.reader-article h3 {
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 26px;
  margin-bottom: 10px;
  color: var(--text-primary);
  scroll-margin-top: 20px;
}

.reader-article h4,
.reader-article h5,
.reader-article h6 {
  font-size: 1.05em;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.reader-article p {
  margin-bottom: 18px;
}

.reader-article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.reader-article a:hover {
  color: var(--accent-hover);
}

.reader-article ul,
.reader-article ol {
  margin-bottom: 18px;
  padding-left: 28px;
}

.reader-article li {
  margin-bottom: 6px;
}

.reader-article blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  padding: 12px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.reader-article blockquote p:last-child {
  margin-bottom: 0;
}

/* Callout Alerts [!NOTE], [!IMPORTANT], [!TIP], [!WARNING], [!CAUTION] */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border-left: 4px solid;
  font-style: normal;
}

.callout-note {
  border-left-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.callout-tip {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.callout-important {
  border-left-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
}

.callout-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.callout-caution {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.callout-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tables */
.reader-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.reader-article th,
.reader-article td {
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  text-align: left;
}

.reader-article th {
  background: var(--bg-surface-hover);
  font-weight: 600;
}

.reader-article tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.03);
}

/* Code */
.reader-article code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--tag-bg);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

.reader-article pre {
  background: #0f141f;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
  overflow-x: auto;
  position: relative;
}

.reader-article pre code {
  background: transparent;
  color: #e2e8f0;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Media Players inside Markdown */
.media-embed-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.media-embed-title {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}

.audio-player-custom {
  width: 100%;
  border-radius: var(--radius-md);
  outline: none;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --------------------------------------------------------------------------
   Modal Dialogs (Stats, Settings, Help)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 14px;
}

/* Stats Dashboard Grid */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-metric-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.stat-metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .nav-search-container {
    max-width: 380px;
  }
  .nav-mode-btn {
    padding: 6px 9px;
    font-size: 12.5px;
    gap: 5px;
  }
}

@media (max-width: 1024px) {
  .reader-toc-sidebar {
    position: absolute;
    top: 52px;
    right: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
    display: none;
  }
  .reader-toc-sidebar:not(.hidden) {
    display: flex;
  }
  .brand-sub {
    display: none;
  }
  .nav-search-container {
    max-width: 280px;
  }
  .view-tabs {
    display: none;
  }
}

@media (max-width: 860px) {
  .nav-mode-btn .mode-badge {
    display: none;
  }
  .media-top-nav-bar,
  .photos-top-nav-bar,
  .tg-top-nav-bar {
    padding: 10px 16px;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-title span:last-child {
    display: none;
  }
  .nav-mode-btn span.mode-label {
    display: none;
  }
  .nav-mode-btn {
    padding: 6px 8px;
  }
  .nav-modes {
    margin-left: 4px;
  }
  .nav-search-container {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
  }
  .search-kbd {
    display: none;
  }
  .media-hero {
    padding: 18px 16px 22px;
  }
  .media-hero-title {
    font-size: 20px;
  }
  .media-toolbar {
    padding: 12px 16px;
  }
  .media-scroll {
    padding: 16px 16px 40px;
  }
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    visibility: visible;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .stats-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body {
    overflow: visible;
    height: auto;
    background: #ffffff !important;
    color: #000000 !important;
  }

  .navbar,
  .sidebar,
  .reader-toolbar,
  .reader-toc-sidebar,
  .catalog-view,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .main-content,
  .reader-view,
  .reader-workspace,
  .reader-content-scroll {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .reader-article {
    max-width: 100% !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #000000 !important;
  }

  .reader-article a {
    color: #000000 !important;
    text-decoration: underline !important;
  }
}

/* ==========================================================================
   Portal Navigation Modes (Docs / Photos / Telegram)
   ========================================================================== */
.nav-modes {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-left: 12px;
}

.nav-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-mode-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.nav-mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
}

.mode-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.nav-mode-btn.active .mode-badge {
  background: var(--accent-light);
  color: var(--accent);
}

/* ==========================================================================
   Photos View (Google Drive Gallery)
   ========================================================================== */
.photos-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

.photos-toolbar {
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.photos-search-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.photos-search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.photos-search-input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.photos-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.photos-stats-badge {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.photos-stats-badge strong {
  color: var(--accent);
  font-weight: 700;
}

.photos-filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.photos-filter-years {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.photo-year-chip {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.photo-year-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.photo-year-chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.photos-controls-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.photos-select-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.photos-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  max-width: 190px;
}

.photos-select:focus {
  border-color: var(--accent);
}

.photos-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.photos-checkbox-label input {
  accent-color: var(--accent);
  cursor: pointer;
}

.photos-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 60px;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  position: relative;
}

.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.photo-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-card:hover .photo-thumb {
  transform: scale(1.04);
}

.photo-fallback-icon {
  font-size: 40px;
  color: var(--text-muted);
}

.photo-badge-top-left {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.photo-badge-top-right {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.photo-badge-rating {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.photo-badge-rating.gold {
  background: rgba(234, 179, 8, 0.3);
  border-color: #eab308;
  color: #fef08a;
}

.photo-tag-chip {
  transition: all 0.15s ease;
}

.photo-tag-chip:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  transform: translateY(-1px);
}

.photo-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.photo-card-filename {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card-category {
  font-size: 11.5px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

.photo-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
}

.photo-card-photographer {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.photo-card-drive-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
}

.photo-card-drive-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.photos-load-more {
  display: flex;
  justify-content: center;
  padding: 30px 0;
}

.photos-load-more-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
}

/* Photo Modal / Lightbox */
.photo-modal-box {
  max-width: 960px;
  width: 95%;
  max-height: 92vh;
}

.photo-modal-body {
  display: flex;
  gap: 20px;
  padding: 18px 24px;
  overflow-y: auto;
  max-height: calc(92vh - 65px);
}

@media (max-width: 820px) {
  .photo-modal-body {
    flex-direction: column;
  }
}

.photo-modal-preview-wrap {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.photo-modal-img-container {
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  max-height: 480px;
  border: 1px solid var(--border-subtle);
}

.photo-modal-img-container img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.photo-modal-nav-btns {
  display: flex;
  justify-content: space-between;
  position: absolute;
  top: 50%;
  left: -12px;
  right: -12px;
  transform: translateY(-50%);
  pointer-events: none;
}

.photo-modal-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s;
  box-shadow: var(--shadow-md);
}

.photo-modal-nav-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.photo-modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photo-modal-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: 8px;
}

.photo-modal-desc-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.photo-modal-sec-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.photo-modal-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-primary);
}

.photo-modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.photo-meta-item {
  display: flex;
  font-size: 12.5px;
  line-height: 1.4;
  gap: 8px;
}

.photo-meta-item .meta-label {
  color: var(--text-muted);
  min-width: 130px;
  flex-shrink: 0;
}

.photo-meta-item .meta-value {
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}

.photo-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.photo-drive-link-btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-align: center;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
}

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

/* ==========================================================================
   Telegram Archive View
   ========================================================================== */
.telegram-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-app);
}

.tg-hero {
  padding: 32px 36px 28px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%), var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.tg-hero-content {
  max-width: 1000px;
  margin: 0 auto;
}

.tg-hero-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.tg-hero-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.tg-hero-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.tg-stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tg-stat-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.tg-stat-pill strong {
  color: var(--text-primary);
}

.tg-hero-actions {
  margin-top: 16px;
}

.tg-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.tg-hero-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tg-nav-tabs {
  padding: 10px 36px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.tg-tab-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tg-tab-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.tg-tab-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.tg-search-bar-wrap {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.tg-search-bar-wrap .search-icon-svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.tg-search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tg-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tg-docs-intro {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.06), rgba(99, 102, 241, 0.06)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
}

.tg-docs-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.tg-docs-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tg-docs-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tg-docs-open-all-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.tg-docs-open-all-btn:hover {
  opacity: 0.9;
}

.tg-content-area {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 36px 60px;
}

.tg-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.tg-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.tg-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

.tg-card.theme-blue::before { background: #38bdf8; }
.tg-card.theme-purple::before { background: #a855f7; }
.tg-card.theme-amber::before { background: #f59e0b; }
.tg-card.theme-green::before { background: #10b981; }
.tg-card.theme-rose::before { background: #f43f5e; }
.tg-card.theme-teal::before { background: #14b8a6; }
.tg-card.theme-indigo::before { background: #6366f1; }
.tg-card.theme-orange::before { background: #f97316; }
.tg-card.theme-cyan::before { background: #06b6d4; }
.tg-card.theme-emerald::before { background: #059669; }
.tg-card.theme-violet::before { background: #7c3aed; }
.tg-card.theme-sky::before { background: #0284c7; }

.tg-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.tg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tg-card-icon-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tg-card-icon {
  font-size: 24px;
}

.tg-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.tg-card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.tg-card-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.tg-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-card-btn {
  margin-top: auto;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.tg-card-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Timeline */
.tg-timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  padding-left: 30px;
}

.tg-timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 11px;
  width: 2px;
  background: var(--border-strong);
}

.tg-timeline-item {
  position: relative;
}

.tg-timeline-dot {
  position: absolute;
  left: -29px;
  top: 20px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--bg-app);
  box-shadow: var(--shadow-sm);
}

.tg-chat-intro {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.tg-team-filter-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Omnisearch Live Dropdown
   ========================================================================== */
.nav-search-container {
  position: relative;
}

.nav-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 480px;
  overflow-y: auto;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 0;
}

.search-drop-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-drop-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}

.search-drop-item:hover {
  background: var(--bg-surface-hover);
  border-left-color: var(--accent);
}

.search-drop-icon {
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-light);
  color: var(--accent);
}

.search-drop-content {
  flex: 1;
  min-width: 0;
}

.search-drop-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.search-drop-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-drop-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Bookmarks Button & Badge
   ========================================================================== */
.btn-bookmarks {
  position: relative;
}

.bookmarks-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-warm);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Fairway Location Chips in Sidebar
   ========================================================================== */
.location-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.location-chip-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.location-chip-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.location-chip-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.location-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.location-chip-btn.active .location-chip-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ==========================================================================
   Media Hub & Video View
   ========================================================================== */
.media-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--bg-app);
}

/* Media Top Navigation Bar (Consistent across Media, Photos, Telegram) */
.media-top-nav-bar,
.photos-top-nav-bar,
.tg-top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 32px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  z-index: 10;
}

.media-top-nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.media-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.media-back-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-3px);
}

.media-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.media-crumb-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.media-crumb-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.media-crumb-sep {
  color: var(--text-muted);
  user-select: none;
}

.media-crumb-current {
  color: var(--text-secondary);
  font-weight: 600;
}

.media-top-nav-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.media-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.media-nav-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.media-nav-pill.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.media-quick-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.media-quick-back-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* Media Hero Banner (Theme adaptive) */
.media-hero {
  position: relative;
  padding: 24px 32px 28px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.07) 0%, rgba(56, 189, 248, 0.03) 100%), var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .media-hero {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(8, 12, 20, 0.98) 100%), var(--bg-surface);
}

[data-theme="light"] .media-hero {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, rgba(56, 189, 248, 0.02) 100%), #ffffff;
}

[data-theme="sepia"] .media-hero {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.08) 0%, rgba(217, 119, 6, 0.04) 100%), #fdfaf3;
}

.media-hero-bg-svg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

[data-theme="light"] .media-hero-bg-svg {
  opacity: 0.65;
}

[data-theme="sepia"] .media-hero-bg-svg {
  opacity: 0.45;
}

.river-wave-vector {
  width: 100%;
  height: 100%;
  display: block;
}

.media-hero-content {
  position: relative;
  z-index: 2;
  max-width: 920px;
}

.media-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--accent-light);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-full);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

[data-theme="light"] .media-hero-badge {
  border-color: rgba(2, 132, 199, 0.25);
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
}

[data-theme="sepia"] .media-hero-badge {
  border-color: rgba(180, 83, 9, 0.25);
  background: rgba(180, 83, 9, 0.1);
  color: #b45309;
}

.media-hero-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

[data-theme="light"] .media-hero-title {
  color: #0f172a;
}

[data-theme="sepia"] .media-hero-title {
  color: #2d241e;
}

.media-hero-desc {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 880px;
}

[data-theme="light"] .media-hero-desc {
  color: #475569;
}

[data-theme="sepia"] .media-hero-desc {
  color: #635449;
}

.media-stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-stat-pill {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .media-stat-pill {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(51, 65, 85, 0.8);
  color: #94a3b8;
}

[data-theme="light"] .media-stat-pill {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="sepia"] .media-stat-pill {
  background: #fdfaf3;
  border-color: #e2d7c0;
  color: #635449;
}

.media-stat-pill strong {
  color: var(--accent);
  font-weight: 700;
}

/* Media Toolbar (Sticky on scroll, like Telegram archive tabs) */
.media-toolbar {
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 12px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}

.media-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.media-search-box {
  position: relative;
  flex: 1;
  max-width: 600px;
}

.media-search-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 38px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

.media-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.media-categories-bar,
.media-years-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.media-cat-chip,
.media-year-chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.media-cat-chip:hover,
.media-year-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.media-cat-chip.active,
.media-year-chip.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* Media Scroll & Grid */
.media-scroll {
  padding: 24px 32px 60px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

/* Media Card */
.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.media-card-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #091224, #152238);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.media-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.35s ease;
  z-index: 1;
}

.media-card:hover .media-poster-img {
  transform: scale(1.06);
}

.media-poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.45) 50%, rgba(0, 0, 0, 0.8) 100%);
  z-index: 2;
  pointer-events: none;
}

.media-play-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  z-index: 3;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.media-card:hover .media-play-icon-wrap {
  transform: scale(1.15);
  background: var(--accent);
  color: #0b0e14;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.65);
}

.media-badge-duration {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}

.media-badge-year {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(234, 179, 8, 0.95);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 3;
}

.media-badge-cat {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 3;
  backdrop-filter: blur(4px);
}

.media-card-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.media-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.media-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.media-meta-row span {
  color: var(--text-secondary);
}

.media-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.media-btn-primary {
  flex: 1;
  background: var(--accent);
  color: #0b0e14;
  border: none;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  transition: all 0.2s ease;
}

.media-btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.media-btn-sub {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.media-btn-sub:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Curated Media Section Header */
.media-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.media-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.media-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.media-section-count {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Google Drive Video Archive System (587 files, Year-by-Year Accordions)
   ========================================================================== */
.cloud-archive-section {
  margin-top: 36px;
  margin-bottom: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.cloud-archive-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cloud-archive-title-wrap {
  flex: 1;
  min-width: 280px;
}

.cloud-archive-heading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cloud-archive-heading-row svg {
  color: var(--accent);
  flex-shrink: 0;
}

.cloud-archive-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.015em;
}

.cloud-archive-count-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.cloud-archive-subtitle {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
  max-width: 820px;
}

.cloud-archive-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cloud-ctrl-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cloud-ctrl-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* Filter Toolbar within Cloud Archive */
.cloud-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.cloud-search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.cloud-search-box svg {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.cloud-search-input {
  width: 100%;
  padding: 8px 32px 8px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s ease;
}

.cloud-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.cloud-format-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cloud-fmt-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cloud-fmt-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.cloud-fmt-chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Years Accordion System */
.cloud-years-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cloud-year-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cloud-year-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.cloud-year-card.open {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: var(--shadow-sm);
}

.cloud-year-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  user-select: none;
  text-align: left;
  transition: background 0.15s ease;
  gap: 12px;
}

.cloud-year-header:hover {
  background: var(--bg-surface-hover);
}

.cloud-year-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.cloud-year-badge {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.28);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.cloud-year-theme {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 460px;
}

.cloud-year-count-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.cloud-year-formats-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.cloud-year-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cloud-year-expand-text {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.cloud-year-chevron {
  color: var(--text-muted);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.cloud-year-card.open .cloud-year-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.cloud-year-body {
  display: none;
  padding: 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.cloud-year-card.open .cloud-year-body {
  display: block;
}

/* Subfolders Filter Bar inside a Year */
.cloud-folders-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: thin;
}

.cloud-folder-pill {
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cloud-folder-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.cloud-folder-pill.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Videos Grid within a Year */
.cloud-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

/* Individual Video Item Card with Preview Thumbnail */
.cloud-video-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cloud-video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: var(--shadow-md);
}

.cloud-video-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: linear-gradient(135deg, #091224, #152238);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.cloud-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.3s ease;
  z-index: 1;
}

.cloud-video-card:hover .cloud-poster-img {
  transform: scale(1.06);
}

.cloud-poster-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 6px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8));
  z-index: 1;
}

.cloud-fallback-fmt {
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--accent);
}

.cloud-poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 2;
  pointer-events: none;
}

.cloud-poster-play {
  position: absolute;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.2s ease;
}

.cloud-video-card:hover .cloud-poster-play {
  transform: scale(1.15);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

.cloud-video-poster .cloud-fmt-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
}

.cloud-fmt-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cloud-fmt-badge.fmt-mp4 {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  backdrop-filter: blur(4px);
}

.cloud-fmt-badge.fmt-mov {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  backdrop-filter: blur(4px);
}

.cloud-fmt-badge.fmt-mts {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  backdrop-filter: blur(4px);
}

.cloud-video-size-badge {
  position: absolute;
  top: 8px;
  right: 38px;
  z-index: 3;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cloud-poster-bm {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cloud-poster-bm:hover, .cloud-poster-bm.active {
  color: var(--accent-warm);
  border-color: var(--accent-warm);
}

.cloud-video-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cloud-video-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.cloud-video-folder {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 10px 0;
}

.cloud-video-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.cloud-btn-play {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s ease;
}

.cloud-btn-play:hover {
  opacity: 0.9;
}

.cloud-btn-drive {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.cloud-btn-drive:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Photos 2.0 Presets & Star Ratings
   ========================================================================== */
.photos-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.photos-preset-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.photos-preset-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.photos-preset-btn.active {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border-color: #eab308;
  font-weight: 700;
}

.photo-card-rating-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #eab308;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.photo-card-bookmark-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.photo-card:hover .photo-card-bookmark-btn {
  opacity: 1;
}

.photo-card-bookmark-btn:hover,
.photo-card-bookmark-btn.active {
  background: var(--accent-warm);
  color: #000;
  border-color: var(--accent-warm);
  opacity: 1;
}

/* Lightbox 2.0 Zoom Toolbar */
.photo-zoom-toolbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  backdrop-filter: blur(12px);
  z-index: 10;
}

.photo-zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.photo-zoom-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--accent);
}

.photo-zoom-level {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

.photo-modal-ai-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-weight: 600;
}

.photo-eval-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.photo-eval-stars {
  font-size: 13px;
  color: #eab308;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

.photo-eval-tier {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.photo-eval-text {
  font-size: 12.5px;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.5;
}

.photo-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.photo-interactive-tag {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.photo-interactive-tag:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   Video Player Modal
   ========================================================================== */
.video-modal-box {
  max-width: 1000px;
  width: 95%;
  max-height: 90vh;
}

.video-modal-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(90vh - 65px);
}

.video-player-frame-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  position: relative;
  flex-shrink: 0;
}

.video-player-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-modal-details {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-modal-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.video-modal-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.video-timestamps-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.video-timestamps-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}

.video-timestamp-item {
  padding: 6px 10px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.video-timestamp-item:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.video-ts-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
}

.video-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.video-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 14px;
}

.video-action-btn.primary {
  background: var(--accent);
  color: #0b0e14;
  border-color: var(--accent);
  font-weight: 700;
}

/* ==========================================================================
   Bookmarks Modal
   ========================================================================== */
.bookmarks-modal-box {
  max-width: 760px;
  width: 90%;
  max-height: 85vh;
}

.bookmarks-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 65px);
  overflow-y: auto;
}

.bookmarks-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.bookmarks-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bookmarks-tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.bookmarks-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bookmark-item-card {
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease;
}

.bookmark-item-card:hover {
  border-color: var(--border-strong);
}

.bookmark-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.bookmark-item-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.bookmark-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-item-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.bookmark-remove-btn {
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}

.bookmark-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Interactive Fairway Map Modal
   ========================================================================== */
.route-modal-box {
  max-width: 1040px;
  width: 95%;
  max-height: 90vh;
}

.route-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(90vh - 65px);
  overflow-y: auto;
}

.route-map-wrap {
  width: 100%;
  background: linear-gradient(135deg, #090e18, #0e1726);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.fairway-svg-map {
  width: 100%;
  height: auto;
  display: block;
}

.water-flow-path {
  animation: waterFlow 30s linear infinite;
}

@keyframes waterFlow {
  from { stroke-dashoffset: 200; }
  to { stroke-dashoffset: 0; }
}

.route-node {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.route-node:hover {
  transform: scale(1.15);
}

.node-pulse {
  animation: pulseNode 2.5s ease-in-out infinite;
}

@keyframes pulseNode {
  0%, 100% { r: 18px; opacity: 0.6; }
  50% { r: 24px; opacity: 0.2; }
}

.node-label {
  fill: #fff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.node-label.highlight {
  fill: #38bdf8;
  font-size: 13px;
}

.node-sub {
  fill: #94a3b8;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
}

.route-node-details-card {
  padding: 18px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 80px;
  display: flex;
  align-items: center;
}

.route-card-prompt {
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
}

.route-station-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.route-station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.route-station-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.route-station-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.route-station-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.route-station-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ==========================================================================
   Thematic River & Steamship Preloader (Канал Памяти)
   ========================================================================== */
.app-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at 50% 40%, #0f1d2a 0%, #070d14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
  opacity: 1;
  visibility: visible;
  overflow: hidden;
}

.app-preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  max-width: 360px;
  width: 90%;
}

.preloader-ship-container {
  width: 280px;
  height: 160px;
  position: relative;
  margin-bottom: 24px;
}

.preloader-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Steamship rocking motion */
.preloader-steamship {
  transform-origin: 140px 90px;
  animation: shipRock 3s ease-in-out infinite;
}

@keyframes shipRock {
  0%, 100% {
    transform: translateY(0) rotate(-1.2deg);
  }
  50% {
    transform: translateY(3.5px) rotate(1.2deg);
  }
}

/* River Waves flowing animation */
.wave-back {
  animation: waveScrollBack 4s linear infinite;
}

.wave-front {
  animation: waveScrollFront 2.8s linear infinite;
}

.wave-foam {
  animation: waveScrollFront 2.8s linear infinite;
}

@keyframes waveScrollBack {
  0% { transform: translateX(0); }
  100% { transform: translateX(80px); }
}

@keyframes waveScrollFront {
  0% { transform: translateX(0); }
  100% { transform: translateX(-80px); }
}

/* Steam Puffs from Chimney */
.preloader-steam {
  animation: steamRise 2s ease-out infinite;
  transform-origin: 120px 50px;
}

.puff-1 { animation-delay: 0s; }
.puff-2 { animation-delay: 0.6s; }
.puff-3 { animation-delay: 1.2s; }

@keyframes steamRise {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }
  30% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(-14px, -24px) scale(1.8);
  }
}

/* Pulsating Fairway Beacon Light */
.preloader-beacon-glow {
  animation: beaconPulse 2s ease-in-out infinite;
  transform-origin: 140px 34px;
}

@keyframes beaconPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Text and Progress */
.preloader-text-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.preloader-title {
  font-family: var(--font-serif, "Merriweather", Georgia, serif);
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.preloader-sub {
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 16px;
}

.preloader-progress-track {
  width: 100%;
  max-width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
}

.preloader-progress-bar {
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9, #38bdf8);
  border-radius: 9999px;
  animation: waterStreamProgress 1.8s ease-in-out infinite;
}

@keyframes waterStreamProgress {
  0% {
    transform: translateX(-100%);
    width: 25%;
  }
  50% {
    width: 60%;
  }
  100% {
    transform: translateX(350%);
    width: 30%;
  }
}

.preloader-status {
  font-size: 12.5px;
  color: #38bdf8;
  font-weight: 500;
  letter-spacing: 0.2px;
  min-height: 18px;
  transition: opacity 0.2s ease;
}


