/* ============================================================
   Taskbar · Menu principal · Central de notificações
   ============================================================ */

#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--taskbar-h);
  z-index: var(--z-taskbar);
  display: flex; align-items: center;
  padding: 0 0.4rem;
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.7);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.7);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.04), 0 -10px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform var(--t4) var(--ease-out);
}
#os.is-on #taskbar { transform: none; transition-delay: 260ms; }

.tb-side { display: flex; align-items: center; gap: 0.25rem; flex: 1; min-width: 0; }
.tb-side.right { justify-content: flex-end; }
.tb-center { display: flex; align-items: center; gap: 0.2rem; }

/* Settings › Personalization › Ícones centralizados */
#taskbar[data-align="left"] .tb-side.left { display: none; }
#taskbar[data-align="left"] .tb-center { flex: 1; min-width: 0; justify-content: flex-start; }

/* --------- botão genérico da taskbar --------- */
.tb-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.5rem; min-width: 2.5rem; padding: 0 0.45rem;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background var(--t2) var(--ease), transform var(--t2) var(--spring);
}
.tb-btn:hover { background: var(--hover); }
.tb-btn:hover .tb-ico { transform: translateY(-2px) scale(1.06); }
.tb-btn:active { transform: scale(0.9); }
.tb-btn.on { background: var(--active); }
.tb-ico {
  width: 1.55rem; height: 1.55rem;
  transition: transform var(--t3) var(--spring);
  pointer-events: none;
}
.tb-btn svg { pointer-events: none; }

/* botão iniciar */
.tb-start .tb-ico { width: 1.6rem; height: 1.6rem; }
.tb-start.on .tb-ico { transform: scale(1.08) rotate(-4deg); }

/* apps abertos: indicador */
.tb-app::after {
  content: "";
  position: absolute; bottom: 0.16rem; left: 50%;
  width: 0.35rem; height: 0.18rem; border-radius: 999px;
  background: var(--text-mute);
  transform: translateX(-50%) scaleX(0.6);
  opacity: 0;
  transition: opacity var(--t2) var(--ease), width var(--t3) var(--ease),
    background var(--t2) var(--ease), transform var(--t3) var(--ease);
}
.tb-app.running::after { opacity: 0.7; transform: translateX(-50%) scaleX(1); }
.tb-app.active::after { opacity: 1; width: 1rem; background: var(--accent); }
.tb-app.active { background: var(--raise-2); }

/* pesquisa */
.tb-search {
  display: flex; align-items: center; gap: 0.5rem;
  height: 2.35rem; padding: 0 0.85rem;
  border-radius: var(--r-pill);
  background: var(--raise);
  border: 1px solid var(--line);
  color: var(--text-dim); font-size: 0.78rem;
  transition: background var(--t2) var(--ease), border-color var(--t2) var(--ease),
    transform var(--t2) var(--ease);
}
.tb-search:hover { background: var(--hover); border-color: var(--line-strong); transform: translateY(-1px); }
.tb-search svg { width: 0.95rem; height: 0.95rem; }

/* bandeja do sistema */
.tray {
  display: flex; align-items: center; gap: 0.55rem;
  height: 2.5rem; padding: 0 0.6rem;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  transition: background var(--t2) var(--ease), color var(--t2) var(--ease);
}
.tray:hover { background: var(--hover); color: var(--text); }
.tray.on { background: var(--active); color: var(--text); }
.tray svg { width: 1.05rem; height: 1.05rem; }
.tray .bat-lvl { font-size: 0.68rem; }

.tb-clock {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  height: 2.5rem; padding: 0 0.6rem; border-radius: var(--r-sm);
  font-size: 0.72rem; line-height: 1.25; font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: background var(--t2) var(--ease);
}
.tb-clock:hover { background: var(--hover); }
.tb-clock small { color: var(--text-dim); font-size: 0.68rem; }

/* mostrar área de trabalho */
.tb-peek {
  width: 0.55rem; height: 2.5rem; margin-left: 0.15rem;
  border-radius: var(--r-xs);
  border-left: 1px solid var(--line);
  transition: background var(--t2) var(--ease);
}
.tb-peek:hover { background: var(--hover); }

