/*
 * shell.css — Panel iskeleti: kenar çubuğu (.sb), üst çubuk (.tb) ve mobil
 * çekmece. Giriş ekranıyla aynı dil: Clash başlık, Satoshi gövde, durağan
 * zemin, hover'da yalnız ışık. Dinlenirken hiçbir şey canlanmaz.
 * Tasarım: docs/design-system.md §7.33
 */

/* Zemin: logo kırmızısından koyu şarap tonu, iki yumuşak ışık alanı ve sağ
   üstte çok soluk Wildflover filigranı. Hepsi durağan (bir kez boyanır). */
#panel {
  overflow: hidden;
  background:
    radial-gradient(1200px 640px at 92% -12%, rgba(var(--theme-primary-rgb), 0.15) 0%, transparent 62%),
    radial-gradient(900px 760px at -8% 112%, rgba(150, 30, 58, 0.13) 0%, transparent 60%),
    radial-gradient(640px 380px at 46% -6%, rgba(255, 182, 189, 0.035) 0%, transparent 72%),
    linear-gradient(180deg, #130a0e 0%, #0d080a 48%, #0a0608 100%);
}
#panel::before {
  content: '';
  position: absolute;
  top: -170px;
  right: -150px;
  width: 700px;
  height: 700px;
  background: url('/admin/assets/wf-sigil.svg') center / contain no-repeat;
  opacity: 0.04;
  transform: rotate(-12deg);
  pointer-events: none;
}
#panel > main { position: relative; }
#panel { --page-hue: #ff7a85; }
.sb,
.tb { font-family: var(--wf-font-text); }

/* ============================================================
   [KENAR ÇUBUĞU]
   ============================================================ */
.sb {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0;
  background: rgba(13, 7, 10, 0.78);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sb-home {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0 -6px;
  padding: 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease;
}
.sb-home:focus-visible { outline: 2px solid rgba(244, 236, 234, 0.6); outline-offset: 0; }
.sb-sigil { display: block; width: 24px; height: 24px; flex-shrink: 0; }
.sb-name {
  font-family: var(--wf-font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--wf-text-1);
}
.sb-tag {
  padding-left: 10px;
  border-left: 1px solid var(--wf-line-2);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--wf-text-3);
}
.sb .sb-close {
  display: none;
  margin-left: auto;
}

/* Gezinme: gruplar katlanabilir, etkin sayfanın grubu hep açık */
.sb-nav {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 12px 12px 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { display: none; }
.sb-group + .sb-group { margin-top: 6px; }
.sb-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--wf-text-4);
  cursor: pointer;
  transition: color var(--wf-dur-hover) ease;
}
/* Bölüm rengi: başlığın solunda küçük işaret */
.sb-group-head::before {
  content: '';
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  margin-right: 2px;
  border-radius: 2px;
  background: var(--hue);
  opacity: 0.8;
}
.sb-group-head svg {
  width: 12px;
  height: 12px;
  margin-left: auto;
  transition: transform var(--wf-dur-state) var(--wf-ease-out);
}
.sb-group.is-collapsed .sb-group-head svg { transform: rotate(-90deg); }
.sb-group.is-collapsed .sb-group-items { display: none; }
.sb-group-count {
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--wf-text-4);
  opacity: 0;
  transition: opacity var(--wf-dur-hover) ease;
}
.sb-group.is-collapsed .sb-group-count { opacity: 1; }

.sb-item {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  color: var(--wf-text-2);
  cursor: pointer;
  transition: color var(--wf-dur-hover) ease, background-color var(--wf-dur-hover) ease;
}
.sb-item + .sb-item { margin-top: 1px; }
.sb-item-ico {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  /* Bölüm renginde, dinlenirken biraz kısık; üzerine gelince ve etkinken tam */
  color: color-mix(in srgb, var(--hue, #9b8f86) 62%, rgba(255, 255, 255, 0.3));
  transition: color var(--wf-dur-hover) ease;
}
.sb-item-ico svg { width: 18px; height: 18px; stroke-width: 1.8; }
/* İki ton: yalnız kapalı şekiller yumuşak dolgu alır (açık çizgiler tuhaf kapanmasın) */
:is(.sb-item-ico, .tb-ico) svg[fill="none"] :is(rect, circle, ellipse, polygon, path[d$="z"], path[d$="Z"]) {
  fill: color-mix(in srgb, currentColor 18%, transparent);
}
.sb-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.sb-item.active { color: var(--wf-text-1); }
.sb-item.active .sb-item-ico { color: var(--hue); }
/* Etkin işaret: tek eleman, satırdan satıra kayar (main.js placeMark) */
.sb-mark {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  z-index: 0;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--hue, #ff7a85) 17%, transparent), color-mix(in srgb, var(--hue, #ff7a85) 4%, transparent) 78%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue, #ff7a85) 14%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: transform 260ms var(--wf-ease-in-out), opacity var(--wf-dur-state) ease;
}
.sb-mark::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--hue, #ff7a85);
}
.sb-mark.is-still { transition: none; }
.sb-item:active { transform: scale(0.985); }
/* Kısa ekranda (768 px laptop) satırlar eski yüksekliğinde: daha çok sayfa görünür */
@media (max-height: 800px) {
  .sb-item { height: 36px; }
}

/* Alt: uygulama girişi anahtarı + oturumdaki yetkili */
.sb-foot {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sb-lock {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--wf-text-2);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease, color var(--wf-dur-hover) ease;
}
.sb-lock .al-ico { display: grid; color: var(--wf-text-4); }
.sb-lock .al-ico svg { width: 15px; height: 15px; }
.sb-lock .al-text { flex: 1; text-align: left; }
.sb-lock .al-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--wf-success);
}
.sb-lock .al-state::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sb-lock.locked .al-state { color: var(--wf-danger); }
.sb-lock:active { transform: scale(0.985); }

