/* =========================================================
   Admin içerik düzenleme araçları (js/icerik.js)
   Ziyaretçiler bunların hiçbirini görmez: düğmeler yalnızca
   body.is-editor.ed-on durumunda görünür.
   ========================================================= */

/* ---------- Kalem / görsel düzenleme düğmeleri (sağ üst) ---------- */
.ed-pen, .ed-cert-tools, .ed-cert-add, .ed-switch { display: none; }
.is-editor.ed-on .ed-pen { display: grid; }
.is-editor.ed-on .ed-cert-tools { display: flex; }
.is-editor.ed-on .ed-cert-add { display: flex; }
.is-editor .ed-switch { display: inline-flex; }

.ed-pen {
  position: absolute; top: .8rem; right: .8rem; z-index: 20;
  width: 40px; height: 40px; place-items: center; border-radius: 50%;
  background: var(--white); color: var(--gold-dark); border: 1px solid var(--gold-metal);
  font-size: .9rem; cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(59, 42, 30, .45);
  transition: background .25s, color .25s, transform .3s var(--ease);
}
.ed-pen:hover, .ed-pen:focus-visible { background: var(--gold); color: var(--white); transform: scale(1.08); }
.ed-pen-media { width: 44px; height: 44px; font-size: 1rem; background: var(--gold); color: var(--white); border-color: var(--white); }
.ed-pen-media:hover { background: var(--gold-dark); }
/* blob ve kemer çerçevelerde düğme şeklin dışında kalmasın */
.service-visual > .ed-pen-media { top: 12%; right: 12%; }
.hero-visual > .ed-pen-media, .about-visual > .ed-pen-media { top: 14%; right: 10%; }

/* düzenlenebilir alanların hafif çerçevesi */
.is-editor.ed-on .ed-target[data-edit-group] { outline: 1px dashed transparent; outline-offset: 8px; transition: outline-color .25s; }
.is-editor.ed-on .ed-target[data-edit-group]:hover { outline-color: var(--gold-metal); }
.is-editor.ed-on .section-head > .ed-pen { top: -.4rem; right: -.4rem; }

/* ---------- Düzenleme modu anahtarı (sol alt) ---------- */
.ed-switch {
  position: fixed; left: 1.4rem; bottom: 1.6rem; z-index: 96;
  align-items: center; gap: .55rem; height: 44px; padding: 0 1.1rem;
  border-radius: 999px; border: 1px solid var(--gold-metal);
  background: var(--white); color: var(--text-soft);
  font: 600 .7rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase;
  box-shadow: 0 12px 28px -14px rgba(59, 42, 30, .5); cursor: pointer;
}
.ed-switch[aria-pressed="true"] { background: var(--text); color: var(--gold-metal); border-color: var(--text); }
.ed-switch i { font-size: .9rem; }

/* ---------- Sertifika araçları ---------- */
.cert-card { position: relative; }
.ed-cert-tools {
  position: absolute; top: .6rem; right: .6rem; z-index: 5; gap: .3rem;
  padding: .3rem; border-radius: 999px; background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 18px -8px rgba(59, 42, 30, .45);
}
.ed-cert-btn {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: var(--gold-dark); font-size: .78rem; cursor: pointer; transition: background .2s, color .2s;
}
.ed-cert-btn:hover:not(:disabled) { background: var(--gold); color: var(--white); }
.ed-cert-btn:disabled { opacity: .3; cursor: default; }
.ed-cert-btn:last-child:hover { background: #a3402e; }

.ed-cert-add {
  flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
  aspect-ratio: 4 / 3; width: 100%; cursor: pointer;
  border: 1.5px dashed var(--gold); background: var(--parchment); color: var(--gold-dark);
  font: 600 .72rem/1 var(--font-body); letter-spacing: .18em; text-transform: uppercase;
  transition: background .3s, transform .4s var(--ease);
}
.ed-cert-add:hover { background: var(--wheat); transform: translateY(-4px); }
.ed-cert-add-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--white); font-size: 1.1rem; }