/* ------------------------------------------------------------
   Painéis flutuantes (menu iniciar + central)
   ------------------------------------------------------------ */
.panel-layer {
  position: fixed;
  z-index: var(--z-panel);
  display: none;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(calc(var(--blur) + 10px)) saturate(1.8);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 10px)) saturate(1.8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.panel-layer.show { display: flex; }

/* --------------------------- MENU INICIAR --------------------------- */
#startmenu {
  left: 50%; bottom: calc(var(--taskbar-h) + 0.55rem);
  width: min(38rem, calc(100vw - 1.5rem));
  max-height: min(38rem, calc(100vh - var(--taskbar-h) - 1.5rem));
  transform: translateX(-50%);
  flex-direction: column;
  transform-origin: bottom center;
}
#startmenu.show { animation: startIn var(--t3) var(--ease-out); }
#startmenu.hiding { animation: startOut var(--t2) var(--ease-in) forwards; }
@keyframes startIn {
  from { opacity: 0; transform: translateX(-50%) translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes startOut {
  to { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.97); }
}

.sm-search {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 1rem 1.15rem 0.7rem;
  padding: 0 0.9rem; height: 2.5rem;
  border-radius: var(--r-pill);
  background: var(--field);
  border: 1px solid var(--line);
  transition: border-color var(--t2) var(--ease), box-shadow var(--t2) var(--ease);
}
.sm-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sm-search svg { width: 1rem; height: 1rem; color: var(--text-dim); flex: none; }
.sm-search input { flex: 1; background: none; border: 0; color: var(--text); }
.sm-search input::placeholder { color: var(--text-mute); }

.sm-scroll { flex: 1; overflow-y: auto; padding: 0 1.15rem 0.6rem; }
.sm-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0.55rem 0 0.6rem;
  font-size: 0.78rem; font-weight: 600;
}

.sm-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.25rem; }
.sm-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
  padding: 0.7rem 0.3rem 0.6rem;
  border-radius: var(--r-md);
  transition: background var(--t2) var(--ease), transform var(--t2) var(--ease);
  animation: popIn var(--t3) var(--ease-out) backwards;
}
.sm-tile:hover { background: var(--hover); }
.sm-tile:active { transform: scale(0.95); }
.sm-tile .ico { width: 2.25rem; height: 2.25rem; }
.sm-tile .label {
  font-size: 0.7rem; color: var(--text); text-align: center;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sm-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.25rem; }
.sm-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.6rem; border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--t2) var(--ease);
}
.sm-row:hover { background: var(--hover); }
.sm-row .ico { width: 1.9rem; height: 1.9rem; flex: none; }
.sm-row .t { font-size: 0.78rem; }
.sm-row .s { font-size: 0.68rem; color: var(--text-mute); }

.sm-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1.15rem;
  background: var(--raise);
  border-top: 1px solid var(--line);
}
.sm-user { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.55rem; border-radius: var(--r-sm); transition: background var(--t2) var(--ease); }
.sm-user:hover { background: var(--hover); }
.sm-user .av {
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--accent-grad); display: grid; place-items: center; color: #fff;
}
.sm-user .av svg { width: 1rem; height: 1rem; }
.sm-user .n { font-size: 0.8rem; font-weight: 550; }

.sm-empty { padding: 2.4rem 0; text-align: center; color: var(--text-mute); font-size: 0.8rem; }

/* menu de energia */
.power-menu {
  position: fixed; z-index: var(--z-menu);
  min-width: 11rem; padding: 0.32rem;
  border-radius: var(--r-md);
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform-origin: bottom right;
  animation: ctxIn 160ms var(--ease-out);
}

