/* Ferah katman: tam ekran tuval, yüzen araç çubukları, alt şerit (peek / half).
   Önceki katmanların (index.html, premium.css, room-workflow.css) üstüne en son yüklenir. */

/* ---------- yüzen araç çubuğu ---------- */
.floatbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 2px;
  width: max-content; max-width: calc(100% - 24px); padding: 4px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 84%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  box-shadow: 0 8px 24px #0000002e; }
.floatbar .ricon { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; background: none; border-radius: 999px; display: inline-grid; place-items: center; flex: none; }
.floatbar .ricon:hover:not(:disabled) { background: var(--raise); }
.floatbar .ricon:disabled { opacity: .35; }
.floatbar .ricon span { display: none; }
.floatbar .ricon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.floatbar #roomMore svg { fill: currentColor; stroke: none; }
.floatbar .room-seg { width: auto !important; flex: none !important; margin: 0 4px 0 0; padding: 2px; border-radius: 999px; background: var(--raise); }
.floatbar .room-seg button { min-height: 36px !important; padding: 0 14px !important; border-radius: 999px; font-size: .85rem !important; }

/* ---------- oda: tuval ekranın tamamı ---------- */
.room-overflow { display: none !important; }
#view-room .room-wrap { position: relative; margin: 0; }
#view-room #roomCanvas { height: calc(100dvh - var(--topbar-h, 76px) - 48px); min-height: 360px; }
.room-fab { position: absolute; right: 16px; bottom: 16px; z-index: 3; min-height: 48px; padding: 0 22px; border-radius: 999px; box-shadow: 0 8px 22px #00000038; }
.room-wrap:has(#roomPanel:not([hidden])) .room-fab { display: none; }
.floatpill { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; width: min(420px, calc(100% - 32px)); display: flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 8px 24px #0000002e; font-size: .85rem; }
.floatpill[hidden] { display: none; }
.floatpill input { flex: 1; min-width: 0; }
.floatpill .x { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 999px; }
.room-wrap:has(.floatpill:not([hidden])) .room-fab { display: none; }
.drag-tip { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); z-index: 5; margin: 0; padding: 6px 14px; border-radius: 999px;
  background: var(--ink); color: var(--panel); font-size: .85rem; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px #0003; }
.drag-tip.blocked { background: var(--accent); color: #fff; }
.drag-tip[hidden] { display: none; }
#view-room .room-hint { position: absolute; left: 50%; right: auto; top: auto; bottom: 80px; transform: translateX(-50%); z-index: 3; width: max-content; max-width: calc(100% - 32px);
  margin: 0; padding: 8px 14px; border-radius: 14px; background: color-mix(in srgb, var(--panel) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: .8rem; text-align: center; transition: opacity .5s ease; pointer-events: none; }
#view-room .room-hint.fade { opacity: 0; }
body.presenting .floatbar, body.presenting .room-fab, body.presenting .floatpill, body.presenting .drag-tip { display: none !important; }

/* ---------- alt şerit ---------- */
.bsheet .grip { width: 40px; height: 5px; margin: 0 auto 2px; border-radius: 3px; background: var(--line); cursor: grab; touch-action: none; flex: none; }
.room-panel.bsheet { gap: 12px; padding: 8px 16px 16px; }
.room-panel.bsheet h3 { cursor: pointer; touch-action: none; }

@media (max-width: 760px) {
  /* tuval: üst çubuk ile alt sekmeler arası */
  body[data-screen="room"] .content { padding-top: 0 !important; padding-bottom: 0 !important; }
  body[data-screen="room"] #view-room { min-height: calc(100dvh - var(--topbar-h, 76px) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  #view-room .room-wrap { position: fixed; left: 0; right: 0; top: var(--topbar-h, 76px); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; margin: 0 !important; }
  #view-room #roomCanvas { height: 100% !important; min-height: 0 !important; border: 0 !important; border-radius: 0 !important; }
  body.presenting #view-room .room-wrap { top: 0; bottom: 0; }
  .floatbar { top: 10px; }
  #view-room .room-panel { position: absolute !important; left: 8px !important; right: 8px !important; bottom: 8px !important; top: auto !important; width: auto !important;
    z-index: 6; border-radius: 22px !important; transition: max-height .25s ease; box-shadow: 0 -6px 30px #0000003d; }
  #view-room .room-panel[data-state="peek"] { max-height: 150px !important; overflow: hidden !important; }
  #view-room .room-panel[data-state="half"] { max-height: 62% !important; overflow: auto !important; }
  #view-room .room-panel h3 { position: static !important; padding: 0 !important; }
  .room-fab { right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { #view-room .room-panel, #view-room .room-hint { transition: none; } }
.room-panel.bsheet h3 > span:first-child { flex: 1; min-width: 0; }
@media (max-width: 760px) { #view-room .room-panel[data-state="peek"] .pbody { display: none; } }
#view-room .room-hint:not([hidden]) { display: block !important; }

/* ---------- Tasarla: tuval tam ekran, adım çubuğu tuvalin üstünde yüzer ---------- */
#view-edit { position: relative; }
#view-edit .edit-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; margin: 0; width: max-content; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 84%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); box-shadow: 0 8px 24px #0000002e; }
#view-edit .edit-top .edit-steps { padding: 2px; border-radius: 999px; background: var(--raise); }
#view-edit .edit-top .edit-steps button { min-height: 36px; padding: 0 12px; border-radius: 999px; }
#view-edit .edit-top > button { min-height: 36px; padding: 0 12px; border: 0; background: none; border-radius: 999px; }
#view-edit .edit-top > button:hover { background: var(--raise); }
#view-edit .edit3d, #view-edit #editor { border-radius: var(--r-lg); }
#view-edit .edit3d { height: calc(100dvh - var(--topbar-h, 76px) - var(--editbar-h, 120px) - 96px); min-height: 360px; }
.edit3d-help { top: 64px !important; }
/* sağ üst köşe: Sunum (göz) ve önleri gizle */
#view-edit .view-corner { position: absolute; top: 12px; right: 12px; z-index: 4; display: flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 84%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); box-shadow: 0 8px 24px #0000002e; }
#view-edit .view-corner button { width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; background: none; border-radius: 999px; display: grid; place-items: center; color: var(--ink); }
#view-edit .view-corner button[hidden] { display: none; }
#view-edit .view-corner button:hover { background: var(--raise); }
#view-edit .view-corner button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
#view-edit .view-corner svg { width: 21px; height: 21px; }

/* Ölçü paneli: bölümler açılır-kapanır (ilk bölüm açık) */
form#f fieldset.fold > legend { cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; }
form#f fieldset.fold > legend::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; flex: none; }
form#f fieldset.fold.closed > legend::after { transform: rotate(-45deg); }
form#f fieldset.fold.closed > :not(legend) { display: none !important; }
form#f fieldset { padding-bottom: 4px; }

@media (max-width: 760px) {
  body[data-screen="edit"] .content, body[data-screen="olcu"] .content { padding-top: 0 !important; padding-bottom: 0 !important; }
  body[data-screen="edit"] #view-edit, body[data-screen="olcu"] #view-edit { min-height: calc(100dvh - var(--topbar-h, 76px) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  /* tuval: üst çubuk ile alt şerit arası, kenardan kenara */
  body[data-screen="edit"] .edit3d, body[data-screen="edit"] #editor,
  body[data-screen="olcu"] .edit3d, body[data-screen="olcu"] #editor {
    position: fixed !important; left: 0; right: 0; top: var(--topbar-h, 76px); bottom: calc(var(--tabbar-h) + var(--editbar-h, 120px) + env(safe-area-inset-bottom));
    width: auto !important; height: auto !important; min-height: 0 !important; max-height: none !important; border: 0 !important; border-radius: 0 !important; z-index: 5; }
  body[data-screen="olcu"] .edit3d, body[data-screen="olcu"] #editor { bottom: 50dvh; }
  body[data-screen="edit"] #view-edit .edit-top, body[data-screen="olcu"] #view-edit .edit-top { position: fixed; top: calc(var(--topbar-h, 76px) + 10px); z-index: 7; }
  body[data-screen="edit"] #view-edit .view-corner, body[data-screen="olcu"] #view-edit .view-corner { position: fixed; top: calc(var(--topbar-h, 76px) + 64px); right: 10px; z-index: 7; }
  #view-edit .edit-top .edit-steps button { padding: 0 10px; font-size: .82rem; }
  #view-edit .edit-top > button { padding: 0 10px; font-size: .82rem; }
  /* alt şerit: tek satır, yatay kayar */
  body[data-screen="edit"] .edit-bar { border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0; padding: 10px 12px 12px !important; gap: 8px;
    box-shadow: 0 -8px 28px #00000026; background: var(--panel); }
  body[data-screen="edit"] .edit-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
  body[data-screen="edit"] .edit-row { flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden !important; max-height: none !important; scrollbar-width: none; padding-bottom: 2px; }
  body[data-screen="edit"] .edit-row::-webkit-scrollbar { display: none; }
  body[data-screen="edit"] .edit-row > *, body[data-screen="edit"] #toolbar > * { flex: none !important; }
  body[data-screen="edit"] #toolbar .hint, body[data-screen="edit"] #toolbar .pos, body[data-screen="edit"] #toolbar .models { flex: none !important; }
  body[data-screen="edit"] #toolbar .shape-bar { display: flex; width: auto; }
  body[data-screen="edit"] #toolbar .shape-bar label { width: 110px; }
  /* ölçü paneli: alt şerit görünümü */
  body[data-screen="olcu"] .layout > form { max-height: 50dvh !important; border-radius: 22px 22px 0 0 !important; padding-top: 6px !important; }
  body[data-screen="olcu"] .layout > form::before { content: ''; display: block; width: 40px; height: 5px; margin: 4px auto 0; border-radius: 3px; background: var(--line); }
}

/* ---------- liste sayfaları: Kesim, Teklif ---------- */
.quote-total { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; margin: 0 0 16px; padding: 16px 20px; border-radius: var(--r-lg);
  background: var(--panel); border: 1px solid var(--line); }
.quote-total:empty { display: none; }
.quote-total span { color: var(--muted); font-size: .9rem; }
.quote-total b { font: 700 1.6rem var(--f-display, inherit); color: var(--accent); }
.quote-total small { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; }
.cut-notes { margin: 16px 0 0; }
.cut-notes summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: 8px 0; }
.cut-notes .note { margin-top: 4px; }
#view-workshop .workshop-grid, #view-quote .qhead { margin-bottom: 8px; }
.page-heading { margin-bottom: 24px; }

@media (max-width: 760px) {
  /* kesim listesi: her parça bir kart, bütün ölçüler görünür (yana kaydırma yok) */
  #view-cut .tablewrap { overflow: visible; border: 0; background: none; }
  #cut, #cut tbody { display: block; }
  #cut thead { display: none; }
  #cut tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin: 0 0 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  #cut td { display: grid; gap: 2px; padding: 0 !important; border: 0 !important; text-align: left !important; font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
  #cut td::before { content: attr(data-l); color: var(--muted); font-size: .7rem; letter-spacing: .02em; }
  #cut td.c-parca { grid-column: 1 / -1; font-weight: 700; font-size: 1rem; }
  #cut td.c-parca::before { display: none; }
  #cut td.c-renk, #cut td.c-dolapta, #cut td.c-bant, #cut td.c-kapak { grid-column: span 3; }
  #cut td.c-islem_yuzu, #cut td.c-linco_kanal, #cut td.c-pim_delik, #cut td.c-kavela { display: none; }
  #cut td.c-kapak:empty, #cut td.c-bant:empty { display: none; }
  /* teklif: kalem solda, tutar sağda, miktar × fiyat altında küçük */
  #view-quote .tablewrap { overflow: visible; }
  #quote, #quote tbody, #quote tfoot { display: block; }
  #quote thead { display: none; }
  #quote tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  #quote td { padding: 0 !important; border: 0 !important; }
  #quote td.q-l { grid-column: 1; grid-row: 1; font-weight: 600; }
  #quote td.q-t { grid-column: 2; grid-row: 1; font-weight: 600; }
  #quote td.q-q { grid-column: 1; grid-row: 2; text-align: left !important; color: var(--muted); font-size: .8rem; display: inline; }
  #quote td.q-p { grid-column: 2; grid-row: 2; color: var(--muted); font-size: .8rem; }
  #quote tfoot tr { grid-template-columns: minmax(0, 1fr) auto; }
  #quote tfoot td[colspan] { grid-column: 1; }
  #view-quote .qhead { display: grid; grid-template-columns: 1fr; gap: 12px; }
  #view-quote .qhead .primary { min-height: 48px; }
}

#toolbar .clear-all svg { display: none; width: 20px; height: 20px; }
/* ---------- telefon: üst çubuktaki dolap çipleri ve alt şerit sığsın ---------- */
@media (max-width: 760px) {
  /* "+ Dolap" sağda yuvarlak "+" olarak sabit; arkasından kayan çipler soluklaşarak altına girer */
  .cabchip.add { width: 32px; min-width: 32px; padding: 0; font-size: 0; display: inline-grid; place-items: center; border-radius: 999px;
    box-shadow: -14px 0 10px -2px var(--panel), 0 0 0 8px var(--panel); right: 0; }
  .cabchip.add::before { content: '+'; font-size: 1.1rem; font-weight: 600; line-height: 1; }
  .floatbar .room-seg button { padding: 0 11px !important; }
  /* alt şerit: Hepsini temizle sadece çöp kutusu */
  #toolbar .clear-all { width: 44px; min-width: 44px; padding: 0; font-size: 0; display: inline-grid; place-items: center; }
  #toolbar .clear-all svg { display: block; }
}
