/* ==========================================================================
   AAD 2026 GATE VALIDATOR — LAYOUT
   App shell, announcement bar, sticky header, sidebar & bottom tabs
   ========================================================================== */

/* App Wrapper */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 1. Announcement Strip */
.announcement-strip {
  height: var(--announcement-height);
  background-color: var(--surface-announcement);
  color: var(--neutral-darkest);
  font-family: var(--font-btn);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid rgba(43,44,38,.12);
  z-index: 50;
  white-space: nowrap;
  overflow: hidden;
}

.announcement-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.announcement-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.gate-badge {
  letter-spacing: 0.04em;
}

.connection-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background-color: var(--neutral-muted);
}

.connection-indicator.online .connection-dot {
  background-color: var(--status-valid);
}

.connection-indicator.offline .connection-dot {
  background-color: var(--color-accent-red);
}

/* 2. Sticky Header */
.app-header {
  height: var(--header-height);
  background-color: var(--surface-header);
  border-bottom: 2px solid var(--color-highlight);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.header-divider {
  width: 1px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.2);
}

.header-title-block {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 18px;
  color: #ffffff;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.header-subtitle {
  font-family: var(--font-btn);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neutral-light);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Header utility buttons & chips */
.header-chip {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #ffffff;
  font-family: var(--font-btn);
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.header-chip.active {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: #ffffff;
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 3. Main Body Container (Sidebar + Content) */
.app-container {
  display: flex;
  flex: 1;
  width: 100%;
}

/* Desktop Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-primary);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-md);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height) - var(--announcement-height));
  border-right: 1px solid rgba(0,0,0,.1);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.gate-control-plate {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gate-plate-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-highlight);
  background-color: rgba(250, 200, 15, 0.1);
  flex-shrink: 0;
}

.gate-plate-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gate-plate-eyebrow {
  font-family: var(--font-btn);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-highlight);
}

.gate-plate-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav Items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-btn);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--trans-fast);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active,
.nav-item[aria-current="page"] {
  background-color: var(--color-highlight);
  color: var(--neutral-darkest);
  border-left-color: var(--neutral-darkest);
  font-weight: 700;
}

.nav-item.active .icon,
.nav-item[aria-current="page"] .icon {
  stroke: var(--neutral-darkest);
}

/* Sidebar Footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: var(--space-md);
}

.sidebar-version {
  font-family: var(--font-btn);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  letter-spacing: 0.02em;
}

/* 4. Main Content Area */
.app-main {
  flex: 1;
  padding: var(--space-lg);
  background-color: var(--surface-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - var(--header-height) - var(--announcement-height));
  width: 100%;
}

.main-content {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

.panel[hidden] {
  display: none !important;
}

/* Mobile Bottom Tab Bar (<1024px) */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 1023px) {
  .app-sidebar {
    display: none;
  }

  .app-main {
    padding: var(--space-md);
    padding-bottom: calc(var(--tabbar-height) + var(--space-lg) + env(safe-area-inset-bottom, 0px));
  }

  .app-header {
    height: 64px;
    padding: 0 var(--space-md);
  }

  .header-logo {
    height: 36px;
  }

  .header-title {
    font-size: 15px;
  }

  .announcement-strip {
    font-size: 11px;
    padding: 0 var(--space-md);
  }

  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tabbar-height);
    background-color: var(--surface-header);
    border-top: 2px solid var(--color-highlight);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    justify-content: space-around;
    align-items: center;
  }

  .mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--neutral-light);
    font-family: var(--font-btn);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
    background: transparent;
  }

  .mobile-tab-item.active {
    color: var(--color-highlight);
  }

  .mobile-tab-item .icon {
    width: 20px;
    height: 20px;
  }
}