/* --------------------- CENTRAL DE NOTIFICAÇÕES --------------------- */
#notifcenter {
  right: 0.55rem; bottom: calc(var(--taskbar-h) + 0.55rem);
  width: min(23rem, calc(100vw - 1.1rem));
  max-height: min(34rem, calc(100vh - var(--taskbar-h) - 1.5rem));
  flex-direction: column;
  transform-origin: bottom right;
}
#notifcenter.show { animation: ncIn var(--t3) var(--ease-out); }
#notifcenter.hiding { animation: ncOut var(--t2) var(--ease-in) forwards; }
@keyframes ncIn { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes ncOut { to { opacity: 0; transform: translateY(12px) scale(0.97); } }

.nc-notifs { flex: 1; overflow-y: auto; padding: 0.85rem 0.85rem 0.4rem; display: flex; flex-direction: column; gap: 0.5rem; }
.nc-note {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line);
  animation: riseIn var(--t3) var(--ease-out) backwards;
}
.nc-note .ico { width: 1.8rem; height: 1.8rem; flex: none; border-radius: var(--r-sm); }
.nc-note .t { font-size: 0.78rem; font-weight: 600; }
.nc-note .b { font-size: 0.74rem; color: var(--text-dim); }
.nc-note .time { font-size: 0.66rem; color: var(--text-mute); margin-top: 0.15rem; }
.nc-note .x { margin-left: auto; opacity: 0; transition: opacity var(--t2) var(--ease); }
.nc-note:hover .x { opacity: 1; }
.nc-empty { padding: 2.2rem 0 1.6rem; text-align: center; color: var(--text-mute); font-size: 0.8rem; }
.nc-empty svg { width: 2rem; height: 2rem; margin: 0 auto 0.6rem; opacity: 0.5; }

.nc-panel { padding: 0.85rem; border-top: 1px solid var(--line); background: var(--raise); }
.nc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.qt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  height: 4.4rem; padding: 0.4rem;
  border-radius: var(--r-md);
  background: var(--raise-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.68rem; text-align: center; line-height: 1.2;
  transition: background var(--t2) var(--ease), color var(--t2) var(--ease),
    border-color var(--t2) var(--ease), transform var(--t1) var(--ease);
}
.qt svg { width: 1.15rem; height: 1.15rem; transition: transform var(--t3) var(--spring); }
.qt:hover { background: var(--hover); transform: translateY(-2px); }
.qt:hover svg { transform: scale(1.12); }
.qt:active { transform: scale(0.95); }
.qt.on {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -8px var(--accent);
}

.nc-slider { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.75rem; }
.nc-slider svg { width: 1.05rem; height: 1.05rem; color: var(--text-dim); flex: none; }
.nc-slider .val { font-size: 0.7rem; color: var(--text-mute); width: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; }

.nc-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--text-dim);
}

/* --------------------------- Responsivo --------------------------- */
@media (max-width: 760px) {
  :root { --taskbar-h: 3.1rem; }
  .tb-search span { display: none; }
  .tb-search { padding: 0 0.7rem; }
  .tb-clock { font-size: 0.68rem; padding: 0 0.35rem; }
  .tray { gap: 0.35rem; padding: 0 0.4rem; }
  .tb-peek { display: none; }
  #startmenu { width: calc(100vw - 1rem); }
  .sm-grid { grid-template-columns: repeat(4, 1fr); }
  .sm-list { grid-template-columns: 1fr; }
  #notifcenter { width: calc(100vw - 1rem); right: 0.5rem; }
}
@media (max-width: 620px) {
  /* o espaçador da esquerda deixa de existir: a taskbar usa toda a largura */
  .tb-side.left { display: none; }
  .tb-center { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tb-center::-webkit-scrollbar { display: none; }
  .tb-side.right { flex: 0 0 auto; }
  .tb-side.right > .tb-btn { display: none; } /* o sino da bandeja já abre a central */
  .tray .bat-lvl { display: none; }
}
@media (max-width: 420px) {
  .sm-grid { grid-template-columns: repeat(3, 1fr); }
  .tb-clock small { display: none; }
  .tb-btn { min-width: 2.2rem; padding: 0 0.3rem; }
  .tb-ico { width: 1.4rem; height: 1.4rem; }
}
