/* ==========================================================================
   Layout - App Shell & Grid
   ========================================================================== */

/* App Container */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-bg);
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Main Content Area */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--space-6) + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Page Container */
.page {
  display: none;
  flex-direction: column;
  width: 100%;
}

.page.active {
  display: flex;
}

.page-content {
  flex: 1;
  padding: var(--space-5) var(--space-5) var(--space-8);
}

/* Section Spacing */
.section {
  margin-bottom: var(--space-6);
}

.section:last-child {
  margin-bottom: 0;
}

.section-header {
  margin-bottom: var(--space-4);
}

/* Safe Area Padding */
.safe-top {
  padding-top: var(--safe-top);
}

.safe-bottom {
  padding-bottom: var(--safe-bottom);
}

/* Desktop Layout */
@media (min-width: 768px) {
  .app-shell {
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    min-height: 100vh;
  }
  
  .app-content {
    padding-bottom: var(--space-8);
  }
}

/* Fullscreen map */
.map-fullscreen .app-content {
  padding: 0;
}

.map-fullscreen .page-content {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}