/**
 * Little Social - App Layout
 * Responsive shell supporting:
 * 1. Multi-Column Deck Mode (display: flex; horizontal scroll)
 * 2. Single-Column Responsive Mode (centered feed + navigation rail/bottom bar)
 */

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--surface-bg);
}

/* ==========================================================================
   Navigation Sidebar (Desktop)
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--surface-nav);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-4);
  z-index: 20;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ff5c35 0%, #f97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: #ffffff;
  font-weight: var(--font-bold);
  font-size: var(--text-md);
}

.brand-logo img,
.brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-size: var(--text-md);
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--surface-card-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
  font-weight: var(--font-semibold);
}

.nav-badge {
  margin-left: auto;
  background-color: var(--accent-primary);
  color: var(--accent-text);
  font-size: var(--text-xs);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

/* Sidebar Footer / Account Selector */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.btn-compose-sidebar {
  width: 100%;
  padding: 0.75rem var(--space-4);
  font-size: var(--text-base);
  box-shadow: var(--shadow-sm);
}

.active-account-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  background-color: var(--surface-card);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.active-account-card:hover {
  background-color: var(--surface-card-hover);
}

.active-account-card .account-info {
  flex: 1;
  min-width: 0;
}

/* Mobile-only logout in the column header (the sidebar is hidden there) */
.column-logout {
  display: none;
}

.account-logout-btn {
  color: var(--color-danger);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background-color: var(--surface-active);
  flex-shrink: 0;
}

.account-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
}

.account-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-handle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Main Viewports: Single-Column vs Multi-Column Deck
   ========================================================================== */
.main-viewport {
  flex: 1;
  height: 100vh;
  overflow: hidden;
  position: relative;
  display: flex;
}

/* Single-Column Mode */
.single-column-layout {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  overflow-y: hidden;
  background-color: var(--surface-bg);
}

.single-column-wrapper {
  width: 100%;
  max-width: var(--single-column-max-width);
  height: 100vh;
  border-inline: 1px solid var(--border-color);
  background-color: var(--surface-card);
  display: flex;
  flex-direction: column;
}

/* Multi-Column Deck Mode */
.deck-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  background-color: var(--surface-bg);
}

.deck-container > .column {
  flex: 1 0 var(--deck-column-default-width);
  min-width: var(--deck-column-min-width);
  max-width: var(--deck-column-max-width);
  height: 100vh;
  border-right: 1px solid var(--border-color);
  scroll-snap-align: start;
}

/* ==========================================================================
   Mobile Bottom Navigation
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: var(--surface-nav);
  border-top: 1px solid var(--border-color);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding-inline: var(--space-2);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  text-decoration: none;
  position: relative;
}

.mobile-nav-item.active {
  color: var(--accent-primary);
}

/* Mobile Responsive Breakpoints */
@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }

  .column-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .main-viewport {
    height: calc(100vh - 56px);
  }

  .single-column-wrapper {
    max-width: 100%;
    border-inline: none;
  }

  .deck-container > .column {
    flex: 1 0 100vw;
    min-width: 100vw;
    max-width: 100vw;
    scroll-snap-align: center;
  }
}
