/* Radio Logs UI v2.2 - Application Shell */
:root {
  --sidebar-width: 272px;
  --topbar-height: 72px;
}

.app-shell-v22 {
  min-height: 100vh;
  background: var(--bg);
}

.app-shell-v22.is-authenticated {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
}

.app-sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.app-logo:hover {
  text-decoration: none;
}

.app-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--whro));
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.app-logo-text strong,
.app-logo-text em {
  display: block;
}

.app-logo-text strong {
  font-size: 17px;
  letter-spacing: -0.04em;
}

.app-logo-text em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  margin-top: 1px;
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section {
  margin-bottom: 22px;
}

.nav-section-label {
  padding: 0 10px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  margin-bottom: 4px;
}

.app-nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.app-nav-link.is-active {
  background: var(--info-bg);
  color: var(--info-text);
}

.app-nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  flex: 0 0 auto;
}

.app-nav-link.is-active .nav-icon {
  background: var(--primary);
  color: #fff;
}

.app-sidebar-footer {
  padding: 14px 12px 18px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.user-card-text {
  min-width: 0;
}

.user-card-text strong,
.user-card-text em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-text strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.user-card-text em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.app-main-shell {
  min-width: 0;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.app-topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.app-topbar-title strong,
.app-topbar-title span {
  display: block;
}

.app-topbar-title strong {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
}

.app-topbar-title span {
  margin-top: 1px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.app-content.page-wrap {
  max-width: var(--content-width);
  padding: 28px 32px 40px;
}

.message-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.icon-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 900;
}

.icon-btn:hover {
  background: var(--surface-hover);
}

.mobile-menu-btn {
  display: none;
}

/* Hide old top-nav header styles if remnants are present */
.site-header {
  display: none !important;
}

.app-shell-v22 .page-header {
  margin-top: 0;
}

/* Public/login pages keep a centered topbar-only layout */
.app-shell-v22.is-public .app-topbar {
  justify-content: center;
}

.app-shell-v22.is-public .app-content.page-wrap {
  max-width: 760px;
}

@media (max-width: 1100px) {
  .app-shell-v22.is-authenticated {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  }

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

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 90;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .app-topbar {
    padding: 12px 18px;
  }

  .app-content.page-wrap {
    padding: 22px 18px 34px;
  }
}

@media (max-width: 720px) {
  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-topbar-actions {
    justify-content: flex-start;
  }

  .app-topbar-actions .secondary-btn span:not(.btn-icon) {
    display: none;
  }
}
