/* ============================================================
   LAYOUT — каркас приложения, тайтлбар, навигация, контейнер вида
   ============================================================ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.main {
  flex: 1;
  display: flex;
  min-height: 0;
}
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
.view:focus {
  outline: none;
}
.view-inner {
  animation: fade 0.18s ease;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Titlebar ---------- */

.titlebar {
  height: 42px;
  flex-shrink: 0;
  background: var(--titlebar);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  border-bottom: 1px solid #2b2b2b;
  user-select: none;
}

.titlebar-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 18px;
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.38) 0%,
    rgba(0, 122, 204, 0.38) 100%
  );
  border: 1px solid rgba(124, 58, 237, 0.7);
  border-radius: 8px;
  color: #f1e8ff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition:
    background 0.18s,
    color 0.18s,
    border-color 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.12) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 4px 14px -8px rgba(124, 58, 237, 0.55);
}
.titlebar-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.6) 0%,
    rgba(0, 122, 204, 0.6) 100%
  );
  border-color: rgba(124, 58, 237, 0.95);
  color: #fff;
  box-shadow:
    0 0 24px -4px rgba(124, 58, 237, 0.85),
    0 0 0 1px rgba(124, 58, 237, 0.25) inset,
    0 6px 20px -8px rgba(124, 58, 237, 0.7);
  transform: translateY(-1px);
}
.titlebar-btn:active {
  transform: translateY(0);
}
.titlebar-btn.active {
  background: linear-gradient(135deg, #7c3aed 0%, #007acc 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 26px -6px rgba(124, 58, 237, 0.9);
}
.titlebar-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Titlebar nav ---------- */

.titlebar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #8c8c8c;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 1;
  min-width: 0;
}
.titlebar-nav::-webkit-scrollbar {
  display: none;
}
.titlebar-nav a {
  color: #b5b5b5;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
  transition:
    color 0.15s,
    background 0.15s;
  white-space: nowrap;
}
.titlebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.titlebar-nav a.active {
  color: var(--accent);
}
.titlebar-nav .nav-sep {
  color: #4a4a4a;
  user-select: none;
  font-size: 11px;
}

/* ---------- Кнопка поиска в тайтлбаре ---------- */

.titlebar-btn--search {
  margin-left: auto;
  min-width: 180px;
  justify-content: center;
  padding: 0 28px;
  background: linear-gradient(
    135deg,
    rgba(0, 122, 204, 0.3) 0%,
    rgba(0, 122, 204, 0.22) 100%
  );
  border-color: rgba(0, 122, 204, 0.55);
  color: #dbeaf7;
}
.titlebar-btn--search:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 122, 204, 0.55) 0%,
    rgba(0, 122, 204, 0.4) 100%
  );
  border-color: rgba(0, 122, 204, 0.95);
  box-shadow:
    0 0 24px -4px rgba(0, 122, 204, 0.7),
    0 0 0 1px rgba(0, 122, 204, 0.2) inset;
}

/* ---------- Адаптив ---------- */

@media (max-width: 900px) {
  /* Навигация остаётся доступной: при нехватке места работает горизонтальная прокрутка. */
  .titlebar-nav {
    flex: 1;
    margin-left: 0;
  }
  .titlebar-btn--search {
    min-width: 120px;
    padding: 0 16px;
  }
}
@media (max-width: 600px) {
  .titlebar {
    gap: 8px;
    padding: 0 8px;
  }
  .titlebar-btn span {
    display: none;
  }
  .titlebar-btn {
    padding: 0 14px;
    height: 34px;
  }
  .titlebar-btn svg {
    width: 20px;
    height: 20px;
  }
  .titlebar-btn--search {
    min-width: 0;
    padding: 0 14px;
  }
  .titlebar-btn--search span {
    display: none;
  }
  .titlebar-btn--search {
    padding: 0 12px;
  }
}