.sb-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 2px 6px;
}
.sb-ava {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--wf-font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wf-text-1);
}
.sb-me-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.sb-me-info b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--wf-text-1);
}
.sb-me-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--wf-text-3);
}

/* ============================================================
   [ÜST ÇUBUK]
   ============================================================ */
.tb {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  flex-shrink: 0;
  padding: 0 28px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tb-title { min-width: 0; }
/* Sayfanın ikonu bölüm renginde: kenar çubuğuyla aynı renk, aynı glif */
.tb-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--page-hue) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-hue) 24%, transparent);
  color: var(--page-hue);
}
.tb-ico:empty { display: none; }
.tb-ico svg { width: 19px; height: 19px; stroke-width: 1.9; }
.tb .crumb {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: color-mix(in srgb, var(--page-hue) 72%, rgba(255, 255, 255, 0.45));
}
.tb-title h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--wf-font-display);
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--wf-text-1);
}
.tb .head-actions { gap: 8px; }

/* Kare ikon düğmesi (yenile, menü, çıkış) */
.wf-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--wf-text-3);
  cursor: pointer;
  transition:
    color var(--wf-dur-hover) ease,
    background-color var(--wf-dur-hover) ease,
    transform var(--wf-dur-press) var(--wf-ease-out);
}
.wf-icon-btn svg { width: 17px; height: 17px; }
.wf-icon-btn:active { transform: scale(0.94); }
.wf-icon-btn.is-quiet { width: 32px; height: 32px; margin-left: auto; }

.tb-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--wf-text-2);
  cursor: pointer;
  transition:
    color var(--wf-dur-hover) ease,
    background-color var(--wf-dur-hover) ease,
    transform var(--wf-dur-press) var(--wf-ease-out);
}
.tb-refresh svg { width: 15px; height: 15px; transition: transform 360ms var(--wf-ease-out); }
.tb-refresh:active { transform: scale(0.97); }
.tb-menu { display: none; margin-left: -8px; }

.content {
  padding: 24px 28px;
  background: radial-gradient(1100px 520px at 100% -8%, color-mix(in srgb, var(--page-hue) 8%, transparent), transparent 72%);
  /* Sayfa çubuğu: eski kırmızı yerine nötr ince çubuk */
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

/* ============================================================
   [BİLDİRİM] sağ altta kart: Frieren (duruma göre ifade) · durum etiketi ·
   mesaj · kapanma çubuğu (üzerine gelince durur). Giriş/çıkış yalnız
   transform + opacity; çubuk sonlu tek tur.
   ============================================================ */
#toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.wf-toast {
  --k: #7cc4ff;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow: hidden;
  padding: 12px 10px 14px 12px;
  border-radius: 14px;
  background: #1a1316;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 48px -18px rgba(0, 0, 0, 0.92);
  font-family: var(--wf-font-text);
  pointer-events: auto;
  animation: wf-toast-in 260ms var(--wf-ease-out) both;
}
.wf-toast.is-ok { --k: #34d399; }
.wf-toast.is-err { --k: #fb7185; }
.wf-toast.is-warn { --k: #f0b45a; }
.wf-toast.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity 180ms ease, transform 180ms ease; }
.wf-toast-ava {
  display: block;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
  background: color-mix(in srgb, var(--k) 16%, #241a1e);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 34%, transparent);
}
.wf-toast-ava img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.wf-toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.wf-toast-head { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; line-height: 1.3; }
.wf-toast-head b { font-weight: 700; color: var(--wf-text-3); }
.wf-toast-kind { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--k); }
.wf-toast-kind::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }
.wf-toast-msg { margin-top: 3px; font-size: 0.88rem; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; color: var(--wf-text-1); }
.wf-toast-msg b { font-weight: 700; }
.wf-toast-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--wf-text-4);
  cursor: pointer;
  transition: color var(--wf-dur-hover) ease, background-color var(--wf-dur-hover) ease;
}
.wf-toast-x svg { width: 13px; height: 13px; }
.wf-toast-bar { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: rgba(255, 255, 255, 0.05); }
.wf-toast-bar i {
  display: block;
  height: 100%;
  background: var(--k);
  opacity: 0.75;
  transform-origin: left;
  animation: wf-toast-bar var(--t-ms, 4s) linear forwards;
}
.wf-toast.is-paused .wf-toast-bar i { animation-play-state: paused; }
@keyframes wf-toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes wf-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (hover: hover) and (pointer: fine) {
  .wf-toast-x:hover { background: rgba(255, 255, 255, 0.07); color: var(--wf-text-1); }
}
@media (max-width: 560px) {
  #toasts { right: 12px; bottom: 12px; left: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .wf-toast { animation: none; }
}

