/*
 * settings-page.css — Uygulama Ayarları › Sayfalar (sayfa başına bakım modu).
 * Solda sayfa tablosu (Sayfa · Durum · Kullanıcıya not · Son değişiklik), sağda
 * seçili sayfanın uygulamadaki bakım ekranı ve son değişiklikler. Bakım tonu
 * kehribar (--wf-warning). Döngü yok; kaydırmasız (1440×900'de 14 satır sığar).
 * Tasarım: docs/design-system.md §7.43 (uygulamadaki ekran §7.61)
 */

#view-settings {
  font-family: var(--wf-font-text);
  color: var(--wf-text-1);
}
#view-settings button:focus-visible,
.pgm-dlg button:focus-visible {
  outline: 2px solid rgba(244, 236, 234, 0.6);
  outline-offset: -2px;
}
.pgm {
  --pgm-tone: #fbbf24;
  --pgm-cols: minmax(180px, 1.25fr) minmax(150px, 0.8fr) minmax(150px, 1.3fr) minmax(110px, 0.62fr);
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 28%, 440px);
  gap: 14px;
  height: calc(100dvh - 64px - 48px);
  min-height: 560px;
}
.pgm-main,
.pgm-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ============================================================
   [BAŞ] ikon · başlık + tek cümle · özet
   ============================================================ */
.pgm-cap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding: 16px 18px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.06) 0%, transparent 100%);
}
.pgm-cap-ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.14);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.28);
  color: var(--pgm-tone);
}
.pgm-cap-ico svg { width: 20px; height: 20px; }
.pgm-cap-text { flex: 1; min-width: 0; }
.pgm-cap-text h2 {
  margin: 0;
  font-family: var(--wf-font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.005em;
  color: var(--wf-text-1);
}
.pgm-cap-text p { margin: 3px 0 0; font-size: 0.84rem; line-height: 1.45; color: var(--wf-text-3); }
.pgm-cap-end { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.pgm-count { font-size: 0.84rem; white-space: nowrap; color: var(--wf-text-3); }
.pgm-count b { font-family: var(--wf-font-display); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--wf-text-1); }
.pgm-count.is-on b { color: var(--pgm-tone); }

/* ============================================================
   [TABLO] hizalı dört sütun; bakımdaki satırda kehribar şerit
   ============================================================ */
.pgm-head,
.pgm-row {
  display: grid;
  grid-template-columns: var(--pgm-cols);
  align-items: center;
  column-gap: 16px;
  padding: 0 16px 0 20px;
}
.pgm-head {
  height: 36px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--wf-text-4);
}
.pgm-rows {
  flex: 1;
  min-height: 0;
  /* Rows fill the panel: 44 px at least (1440×900 holds all 14), a little more on tall screens */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(44px, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: auto;
  scrollbar-color: auto;
}
.pgm-rows::-webkit-scrollbar { width: 12px; }
.pgm-rows::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.pgm-rows::-webkit-scrollbar-thumb {
  border: 4px solid transparent;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1) padding-box;
}
.pgm-row {
  position: relative;
  min-height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease;
}
.pgm-row:last-child { border-bottom: 0; }
.pgm-row.is-sel { background: rgba(255, 255, 255, 0.04); }
.pgm-row.is-on { background: rgba(251, 191, 36, 0.045); }
.pgm-row.is-on.is-sel { background: rgba(251, 191, 36, 0.08); }
.pgm-row.is-on::before {
  content: '';
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--pgm-tone);
}
.pgm-skel {
  height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.01) 70%);
}
.pgm-empty { padding: 48px 24px; }

.pgm-page { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 4px 0; }
.pgm-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--wf-text-3);
  transition: background-color var(--wf-dur-state) ease, color var(--wf-dur-state) ease;
}
.pgm-ico svg { width: 15px; height: 15px; }
.pgm-row.is-on .pgm-ico { background: rgba(251, 191, 36, 0.14); color: var(--pgm-tone); }
.pgm-page-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pgm-page-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 600; line-height: 1.35; color: var(--wf-text-1); }
/* Short one-line descriptions (format.js); a narrow column wraps them, never cuts them */
.pgm-page-text span { font-size: 0.74rem; line-height: 1.4; color: var(--wf-text-4); }

