/*
 * Taskbar: Start, Search, app buttons, system tray and clock.
 */

.taskbar {
  --tb-hover: rgba(255, 255, 255, .7);
  --tb-pressed: rgba(255, 255, 255, .45);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--taskbar-h);
  border-top: 1px solid var(--stroke);
  background: var(--acrylic);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

:root[data-theme="dark"] .taskbar {
  --tb-hover: rgba(255, 255, 255, .08);
  --tb-pressed: rgba(255, 255, 255, .05);
}

.taskbar[data-align="left"] {
  grid-template-columns: auto auto 1fr;
}

.taskbar-left {
  min-width: 0;
}

.taskbar-center {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0 0.6rem;
}

.tb-apps {
  display: flex;
  gap: 0.2rem;
  min-width: 0;
}

.taskbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  height: 100%;
  min-width: 0;
}

/* ------------------------------------------------------------ app buttons */

.tb-btn {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  transition: background-color .12s, border-color .12s;
}

.tb-btn:hover,
.tb-btn.is-open,
.tb-app.is-active {
  border-color: var(--stroke);
  background: var(--tb-hover);
}

.tb-btn:active {
  background: var(--tb-pressed);
}

.tb-btn img,
.tb-btn .icon {
  transition: transform .14s var(--ease-out);
  pointer-events: none;
}

.tb-btn img {
  width: 1.6rem;
  height: 1.6rem;
}

.tb-btn:active img,
.tb-btn:active .icon {
  transform: scale(.82);
}

.tb-app {
  touch-action: pan-y;
}

.tb-app.is-dragging {
  z-index: 3;
  border-color: var(--stroke);
  background: var(--tb-hover);
  box-shadow: var(--shadow-flyout);
  transition: none;
}

.tb-indicator {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0.4rem;
  height: 0.2rem;
  border-radius: 2px;
  background: var(--text-3);
  opacity: 0;
  transform: translateX(-50%);
  transition: width .18s var(--ease-out), background-color .15s, opacity .15s;
}

.tb-app.is-running .tb-indicator {
  opacity: 1;
}

.tb-app.is-active .tb-indicator {
  width: 1rem;
  background: var(--accent);
}

/* ------------------------------------------------------------------- tray */

.tray-btn {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.6rem;
  height: 2.6rem;
  padding: 0 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1rem;
  transition: background-color .12s, border-color .12s;
}

.tray-btn:hover,
.tray-btn.is-open {
  border-color: var(--stroke);
  background: var(--tb-hover);
}

.tray-clock {
  gap: 0.6rem;
}

.tray-clock-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  white-space: nowrap;
}

.tray-badge {
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1rem;
  text-align: center;
}

.tray-corner {
  flex: none;
  align-self: stretch;
  width: 0.8rem;
  margin-inline-start: 0.2rem;
  padding: 0;
  border: 0;
  border-inline-start: 1px solid transparent;
  background: transparent;
}

.tray-corner:hover {
  border-inline-start-color: var(--stroke-strong);
  background: var(--bg-hover);
}

/* phones: no room to centre the buttons next to the tray */
@media (max-width: 32.6rem) {
  .taskbar,
  .taskbar[data-align="left"] {
    grid-template-columns: 0 minmax(0, 1fr) auto;
  }

  .taskbar-center {
    padding: 0 0.2rem;
    overflow: hidden;
  }

  .tray-status,
  .tray-date {
    display: none;
  }
}

/* The arrow ("Show hidden icons") in front of the status icons; it exists while an app has an icon in the tray. */
.tray-chevron {
  padding: 0 0.4rem;
}

.tray-chevron[hidden] {
  display: none;
}
