/* Main App Layout */
#app {
  display: flex;
  flex-direction: row; /* Horizontal layout for Side Nav */
  height: 100vh;
  width: 100vw;
}

header {
  display: none; /* Hide top header, use side rail */
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: var(--md-sys-color-background);
}

.view-header h2 {
  color: var(--md-sys-color-on-surface);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 4px;
}

.view-header p {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  margin-bottom: 24px;
}

/* Side Navigation Rail (Left) / Bottom Nav (Mobile) */
.nav-bar {
  width: 88px;
  height: 100vh;
  background-color: var(--md-sys-color-surface-container);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  gap: 12px;
  box-shadow: none;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  z-index: 1000;
  position: relative;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px 0;
  color: var(--md-sys-color-on-surface-variant);
  transition: color 0.2s;
  text-decoration: none;
}

.nav-item.active {
  color: var(--md-sys-color-on-surface);
}

.nav-icon-container {
  width: 56px;
  height: 32px;
  border-radius: 16px; /* Pill shape */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item.active .nav-icon-container {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  width: 64px; /* Slightly wider pill when active */
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  text-align: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  #app {
    flex-direction: column-reverse; /* Content on top, Nav on bottom */
  }
  
  .nav-bar {
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 8px 0;
    border-right: none;
    border-top: 1px solid var(--md-sys-color-outline-variant);
  }

  .nav-item {
    flex: 1;
    padding: 0;
  }

  .nav-icon-container {
    width: 48px;
  }
  
  .nav-item.active .nav-icon-container {
    width: 56px;
  }
  
  /* Hide theme toggle on mobile bottom bar to save space, or keep it if it fits */
  #theme-toggle {
    display: none;
  }
}

/* Overlay & Modal */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-3);
  padding: 24px;
  border-radius: 24px;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ampel-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.ampel-dot.green { background: #4CAF50; box-shadow: 0 0 8px #4CAF50; }
.ampel-dot.yellow { background: #FFB300; box-shadow: 0 0 8px #FFB300; }
.ampel-dot.red { background: #BA1A1A; box-shadow: 0 0 8px #BA1A1A; }
.ampel-dot.grey { background: #9E9E9E; }

.m3-segmented-control {
  display: flex;
  background: var(--md-sys-color-surface-container-high);
  border-radius: 16px;
  padding: 4px;
}

.m3-segment {
  border: none;
  background: none;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-segment.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 500;
}

.m3-select-small {
  background: var(--md-sys-color-surface-container-high);
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--md-sys-color-on-surface);
}