.pgm-state { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pgm-sw {
  display: grid;
  place-items: center;
  width: 42px;
  height: 30px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: transform var(--wf-dur-press) var(--wf-ease-out), opacity var(--wf-dur-state) ease;
}
.pgm-sw .dlg-switch { margin: 0; }
.pgm-sw.is-on .dlg-switch { background: var(--pgm-tone); }
.pgm-sw.is-on .dlg-switch::after { transform: translateX(14px); background: #1b1206; }
.pgm-sw:active:not(:disabled) { transform: scale(0.94); }
.pgm-sw:disabled { opacity: 0.5; cursor: default; }
.pgm-state-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pgm-state-text b { font-size: 0.84rem; font-weight: 600; line-height: 1.35; color: var(--wf-text-2); }
.pgm-row.is-on .pgm-state-text b { color: var(--pgm-tone); }
.pgm-state-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.74rem; line-height: 1.4; color: var(--wf-text-4); }

.pgm-msg { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* Two lines fit a 46 px row; the whole note is in the preview on the right */
.pgm-msg-text {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--wf-text-2);
}
.pgm-msg-text.is-empty { color: var(--wf-text-4); }
.pgm-edit { flex-shrink: 0; width: 30px; height: 30px; }

.pgm-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pgm-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; font-weight: 600; line-height: 1.35; color: var(--wf-text-2); }
.pgm-who span { font-size: 0.74rem; line-height: 1.4; white-space: nowrap; color: var(--wf-text-4); }
.pgm-who i { display: none; font-style: normal; font-size: 0.74rem; line-height: 1.4; white-space: nowrap; color: var(--wf-text-4); }

/* ============================================================
   [YAN] uygulamadaki görünüm · son değişiklikler
   ============================================================ */
.pgm-pv-wrap { flex: none; padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.pgm-log-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 0 6px; }
/* The page's name and state wrap under the title when they do not fit (never cut) */
.pgm-side-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; margin: 0 0 12px; }
.pgm-log-wrap .pgm-side-title { padding: 0 16px; margin-bottom: 6px; }
.pgm-side-title b { flex-shrink: 0; font-size: 0.86rem; font-weight: 700; color: var(--wf-text-1); }
.pgm-side-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; color: var(--wf-text-4); }

/* Uygulamanın bakım kartının küçük kopyası: solda metin, sağda sahne + Winry */
.pgm-pv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40%;
  /* Height follows the text (a long note never gets cut at the bottom) */
  min-height: 210px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #0e0a16 0%, #0a0711 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 14px 34px -20px rgba(0, 0, 0, 0.9);
  font-family: var(--wf-font-text);
  transition: opacity var(--wf-dur-state) ease;
}
.pgm-pv.is-off { opacity: 0.62; }
/* The side thumbnail is narrow: the sentence under the title stays in the dialog's larger preview */
.pgm-side .pgm-pv-lead { display: none; }
.pgm-pv-body { display: flex; flex-direction: column; justify-content: center; gap: 7px; min-width: 0; padding: 16px 12px 16px 16px; }
.pgm-pv-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--wf-font-display);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--wf-text-1);
}
.pgm-pv-title i { display: grid; flex-shrink: 0; color: #ffb6bd; }
.pgm-pv-title svg { width: 15px; height: 15px; }
.pgm-pv-lead { font-size: 0.72rem; line-height: 1.45; color: var(--wf-text-3); }
.pgm-pv-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 2px 9px;
  border-left: 2px solid var(--pgm-tone);
  font-size: 0.74rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  color: var(--wf-text-1);
}
.pgm-pv-note em { font-style: normal; font-size: 0.66rem; color: var(--wf-text-4); }
.pgm-pv-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.pgm-pv-acts i {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: linear-gradient(180deg, #1c1526 0%, #0c0911 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wf-text-1);
}
.pgm-pv-acts i.is-ghost { background: transparent; box-shadow: none; color: var(--wf-text-3); }
.pgm-pv-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 60% 100%, rgba(251, 191, 36, 0.2) 0%, transparent 62%),
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px) 0 0 / 11px 11px,
    #0c0812;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.06);
}
.pgm-pv-stage img {
  position: absolute;
  right: 4%;
  bottom: 0;
  height: 64%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom right;
}
.pgm-pv-bubble {
  position: absolute;
  top: 10px;
  left: 8px;
  z-index: 1;
  max-width: 84%;
  padding: 6px 8px;
  border-radius: 9px 9px 3px 9px;
  background: linear-gradient(180deg, #1d1626 0%, #151019 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--wf-text-1);
}

.pgm-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: auto;
  scrollbar-color: auto;
}
.pgm-log::-webkit-scrollbar { width: 12px; }
.pgm-log::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.pgm-log::-webkit-scrollbar-thumb { border: 4px solid transparent; border-radius: 99px; background: rgba(255, 255, 255, 0.1) padding-box; }
.pgm-log-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.pgm-log-row:last-child { border-bottom: 0; }
.pgm-ava {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--wf-text-2);
}
.pgm-ava img { width: 100%; height: 100%; object-fit: cover; }
.pgm-log-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pgm-log-text b { font-size: 0.84rem; font-weight: 600; line-height: 1.35; color: var(--wf-text-1); }
.pgm-log-text b i { font-style: normal; font-weight: 500; }
.pgm-log-text b i.is-on { color: var(--pgm-tone); }
.pgm-log-text b i.is-off { color: var(--wf-success); }
.pgm-log-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.74rem; line-height: 1.4; color: var(--wf-text-4); }
.pgm-log-empty { margin: 6px 16px; font-size: 0.8rem; line-height: 1.5; color: var(--wf-text-4); }

