/* ==========================================================================
   Falcon Dive x FIFA World Cup 2026 — Layout
   Top bar, sidebar, main content area, footer, responsive breakpoints
   ========================================================================== */

/* ==========================================================================
   App Shell
   ========================================================================== */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Top Bar — Fixed 64px
   ========================================================================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.top-bar__left {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.top-bar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.top-bar__logo-img {
  height: 22px;
  width: auto;
  display: block;
}

.top-bar__logo-subtitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-bar__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}

.top-bar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.top-bar__subtitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.top-bar__live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
}

.top-bar__live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
  animation: pulse-live 1.5s ease-in-out infinite;
}

.top-bar__alerts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.top-bar__alerts-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.top-bar__alerts-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live-red);
}

.top-bar__live-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  min-width: 260px;
  padding: 8px 0;
  z-index: 1001;
  box-shadow: var(--elevation-popover);
}
.top-bar__live-dropdown.is-open {
  display: block;
}

.top-bar__live-dropdown-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s ease;
}
.top-bar__live-dropdown-item:hover {
  background: var(--bg-elevated);
}

/* ==========================================================================
   Alerts Slide-In Panel
   ========================================================================== */
.alerts-panel {
  position: fixed;
  top: 64px;
  right: -360px;
  width: 360px;
  height: calc(100vh - 64px);
  background: var(--bg-surface);
  border-left: 1px solid var(--bg-border);
  z-index: 999;
  transition: right 0.25s ease;
  overflow-y: auto;
  padding: 20px;
}
.alerts-panel.is-open {
  right: 0;
}

.alerts-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.alerts-panel__title {
  font-size: var(--text-md);
  font-weight: 500;
}

.alerts-panel__close {
  color: var(--text-secondary);
  font-size: 20px;
  padding: 4px;
}

.alerts-panel__item {
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--bg-elevated);
  border-left: 3px solid var(--fd-primary);
  margin-bottom: var(--gap-sm);
}

.alerts-panel__item-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.alerts-panel__item-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   Sidebar — Fixed 240px
   ========================================================================== */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar__group {
  margin-bottom: 4px;
}

.sidebar__group-label {
  padding: 10px 24px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-500);
  opacity: 0.7;
}

/* Hide "Falcon Dive" group label — FD items are self-evident */
.sidebar__group--fd .sidebar__group-label {
  display: none;
}

/* ── FD Featured Items (Operator's Edge, Execution Gap) ── */
.sidebar__group--fd {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar__group--fd .sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-500);
  cursor: pointer;
  border-radius: 10px;
  background: rgba(59, 114, 237, 0.06);
  border: 1px solid rgba(59, 114, 237, 0.12);
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__group--fd .sidebar__item:hover {
  background: rgba(59, 114, 237, 0.10);
  border-color: rgba(59, 114, 237, 0.25);
}

.sidebar__group--fd .sidebar__item.is-active {
  background: rgba(59, 114, 237, 0.12);
  border-color: rgba(59, 114, 237, 0.30);
  color: var(--blue-500);
}

/* FD items don't use the ::before left-bar indicator */
.sidebar__group--fd .sidebar__item.is-active::before {
  display: none;
}

.sidebar__group--fd .sidebar__item-icon {
  color: var(--blue-500);
  font-size: 16px;
}

/* ── Regular Sidebar Items (Aeros spec) ── */
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  margin: 0 8px;
  position: relative;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sidebar__item.is-active {
  color: var(--blue-500);
  background: rgba(59, 114, 237, 0.10);
}

/* Aeros left-bar indicator via ::before */
.sidebar__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--blue-500);
}

.sidebar__item-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 16px;
}

.sidebar__item-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── FD Badge (solid blue pill, white text) ── */
.sidebar__fd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--blue-500);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Sidebar Bottom — EXO / PLIX / Omnis Infographic */
.sidebar__bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--bg-border);
}

.sidebar__stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar__stack-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.sidebar__stack-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 6px;
  border-radius: var(--radius-badge);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar__stack-badge--exo {
  background: rgba(59, 114, 237, 0.15);
  color: var(--fd-primary);
}

.sidebar__stack-badge--plix {
  background: rgba(0, 153, 255, 0.15);
  color: var(--fd-secondary);
}

.sidebar__stack-badge--omnis {
  background: rgba(241, 141, 116, 0.15);
  color: #F18D74;
}

.sidebar__stack-label {
  color: var(--text-muted);
  font-size: 10px;
}

.sidebar__stack-arrow {
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
  padding-left: 14px;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  margin-top: 64px;
  margin-left: 240px;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.main-content__body {
  flex: 1;
  padding: var(--gap-md);
}

/* Section containers */
.section-container {
  display: none;
  opacity: 0;
  transition: var(--transition-section);
}
.section-container.is-active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  padding: 20px var(--gap-md);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-top: 1px solid var(--bg-border);
}

/* ==========================================================================
   Staleness Indicator
   ========================================================================== */
.staleness-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--draw-amber);
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-badge);
}
.staleness-indicator.is-visible {
  display: flex;
}

/* ==========================================================================
   Mobile Bottom Tab Bar
   ========================================================================== */
.bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  z-index: 1000;
}

.bottom-tabs__list {
  display: flex;
  height: 100%;
}

.bottom-tabs__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
}

.bottom-tabs__item:hover,
.bottom-tabs__item.is-active {
  color: var(--blue-500);
}

.bottom-tabs__item-icon {
  font-size: 18px;
}

.bottom-tabs__item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Mobile "More" Menu */
.more-menu {
  display: none;
  position: fixed;
  bottom: 56px;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  z-index: 999;
  overflow-y: auto;
  padding: 12px 0;
  box-shadow: var(--elevation-popover);
}
.more-menu.is-open {
  display: block;
}

.more-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}
.more-menu__item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.more-menu__item.is-active {
  color: var(--blue-500);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablet: 768px–1280px — sidebar collapses to icon-only 40px */
@media (max-width: 1280px) and (min-width: 768px) {
  .sidebar {
    width: 40px;
  }
  .sidebar__group-label {
    display: none;
  }
  .sidebar__item {
    padding: 10px 11px;
    justify-content: center;
  }
  .sidebar__item-label {
    display: none;
  }
  .sidebar__item {
    border-left-width: 2px;
  }
  .sidebar__bottom {
    padding: 12px 6px;
  }
  .sidebar__stack-label,
  .sidebar__stack-arrow {
    display: none;
  }
  .sidebar__stack-badge {
    min-width: 28px;
    font-size: 8px;
    padding: 2px 4px;
  }
  .main-content {
    margin-left: 40px;
  }
  .top-bar__center {
    display: none;
  }
}

/* Mobile: <768px — sidebar hidden, bottom tabs shown */
@media (max-width: 767px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    margin-bottom: 56px;
  }
  .bottom-tabs {
    display: block;
  }
  .bottom-tabs__list {
    display: flex;
  }
  .top-bar__center {
    display: none;
  }
  .top-bar__live-indicator span:not(.top-bar__live-dot) {
    font-size: 11px;
  }
  .main-content__body {
    padding: var(--gap-sm);
  }
  .alerts-panel {
    width: 100%;
    right: -100%;
  }
}