/* ============================================================
   [MENÜ + İPUCU] tüm panelde ortak yüzen katmanlar (en son yüklenir)
   ============================================================ */
.fmenu {
  min-width: 220px;
  padding: 6px;
  border-radius: 14px;
  background: #171114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
  font-family: var(--wf-font-text);
  transform-origin: top left;
  animation: wf-menu-in 140ms var(--wf-ease-out);
}
@keyframes wf-menu-in { from { opacity: 0; transform: scale(0.97); } }
.fmenu button {
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--wf-text-2);
}
.fmenu button svg { width: 15px; height: 15px; color: var(--wf-text-4); }
.fmenu button.danger { color: #fda4af; }
.fmenu button.danger svg { color: currentColor; }
.fmenu button.sel { background: rgba(255, 255, 255, 0.06); color: var(--wf-text-1); }
.fmenu hr { margin: 5px 6px; border-top-color: rgba(255, 255, 255, 0.06); }
.g-tip {
  padding: 6px 10px;
  border-radius: 8px;
  background: #1d1619;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
  font-family: var(--wf-font-text);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--wf-text-1);
}

/* ============================================================
   [HOVER]
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .sb-group-head:hover { color: var(--wf-text-2); }
  .sb-home:hover { background: rgba(255, 255, 255, 0.04); }
  .sb-item:not(.active):hover { background: rgba(255, 255, 255, 0.035); color: var(--wf-text-1); }
  .sb-item:not(.active):hover .sb-item-ico { color: var(--hue); }
  .sb-lock:hover { background: rgba(255, 255, 255, 0.055); color: var(--wf-text-1); }
  .wf-icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--wf-text-1); }
  #logout-btn:hover { color: var(--wf-danger); background: rgba(251, 113, 133, 0.08); }
  .tb-refresh:hover { background: rgba(255, 255, 255, 0.07); color: var(--wf-text-1); }
  .tb-refresh:hover svg { transform: rotate(-90deg); }
  .fmenu button:hover { background: rgba(255, 255, 255, 0.06); color: var(--wf-text-1); }
  .fmenu button:hover svg { color: var(--wf-text-2); }
  .fmenu button.danger:hover { background: rgba(251, 113, 133, 0.1); color: #fecdd3; }
}
.sb button:focus-visible,
.tb button:focus-visible {
  outline: 2px solid rgba(244, 236, 234, 0.6);
  outline-offset: -2px;
}

/* ============================================================
   [MOBİL] kenar çubuğu çekmeceye döner
   ============================================================ */
.sb-scrim { display: none; }
@media (max-width: 960px) {
  .sb {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 86vw);
    background: #120a0d;
    transform: translateX(-102%);
    transition: transform 280ms var(--wf-ease-out);
    box-shadow: 24px 0 60px -20px rgba(0, 0, 0, 0.8);
  }
  #panel.is-nav-open .sb { transform: translateX(0); }
  .sb .sb-close { display: inline-grid; }
  .sb-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 59;
    background: rgba(4, 2, 3, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  #panel.is-nav-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .tb { padding: 0 16px; gap: 10px; }
  .tb-menu { display: inline-grid; }
  .tb-refresh span { display: none; }
  .tb-refresh { width: 36px; padding: 0; justify-content: center; }
  .content { padding: 16px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .sb, .sb-scrim, .tb-refresh svg, .sb-group-head svg { transition: none; }
}