/* ============================================================
   [PENCERE] not + canlı önizleme yan yana
   ============================================================ */
.pgm-dlg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.pgm-dlg .dlg-lead { margin-top: 0; }
.pgm-dlg .dlg-lead b { font-weight: 600; color: var(--wf-text-1); }
.pgm-dlg-opt { margin-left: 4px; font-style: normal; font-weight: 500; color: var(--wf-text-4); }
.pgm-dlg-msg { min-height: 92px; }
.pgm-dlg .pgm-dlg-msg:focus-visible { outline: none; }
.pgm-dlg-count { align-self: flex-end; font-size: 0.72rem; font-variant-numeric: tabular-nums; color: var(--wf-text-4); }
.pgm-dlg-pv { --pgm-tone: #fbbf24; }
.pgm-dlg-pv .pgm-pv { aspect-ratio: auto; min-height: 230px; }

@media (hover: hover) and (pointer: fine) {
  .pgm-row:not(.is-sel):not(.is-on):hover { background: rgba(255, 255, 255, 0.025); }
  .pgm-row.is-on:not(.is-sel):hover { background: rgba(251, 191, 36, 0.065); }
  .pgm-sw:hover:not(:disabled) .dlg-switch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24); }
  .pgm-edit:hover { background: rgba(255, 255, 255, 0.06); color: var(--wf-text-1); }
}

/* Large screens keep the 1440×900 proportions (rows do not drift apart) */
@media (min-width: 1880px) and (min-height: 1100px) {
  .pgm { zoom: 1.12; height: calc((100dvh - 112px) / 1.12); }
}
@media (min-width: 2200px) and (min-height: 1300px) {
  .pgm { zoom: 1.26; height: calc((100dvh - 112px) / 1.26); }
}
@media (min-height: 1100px) {
  .pgm-ico { width: 34px; height: 34px; border-radius: 10px; }
  .pgm-ico svg { width: 16px; height: 16px; }
  .pgm-page-text b { font-size: 0.94rem; }
  .pgm-page-text span, .pgm-state-text span, .pgm-who span { font-size: 0.78rem; }
  .pgm-msg-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pgm-who i { display: block; font-size: 0.78rem; }
  .pgm-pv-title { font-size: 1.12rem; }
  /* A tall column: a larger thumbnail (Winry grows with the stage), less empty column under a short history */
  .pgm-side .pgm-pv { min-height: 300px; }
  .pgm-pv-lead, .pgm-pv-note { font-size: 0.8rem; }
  .pgm-pv-bubble { font-size: 0.7rem; }
}
@media (max-width: 1280px) {
  .pgm { grid-template-columns: minmax(0, 1fr); }
  .pgm-side { display: none; }
}
@media (max-width: 900px) {
  .pgm-dlg { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .pgm { height: auto; min-height: 0; }
  .pgm-cap { flex-wrap: wrap; }
  .pgm-cap-end { width: 100%; justify-content: space-between; }
  .pgm-head { display: none; }
  .pgm-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; padding: 8px 14px 8px 16px; }
  .pgm-msg { grid-column: 1 / -1; }
  .pgm-row:not(.is-on) .pgm-msg { display: none; }
  .pgm-who { display: none; }
  .pgm-state-text span { display: none; }
}
