/* PDF Stüdyo — kırmızı & beyaz tema (masaüstü sürümle aynı renkler) */
@font-face { font-family: "WORK Sans"; src: url("../../vendor/fonts/DejaVuSans.ttf"); font-weight: 400; }
@font-face { font-family: "WORK Sans"; src: url("../../vendor/fonts/DejaVuSans-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "WORK Serif"; src: url("../../vendor/fonts/DejaVuSerif.ttf"); font-weight: 400; }
@font-face { font-family: "WORK Serif"; src: url("../../vendor/fonts/DejaVuSerif-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "WORK Mono"; src: url("../../vendor/fonts/DejaVuSansMono.ttf"); font-weight: 400; }
@font-face { font-family: "WORK Mono"; src: url("../../vendor/fonts/DejaVuSansMono-Bold.ttf"); font-weight: 700; }

:root {
  --red: #D7263D;
  --red-deep: #A4161A;
  --red-dark: #7A0C14;
  --tint: #FDECEE;
  --blush: #FFF6F6;
  --line: #F0D3D6;
  --ink: #2B1A1C;
  --ink-soft: #86666A;
  --canvas: #F3E7E8;
  --header: linear-gradient(#E23349, #B3172B);
  --surface: #ffffff;
  --surface-hover: #fdf3f4;
  --page-shadow: rgba(43, 26, 28, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 13px; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }
kbd { font-family: inherit; font-size: 11px; color: var(--ink-soft); margin-left: auto; padding-left: 16px; }

#app { height: 100%; height: 100dvh; display: flex; flex-direction: column; }
#app.no-doc .doc-only { display: none !important; }
.grow { flex: 1; }

/* ---------- Başlık ---------- */
.header {
  position: relative; z-index: 10; flex: none; height: 56px;
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: var(--header); color: #fff; box-shadow: 0 2px 6px rgba(122, 12, 20, .25);
}
.back { display: flex; align-items: center; gap: 3px; color: rgba(255,255,255,.9); text-decoration: none; font-weight: 800; font-size: 12px; letter-spacing: 1.5px; padding: 6px 8px 6px 2px; border-radius: 8px; }
.back:hover { background: rgba(255,255,255,.14); }
.back svg { width: 16px; height: 16px; }
.logo { display: flex; align-items: center; gap: 9px; margin-left: 4px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--red); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.logo-mark svg { width: 18px; height: 18px; }
.logo-text { font-weight: 800; font-size: 16px; white-space: nowrap; }

.hbtn {
  height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 12px; white-space: nowrap;
  border-radius: 9px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.18);
  color: #fff; font-weight: 600; font-size: 12.5px;
}
.hbtn svg { width: 16px; height: 16px; }
.hbtn:hover { background: rgba(255,255,255,.28); }
.hbtn:active { background: rgba(255,255,255,.34); }
.hbtn:disabled { opacity: .45; cursor: default; }
.hbtn.on { background: #fff; color: var(--red-deep); border-color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.split { position: relative; display: flex; }
.split .hbtn:first-child { border-radius: 9px 0 0 9px; }
.split .caret { border-radius: 0 9px 9px 0; border-left: 0; padding: 0 7px; }
.split .caret svg { width: 12px; height: 12px; }

.search { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 10px; margin-right: 6px; border-radius: 8px; background: var(--surface); color: var(--ink); }
.search > svg { width: 13px; height: 13px; color: var(--ink-soft); }
.search input { width: 130px; border: 0; outline: 0; background: none; font-size: 12.5px; }
.search-count { font-size: 11px; font-weight: 700; color: var(--red-deep); white-space: nowrap; }
.mini { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--red-deep); display: grid; place-items: center; }
.mini:hover { background: var(--tint); }
.mini svg { width: 12px; height: 12px; }

/* ---------- Menüler ---------- */
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 220px; padding: 5px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(43, 26, 28, .2);
}
.menu.right { left: auto; right: 0; }
.split .menu { left: auto; right: 0; }
.menu button { display: flex; width: 100%; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; font-size: 13px; white-space: nowrap; }
.menu button:hover { background: var(--tint); }
.menu button.danger { color: var(--red-deep); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ---------- Düzenleme araç çubuğu ---------- */
.edit-toolbar { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); }
.tool-row { height: 62px; display: flex; align-items: center; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.icon { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--red-deep); padding: 0; }
.icon svg { width: 17px; height: 17px; }
.icon:hover { background: var(--tint); }
.icon:disabled { opacity: .35; cursor: default; background: none; }
.icon.sm { width: 26px; height: 24px; }
.icon.sm svg { width: 15px; height: 15px; }
.vsep { width: 1px; height: 34px; background: var(--line); margin: 0 6px; flex: none; }
.vsep.sm { height: 16px; }
.tools { display: flex; gap: 2px; }
.tool {
  min-width: 64px; height: 50px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: 10.5px; font-weight: 500; padding: 0 6px;
}
.tool svg { width: 18px; height: 18px; }
.tool span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tool:hover { background: var(--tint); }
.tool.on { background: var(--red); color: #fff; }
.page-menu-wrap { position: relative; flex: none; }
.page-menu-btn { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--red-deep); font-weight: 600; }
.page-menu-btn svg { width: 16px; height: 16px; }
.page-menu-btn:hover { background: var(--tint); }
.page-menu-wrap .menu { position: fixed; top: auto; }

.prop-row:has(.props:empty) { display: none; }
.prop-row { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--blush); border-bottom: 1px solid var(--line); }
.prop-row .info { width: 13px; height: 13px; color: var(--red); }
.hint { color: var(--ink-soft); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.props { display: flex; align-items: center; gap: 14px; flex: none; }
.swatches { display: flex; gap: 7px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.14); padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--red); }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.prop { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 12px; }
.prop input[type=range] { width: 110px; accent-color: var(--red); }
.prop b { color: var(--ink); font-weight: 600; min-width: 34px; }
.prop select { height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 6px; color: var(--ink); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.stepper button { width: 22px; height: 24px; border: 0; background: none; color: var(--red-deep); font-weight: 700; }
.stepper span { min-width: 26px; text-align: center; color: var(--ink); font-weight: 600; }
.toggle { display: flex; align-items: center; gap: 5px; color: var(--ink); font-size: 12px; cursor: pointer; }
.toggle input { accent-color: var(--red); }
.bold-btn { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-weight: 800; color: var(--ink); }
.bold-btn.on { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Ana alan ---------- */
.main { flex: 1; min-height: 0; display: flex; }
.sidebar { width: 172px; flex: none; overflow-y: auto; background: var(--blush); border-right: 1px solid var(--line); }
#app.hide-sidebar .sidebar { display: none; }
.thumbs { display: flex; flex-direction: column; gap: 12px; padding: 12px 10px; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 8px; cursor: pointer; position: relative; }
.thumb.sel { background: var(--tint); }
.thumb.drop { outline: 2px dashed var(--red); outline-offset: -1px; }
.thumb canvas { display: block; max-width: 100%; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.thumb.sel canvas { border: 2.5px solid var(--red); }
.thumb .num { font-size: 11px; font-weight: 600; color: var(--ink-soft); padding: 1px 9px; border-radius: 99px; }
.thumb.sel .num { background: var(--red); color: #fff; }
.thumb .more { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: var(--surface); color: var(--red-deep); display: none; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.2); padding: 0; font-weight: 800; line-height: 1; }
.thumb:hover .more, .thumb.sel .more { display: grid; }

.viewer { flex: 1; min-width: 0; overflow: auto; background: var(--canvas); position: relative; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; min-width: min-content; }
.page { position: relative; background: #fff; box-shadow: 0 2px 10px var(--page-shadow); flex: none; }
.page canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.page .ov { touch-action: auto; }
#app.editing .page .ov { touch-action: none; }
#app.editing[data-tool="select"] .page .ov { cursor: default; }
#app.editing[data-tool="editText"] .page .ov, #app.editing[data-tool="addText"] .page .ov { cursor: text; }
#app.editing[data-tool="highlight"] .page .ov, #app.editing[data-tool="underline"] .page .ov, #app.editing[data-tool="strikeout"] .page .ov { cursor: text; }
#app.editing[data-tool="draw"] .page .ov, #app.editing[data-tool="rect"] .page .ov, #app.editing[data-tool="ellipse"] .page .ov,
#app.editing[data-tool="arrow"] .page .ov, #app.editing[data-tool="cover"] .page .ov, #app.editing[data-tool="image"] .page .ov { cursor: crosshair; }
#app.editing[data-tool="erase"] .page .ov { cursor: pointer; }
.inline-editor {
  position: absolute; z-index: 5; margin: 0; padding: 0; border: 0; resize: none; overflow: hidden; white-space: pre;
  outline: 1.5px dashed var(--red); outline-offset: 2px; background: transparent; line-height: 1.2;
}
.page-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); }

/* ---------- Durum çubuğu ---------- */
.status { flex: none; height: 32px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border-top: 1px solid var(--line); }
.status > div { display: flex; align-items: center; gap: 4px; }
.st-file { flex: 1; min-width: 0; gap: 6px !important; }
.st-file svg { width: 11px; height: 11px; color: var(--red); }
#file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.dirty { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.dirty i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
#page-label { min-width: 90px; text-align: center; font-weight: 500; white-space: nowrap; }
.st-zoom { flex: 1; justify-content: flex-end; }
#zoom-label { width: 48px; text-align: center; font-weight: 500; }

/* ---------- Karşılama ---------- */
.welcome { flex: 1; display: grid; place-items: center; overflow: auto; overflow-x: hidden; position: relative; background: linear-gradient(var(--surface), var(--blush), var(--tint)); }
#app:not(.no-doc) .welcome { display: none; }
.welcome::before, .welcome::after { content: ""; position: absolute; border-radius: 50%; background: var(--red); pointer-events: none; }
.welcome::before { width: 520px; height: 520px; right: -120px; top: -200px; opacity: .07; }
.welcome::after { width: 360px; height: 360px; left: -140px; bottom: -120px; opacity: .05; }
.welcome-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 16px; text-align: center; }
.welcome-icon { width: 92px; height: 92px; border-radius: 26px; background: var(--header); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 16px rgba(215, 38, 61, .35); }
.welcome-icon svg { width: 48px; height: 48px; }
.welcome h1 { margin: 0; font-size: 34px; }
.welcome p { margin: -10px 0 0; color: var(--ink-soft); font-size: 15px; }
.welcome small { color: var(--ink-soft); font-size: 12.5px; margin-top: -8px; }
.welcome .note { font-size: 12px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chips span { height: 30px; display: flex; align-items: center; padding: 0 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; }

.primary-btn { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--red); color: #fff; font-weight: 600; font-size: 13px; }
.primary-btn:hover { background: #c81f35; }
.primary-btn:active { background: var(--red-deep); }
.primary-btn svg { width: 17px; height: 17px; }
.welcome .primary-btn { height: 42px; font-size: 15px; padding: 0 22px; }
.soft-btn { height: 34px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--red-deep); font-weight: 500; }
.soft-btn:hover { background: var(--tint); }
.form select, .prop select { color: var(--ink); }
.danger-btn { height: 34px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--red); color: #fff; font-weight: 600; }

.drop-target { position: fixed; inset: 0; z-index: 30; background: rgba(215, 38, 61, .1); pointer-events: none; }
.drop-target::after { content: ""; position: absolute; inset: 14px; border: 3px dashed var(--red); border-radius: 16px; }

/* ---------- Diyaloglar ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.28); display: grid; place-items: center; padding: 16px; }
.modal { width: min(540px, 100%); padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 48px rgba(0,0,0,.3); }
.small-modal { width: min(420px, 100%); }
.modal h2 { margin: 0 0 4px; font-size: 17px; }
.modal p { margin: 0 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.modal-head { display: flex; gap: 12px; margin-bottom: 16px; }
.modal-head p { margin: 0; font-size: 12.5px; }
.modal-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--header); color: #fff; display: grid; place-items: center; }
.modal-icon svg { width: 24px; height: 24px; }
.form { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--blush); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.form label { display: flex; align-items: center; gap: 10px; }
.form label > span:first-child { width: 90px; font-weight: 500; font-size: 13px; }
.form select { height: 28px; min-width: 200px; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 12px; font-size: 12.5px; }
.seg button.on { background: var(--red); color: #fff; }
.small { font-size: 12px !important; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#dlg-input { width: 100%; height: 32px; margin: -6px 0 16px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.busy { width: min(400px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.busy-head { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.busy-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 12.5px; }
.bar { height: 6px; border-radius: 3px; background: var(--tint); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.bar.indeterminate span { width: 30%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--tint); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 99px; background: rgba(122, 12, 20, .95); color: #fff; font-weight: 500; font-size: 13px; box-shadow: 0 3px 8px rgba(0,0,0,.25); pointer-events: none; text-align: center; }

/* ---------- Dar ekranlar ---------- */
@media (max-width: 1100px) {
  .hbtn span { display: none; }
  .hbtn { padding: 0 9px; }
  .hint { display: none; }
  .prop-row .info { display: none; }
  .props { flex: 1; overflow-x: auto; }
}
@media (max-width: 720px) {
  .logo-text { display: none; }
  .search input { width: 80px; }
  .sidebar { display: none; }
  #app.show-sidebar-mobile .sidebar { display: block; position: absolute; z-index: 8; top: 0; bottom: 0; left: 0; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .main { position: relative; }
  #file-name { max-width: 110px; }
  .dirty { font-size: 0; }
  .pages { padding: 12px 8px; }
  .header { padding: 0 8px; gap: 5px; }
}
@media (max-width: 480px) {
  .search { display: none !important; }
  .st-zoom #zoom-label, .st-zoom .vsep { display: none; }
}

/* "⋯" menüsü yalnızca dar ekranlarda */
.more-wrap { position: relative; display: none; }

/* ---------- Telefon ---------- */
@media (max-width: 720px) {
  /* Başlık: geri oku, logo, Aç · Kaydet · Düzenle · ⋯ */
  .header { height: auto; min-height: 54px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); gap: 6px; }
  .back { font-size: 0; gap: 0; padding: 8px 4px; }
  .back svg { width: 20px; height: 20px; }
  .logo { margin-left: 0; }
  .hbtn { height: 38px; min-width: 40px; justify-content: center; padding: 0 10px; border-radius: 11px; }
  .hbtn svg { width: 19px; height: 19px; }
  #btn-word, #btn-ocr, .split .caret { display: none; }
  .split .hbtn:first-child { border-radius: 11px; }
  .more-wrap { display: block; }
  #app.no-doc .more-wrap { display: none; }
  .menu { min-width: 230px; }
  .menu button { padding: 11px 12px; font-size: 14px; }

  /* Düzenleme araçları ekranın altında (başparmakla erişim) */
  .main { order: 2; }
  .edit-toolbar { order: 3; position: relative; z-index: 15; display: flex; flex-direction: column; border-bottom: 0; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(43, 26, 28, .08); }
  .prop-row { order: -1; height: 46px; padding: 0 12px; border-bottom: 1px solid var(--line); }
  .props { gap: 12px; scrollbar-width: none; }
  .props::-webkit-scrollbar { display: none; }
  .tool-row { height: auto; padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-bottom: 0; gap: 2px; scrollbar-width: none; }
  .tool-row::-webkit-scrollbar { display: none; }
  .tool { width: auto; min-width: 62px; height: 54px; padding: 0 6px; font-size: 11px; }
  .tool svg { width: 21px; height: 21px; }
  .icon { width: 40px; height: 40px; }
  .page-menu-btn { height: 40px; }
  .page-menu-wrap { position: sticky; right: 0; margin-left: auto; padding-left: 10px; background: linear-gradient(90deg, transparent, var(--surface) 10px); }
  .swatch { width: 26px; height: 26px; }
  .prop input[type=range] { width: 96px; }
  .stepper button { width: 30px; height: 30px; }
  .bold-btn { width: 32px; height: 32px; }

  /* Durum çubuğu: düzenlerken gizli, aksi halde dokunmaya uygun */
  .status { order: 4; height: auto; min-height: 46px; padding: 4px max(10px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  #app.editing .status { display: none; }
  .icon.sm { width: 36px; height: 36px; }
  .icon.sm svg { width: 18px; height: 18px; }
  #page-label { min-width: 74px; font-size: 13px; }

  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .welcome h1 { font-size: 30px; }
  .form label { flex-wrap: wrap; gap: 6px; }
  .form label > span:first-child { width: 100%; }
  .form select { min-width: 0; width: 100%; height: 36px; }
  .modal { padding: 20px; }
  .modal-actions button { flex: 1; height: 40px; }
}
@media (max-width: 480px) {
  .st-file { display: none !important; }
  .status { justify-content: space-between; }
  .st-zoom { flex: none; }
  .logo-mark { width: 32px; height: 32px; }
}
