/* App shell */

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

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  padding-top: calc(56px + var(--space-md));
  padding-bottom: calc(64px + var(--space-md) + env(safe-area-inset-bottom));
}

/* Pages */

.page {
  display: none;
}

.page.active {
  display: block;
}

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

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Top bar */

#top-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-md);
  z-index: 100;
}

#top-bar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.hamburger-btn:active {
  background: var(--border-subtle);
}

/* Nav overlay */

#nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

#nav-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Nav drawer */

#nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.nav-drawer-logo {
  font-size: 28px;
  line-height: 1;
}

.nav-drawer-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-drawer-items {
  flex: 1;
  padding: var(--space-sm) 0;
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px var(--space-lg);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 100%;
  text-align: left;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-item:active {
  background: var(--border-subtle);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  font-size: 14px;
  font-weight: 500;
}

.nav-drawer-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-sm) var(--space-lg);
}

.nav-item-plan {
  color: var(--accent);
  font-weight: 600;
}

.nav-item-plan.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Bottom nav */

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 64px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding: 0 var(--space-sm);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  padding: 0;
}

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

.bottom-nav-icon {
  width: 22px;
  height: 22px;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-display);
}

.bottom-nav-center {
  flex: 1.2;
}

.bottom-nav-center-btn {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.bottom-nav-center:active .bottom-nav-center-btn {
  transform: scale(0.92);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Toast container */

#toast-container {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  left: var(--space-md);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
}

/* Auth screen */

#auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  gap: var(--space-lg);
  text-align: center;
}

.auth-logo {
  font-size: 64px;
  line-height: 1;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: -12px;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 320px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 320px;
}