/* ---------- Pencere (modal) ---------- */
body.ed-modal-open { overflow: hidden; }
.ed-modal {
  position: fixed; inset: 0; z-index: 320; display: grid; place-items: center; padding: 1.5rem;
  opacity: 0; transition: opacity .3s;
  font-family: var(--font-body); color: var(--text);
}
.ed-modal.open { opacity: 1; }
.ed-backdrop { position: absolute; inset: 0; background: rgba(35, 25, 17, .72); }
.ed-box {
  position: relative; z-index: 1; width: min(560px, 100%); max-height: calc(100vh - 3rem);
  display: flex; flex-direction: column; background: var(--white);
  border-top: 3px solid var(--gold);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .5);
  transform: translateY(16px); transition: transform .35s var(--ease);
}
.ed-box.wide { width: min(860px, 100%); }
.ed-modal.open .ed-box { transform: none; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.6rem; border-bottom: 1px solid var(--line); }
.ed-head h3 { font-family: var(--font-head); font-weight: 500; font-size: 1.45rem; color: var(--text); }
.ed-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); color: var(--text-soft); cursor: pointer; flex: none; }
.ed-x:hover { background: var(--parchment); }
.ed-body { padding: 1.4rem 1.6rem; overflow-y: auto; display: grid; gap: 1.3rem; }
.ed-foot { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.6rem; border-top: 1px solid var(--line); background: var(--parchment); flex-wrap: wrap; }
.ed-spacer { flex: 1; }

.ed-hint { font-size: .8rem; color: var(--text-soft); line-height: 1.55; }
.ed-label { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: .45rem; }
.ed-label small { font-weight: 400; letter-spacing: .04em; text-transform: none; color: var(--text-soft); font-size: .72rem; }
.ed-field { display: block; }
.ed-confirm-text { color: var(--text-soft); }

/* yazı alanı */
.ed-tools { display: flex; gap: .25rem; padding: .3rem; border: 1px solid var(--line); border-bottom: 0; background: var(--parchment); }
.ed-tool { width: 34px; height: 30px; border-radius: 4px; color: var(--text-soft); cursor: pointer; font-size: .8rem; }
.ed-tool:hover { background: var(--white); color: var(--gold-dark); }
.ed-area {
  min-height: 46px; padding: .8rem 1rem; border: 1px solid var(--line); background: var(--white);
  font-size: .95rem; line-height: 1.65; color: var(--text); outline: none; cursor: text;
}
.ed-area.rich { min-height: 180px; max-height: 46vh; overflow-y: auto; }
.ed-area:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229, 192, 96, .25); }
.ed-area p + p, .ed-area p + ul, .ed-area ul + p { margin-top: .7rem; }
.ed-area ul { padding-left: 1.3rem; list-style: disc; }
.ed-area em { font-family: var(--font-head); color: var(--gold-dark); }

.ed-input {
  width: 100%; height: 46px; padding: 0 1rem; border: 1px solid var(--line); background: var(--white);
  font: inherit; font-size: .95rem; color: var(--text); outline: none;
}
.ed-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229, 192, 96, .25); }

