/* Üstte duran katmanlar: açılır menüler, bildirimler, onay pencereleri.
   Yalnızca gerçekten yüzen öğeler gölge taşır. */

/* --- Üst bar araçları --- */
.topbar-tools { display: flex; align-items: center; gap: 6px; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--tally); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.flag { width: 22px; height: 15px; flex: none; display: block; box-shadow: 0 0 0 1px rgba(127, 127, 127, .25); border-radius: 2.5px; }
.menu-code { font-weight: 600; font-size: 12px; letter-spacing: .02em; }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; display: grid; }
.avatar-btn:focus-visible { outline-offset: 3px; }

/* --- Açılır menü --- */
.menu { position: relative; }
.menu-btn .icon { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.menu-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.menu-panel {
  position: absolute; top: calc(100% + 8px); left: 50%; z-index: 50;
  min-width: 200px; padding: 6px;
  display: grid; gap: 2px;
  background: var(--float); border-radius: 16px;
  box-shadow: var(--float-shadow), 0 0 0 1px var(--rule);
  transform: translateX(-50%);
  animation: menu-in .16s var(--ease);
}
.menu-panel[hidden] { display: none; }
.menu-panel.menu-right { left: auto; right: 0; transform: none; min-width: 240px; }
@keyframes menu-in { from { opacity: 0; translate: 0 -4px; } }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font-size: 14px; font-weight: 500; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--control); outline: none; }
.menu-item[aria-checked="true"] { background: var(--control); }
.menu-item .icon { color: var(--muted); }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.menu-head span { display: grid; min-width: 0; }
.menu-head small { color: var(--faint); }

/* --- Bildirimler --- */
#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: grid; gap: 10px; width: min(380px, calc(100vw - 32px));
}
.toast {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 32px 1fr 28px; gap: 12px; align-items: start;
  padding: 14px 12px 16px 14px;
  background: var(--float); color: var(--text); border-radius: 16px;
  box-shadow: var(--float-shadow), 0 0 0 1px var(--rule);
  animation: toast-in .28s var(--ease);
}
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--control); color: var(--text); }
.toast-icon svg { width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--positive); }
.toast-error .toast-icon { background: var(--tally-soft); color: var(--tally); }
.toast-invite .toast-icon, .toast-friend .toast-icon { background: var(--text); color: var(--inverse); }
.toast-body { display: grid; gap: 2px; padding-top: 5px; min-width: 0; }
.toast-body strong { font-size: 14px; }
.toast-body p { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.toast-body strong + p { color: var(--muted); }
.toast-body p:only-child { color: var(--text); }
.toast-actions { display: flex; gap: 6px; margin-top: 10px; }
.toast-close {
  width: 28px; height: 28px; border: 0; border-radius: 8px; padding: 5px;
  background: none; color: var(--faint);
}
.toast-close:hover { background: var(--raised); color: var(--text); }
.toast-close svg { width: 18px; height: 18px; }
/* Kalan süre çubuğu: üzerine gelince durur */
.toast-life {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--control); transform-origin: left;
  animation: life var(--life) linear forwards;
}
.toast-error .toast-life { background: var(--tally); }
.toast.is-paused .toast-life { animation-play-state: paused; }
@keyframes life { to { transform: scaleX(0); } }

/* --- Onay penceresi --- */
.modal {
  padding: 0; border: 0; background: none; color: var(--text);
  width: min(440px, calc(100vw - 32px)); max-width: none;
  overflow: visible; /* açılış animasyonu kaydırma çubuğu çıkarmasın */
}
.modal::backdrop { background: var(--backdrop); animation: fade .2s ease; }
.modal[open] .modal-card { animation: modal-in .22s var(--ease); }
.modal.is-leaving .modal-card { animation: modal-out .15s ease-in forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes modal-out { to { opacity: 0; transform: scale(.97); } }
.modal-card {
  display: grid; gap: 14px; padding: 26px;
  background: var(--float); border-radius: 22px;
  box-shadow: var(--float-shadow);
}
.modal-text { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (max-width: 600px) {
  #toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
  .menu-panel { left: auto; right: 0; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast-life { animation: none; }
}
