/* The parts around the pages (DashboardChrome.swift): bottom bar on phones, side menu on wide screens, the
   slide-out drawer, and the chat button. */

.shell {
  min-height: 100vh;
}

/* MARK: Bottom bar (phones) */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  justify-content: center;
  /* Solid, and so is the strip around it, so the page never shows through. */
  background: var(--surface);
  padding: 8px 16px calc(4px + env(safe-area-inset-bottom));
}
body.has-tabbar .bottom-nav {
  display: flex;
}
body.has-tabbar .app {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.bottom-nav-bar {
  width: 100%;
  max-width: 540px;
  height: 68px;
  border-radius: 34px;
  background: var(--nav-bar);
  border: 1px solid var(--nav-edge);
  box-shadow: 0 10px 36px var(--nav-shadow);
  display: flex;
  align-items: center;
  padding: 0 8px;
}
.bottom-nav-half {
  flex: 1;
  display: flex;
}

.nav-item {
  position: relative;
  flex: 1;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--nav-icon);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item:active {
  transform: scale(0.92);
  transition-duration: 0.12s;
}
.nav-pill {
  position: absolute;
  inset: 0 4px;
  border-radius: 26px;
  background: var(--nav-active-soft);
  opacity: 0;
  transition: opacity 0.2s;
}
.nav-icon {
  position: relative;
  font-size: 21px;
  height: 22px;
}
/* The filled symbol for the current page (not every symbol has one). */
.nav-icon-on {
  display: none;
}
.nav-item.is-active .nav-icon-on {
  display: inline-flex;
}
.nav-item.is-active .nav-icon-off {
  display: none;
}
.nav-label {
  position: relative;
  font-size: 10.5px;
  font-weight: 500;
}
.nav-item.is-active {
  color: var(--nav-active);
}
.nav-item.is-active .nav-pill {
  opacity: 1;
  animation: nav-pill-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* When a tab becomes the current page, its pill grows out from the centre and its icon pops. */
.nav-item.is-active .nav-icon-on {
  animation: nav-icon-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes nav-pill-in {
  from {
    opacity: 0;
    transform: scale(0.55, 0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes nav-icon-pop {
  from {
    transform: scale(0.7);
  }
  to {
    transform: none;
  }
}
.nav-item.is-active .nav-label {
  font-weight: 600;
}

/* The "+" in the middle of the bar, in the logo's navy → blue → cyan gradient. */
.sell-button {
  width: 52px;
  height: 52px;
  margin: 0 6px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  background: linear-gradient(45deg, #1430aa 0%, #2c74f8 55%, #22b8f0 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 18px var(--nav-sell-glow);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sell-button .icon {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Pressed: the button sinks a little and its "+" turns a quarter turn. */
.sell-button:active {
  transform: scale(0.92);
}
.sell-button:active .icon {
  transform: rotate(90deg);
}
@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .sell-button,
  .sell-button .icon {
    transition: none;
  }
  .nav-item:active,
  .sell-button:active,
  .sell-button:active .icon {
    transform: none;
  }
  .nav-item.is-active .nav-pill,
  .nav-item.is-active .nav-icon-on {
    animation: none;
  }
}

/* MARK: Side menu (wide screens): the same pages down the left. */

.side-nav {
  display: none;
}

@media (min-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: 248px 1fr;
  }
  body.is-bare .shell {
    display: block;
  }
  body.is-bare .side-nav {
    display: none;
  }
  body.has-tabbar .bottom-nav {
    display: none;
  }
  body.has-tabbar .app {
    padding-bottom: 0;
  }
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    border-right: 1px solid var(--topbar-line);
    background: var(--surface);
  }
  .side-nav-brand img {
    height: 28px;
    width: auto;
  }
  [data-btc-theme='dark'] .side-nav-brand img {
    filter: brightness(0) invert(0.92);
  }
  .side-nav-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .side-nav .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    height: 48px;
    padding: 0 14px;
  }
  .side-nav .nav-pill {
    inset: 0;
    border-radius: 14px;
  }
  .side-nav .nav-item:hover .nav-pill {
    opacity: 0.6;
  }
  .side-nav .nav-icon {
    height: auto;
  }
  .side-nav .nav-label {
    font-size: 15px;
  }
  .side-nav-sell {
    order: -1;
    margin-bottom: 12px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    background: linear-gradient(45deg, #1430aa 0%, #2c74f8 55%, #22b8f0 100%);
    box-shadow: 0 6px 18px var(--nav-sell-glow);
  }
  .side-nav-sell .icon {
    font-size: 22px;
  }
  .side-nav-sell:active {
    transform: scale(0.98);
  }
}

/* MARK: Drawer (the side menu from the dashboard's menu button) */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.drawer-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.25s ease-out;
}
.drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 86vw;
  display: flex;
  flex-direction: column;
  padding: calc(26px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: 12px 0 40px var(--panel-shadow);
  transform: translateX(-105%);
  transition: transform 0.25s ease-out;
}
.drawer.is-open .drawer-scrim {
  opacity: 1;
}
.drawer.is-open .drawer-panel {
  transform: none;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--topbar-line);
}
.drawer-profile {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
/* White gap, then a soft purple ring (box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(141,92,255,.28)). */
.avatar-ring {
  flex: none;
  padding: 2px;
  border-radius: 50%;
  background: rgba(141, 92, 255, 0.25);
}
.avatar {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 50%;
  border: 3px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--pink));
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.drawer-profile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.drawer-name {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-view {
  font-size: 13px;
  color: var(--muted);
}
.drawer-close {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-close > span {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--sidebar-close);
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 18px;
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 12px;
  width: 100%;
}
.drawer-link:hover {
  background: var(--sidebar-close);
}
.drawer-link-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: var(--nav-background);
  background: var(--sidebar-icon);
}
[data-btc-theme='dark'] .drawer-link-icon {
  color: var(--text);
}
.drawer-link-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.drawer-link-title {
  font-size: 15px;
  font-weight: 600;
}
.drawer-link-subtitle {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-chevron {
  font-size: 15px;
  color: var(--chevron);
}
.drawer-spacer {
  flex: 1;
}
.drawer-foot {
  padding-top: 16px;
  border-top: 1px solid var(--topbar-line);
}
.logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--badge);
  background: var(--logout-background);
  border: 1px solid var(--logout-border);
}
.logout .icon {
  font-size: 18px;
}

/* MARK: Toast: a short message at the bottom of the screen. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--surface);
  background: var(--text);
  box-shadow: 0 10px 30px var(--panel-shadow);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 900px) {
  .toast {
    bottom: 32px;
  }
}

/* MARK: Dialog: a message box over the page (the iOS alerts). */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.2s;
}
.dialog-panel {
  position: relative;
  width: min(320px, 100%);
  padding: 22px 20px 16px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 20px 50px var(--panel-shadow);
  text-align: center;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.2s, transform 0.2s;
}
.dialog.is-open .dialog-scrim,
.dialog.is-open .dialog-panel {
  opacity: 1;
}
.dialog.is-open .dialog-panel {
  transform: none;
}
.dialog-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
}
.dialog-message {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.dialog-button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--surface);
  background: var(--text);
}
.dialog-button.is-cancel {
  color: var(--text);
  background: var(--sidebar-close);
}
.dialog-button.is-destructive {
  background: var(--badge);
  color: #fff;
}

/* Sheet (BTC.sheet) */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 40px var(--panel-shadow);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}
.sheet.is-open .sheet-scrim {
  opacity: 1;
}
.sheet.is-open .sheet-panel {
  transform: none;
}
.sheet-grabber {
  display: block;
  width: 36px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: var(--act-line);
}
.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--muted);
}
@media (min-width: 600px) {
  .sheet {
    align-items: center;
    padding: 24px;
  }
  .sheet-panel {
    max-width: 440px;
    border-radius: 24px;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
  }
  .sheet.is-open .sheet-panel {
    opacity: 1;
  }
  .sheet-grabber {
    visibility: hidden;
  }
  .sheet-close {
    display: flex;
  }
}