/* düğmeler */
.ed-btn-primary, .ed-btn-ghost, .ed-btn-danger, .ed-btn-link {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 44px; padding: 0 1.4rem; cursor: pointer;
  font: 600 .72rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  transition: background .25s, color .25s, opacity .25s;
}
.ed-btn-primary { background: var(--gold); color: var(--white); }
.ed-btn-primary:hover:not(:disabled) { background: var(--gold-dark); }
.ed-btn-ghost { border: 1px solid var(--line); color: var(--text-soft); background: var(--white); }
.ed-btn-ghost:hover { border-color: var(--gold); color: var(--gold-dark); }
.ed-btn-danger { background: #a3402e; color: var(--white); }
.ed-btn-danger:hover { background: #87321f; }
.ed-btn-link { padding: 0 .4rem; color: var(--text-soft); letter-spacing: .08em; }
.ed-btn-link:hover:not(:disabled) { color: var(--gold-dark); }
:is(.ed-btn-primary, .ed-btn-link):disabled { opacity: .45; cursor: default; }

/* ---------- Görsel seçici ---------- */
.ed-media-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 1.8rem; align-items: start; }
.ed-preview {
  position: relative; overflow: hidden; width: 100%; max-width: 300px; margin: 0 auto .7rem;
  aspect-ratio: 3 / 4; background: linear-gradient(145deg, var(--wheat), var(--gold-metal) 55%, var(--gold));
}
.ed-preview.frame-window { border-radius: 999px 999px 6px 6px; box-shadow: none; }
.ed-preview.frame-blob { aspect-ratio: 1 / 1.05; }
.ed-preview.frame-video { aspect-ratio: 9 / 16; max-width: 220px; border-radius: 18px; box-shadow: none; }
.ed-preview img, .ed-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ed-cert-preview { aspect-ratio: 4 / 3; max-width: 100%; border: 1px solid var(--line); background: var(--parchment); }
.ed-cert-preview img { object-fit: contain; background: var(--white); }
.ed-preview-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem; color: var(--white); font-size: .85rem; }
.ed-preview-empty i { font-size: 2rem; }

.ed-upload { display: grid; gap: .6rem; padding: 1.2rem; border: 1.5px dashed var(--gold-metal); background: var(--parchment); }
.ed-upload .ed-btn-primary { width: 100%; }
.ed-progress { height: 4px; background: var(--wheat); overflow: hidden; display: none; }
.ed-progress.on { display: block; }
.ed-progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
.ed-upload-status { font-size: .8rem; color: var(--text-soft); min-height: 1.2em; }

.ed-posts-wrap { margin-top: 1rem; border: 1px solid var(--line); }
.ed-posts-wrap summary { padding: .85rem 1rem; cursor: pointer; font-size: .82rem; font-weight: 500; color: var(--gold-dark); list-style: none; }
.ed-posts-wrap summary::-webkit-details-marker { display: none; }
.ed-posts-wrap[open] summary { border-bottom: 1px solid var(--line); }
.ed-posts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; padding: .8rem; max-height: 260px; overflow-y: auto; }
.ed-posts > .ed-hint { grid-column: 1 / -1; }
.ed-post-thumb { position: relative; aspect-ratio: 1; overflow: hidden; cursor: pointer; background: var(--parchment); outline: 2px solid transparent; outline-offset: -2px; }
.ed-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-post-thumb.sel { outline-color: var(--gold); }
.ed-post-thumb.sel::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: .3rem; right: .3rem; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--white); font-size: .65rem; }
.ed-post-play { position: absolute; inset: 0; display: grid; place-items: center; color: var(--white); font-size: 1rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }

/* ---------- Bildirim ---------- */
.ed-toast {
  position: fixed; left: 50%; bottom: 2rem; z-index: 400; transform: translate(-50%, 20px);
  padding: .9rem 1.4rem; background: var(--text); color: var(--parchment);
  font: 500 .85rem/1.4 var(--font-body); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transition: opacity .3s, transform .3s var(--ease), visibility .3s;
}
.ed-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.ed-toast.error { background: #a3402e; color: var(--white); }

/* ---------- Mobil ---------- */
/* 960px altında sosyal ikonlar sol altta yatay sıra → anahtar onların üstüne */
@media (max-width: 960px) {
  .ed-switch { left: 1rem; bottom: calc(1rem + 54px); }
}
@media (max-width: 720px) {
  .ed-modal { padding: 0; place-items: end stretch; }
  .ed-box, .ed-box.wide { width: 100%; max-height: 92vh; }
  .ed-head, .ed-body, .ed-foot { padding-left: 1rem; padding-right: 1rem; }
  .ed-media-grid { grid-template-columns: 1fr; gap: 1.2rem; }
  .ed-preview { max-width: 200px; }
  .ed-posts { grid-template-columns: repeat(3, 1fr); }
  .ed-foot .ed-btn-primary, .ed-foot .ed-btn-ghost { flex: 1; }
  .ed-foot .ed-spacer { display: none; }
  .ed-switch { height: 40px; padding: 0 .9rem; }
  .ed-switch span { display: none; }
}
