/* admin-styles.css — Admin paneline özel stiller.
   Mevcut site stillerine müdahale etmemek için tüm sınıflar 'adm-' önekli.
   z-index 2147483645: tweaks paneli (2147483646) altında, body üstünde. */

.adm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483645;
  background: rgba(16, 13, 8, 0.55);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  display: grid;
  place-items: center;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  animation: admFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes admFadeIn { from { opacity: 0; } to { opacity: 1; } }

.adm-shell {
  width: min(1180px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  background: #FBFAF6;
  color: #100D08;
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.06);
  animation: admIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes admIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.adm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #ECE5D6;
  background: #FFFFFF;
}
.adm-title {
  font-family: "Instrument Serif", serif;
  font-size: 22px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.adm-title .adm-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4F7A3F;
  box-shadow: 0 0 0 4px rgba(79, 122, 63, 0.18);
}
.adm-title small {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #857A6B;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 6px;
}
.adm-close {
  appearance: none;
  border: 1px solid #E2DAC7;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: #4A4137;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.adm-close:hover { background: #F4EFE6; border-color: #C9BFA7; }
.adm-close-x { font-size: 16px; line-height: 1; margin-right: 6px; }

.adm-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

.adm-tabs {
  border-right: 1px solid #ECE5D6;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #FFFFFF;
  overflow-y: auto;
}
.adm-tab {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4A4137;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.12s;
}
.adm-tab:hover { background: #F4EFE6; }
.adm-tab[data-active="1"] {
  background: #100D08;
  color: #FBFAF6;
}
.adm-tab small {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: #857A6B;
  background: #F4EFE6;
  padding: 2px 7px;
  border-radius: 999px;
}
.adm-tab[data-active="1"] small { color: #FBFAF6; background: rgba(255,255,255,0.12); }

.adm-tabs-divider {
  height: 1px;
  background: #ECE5D6;
  margin: 8px 4px;
}
.adm-tabs-section {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #857A6B;
  padding: 12px 12px 4px;
}

.adm-main {
  padding: 24px 30px 28px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.adm-section-title {
  font-family: "Instrument Serif", serif;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.adm-section-lede {
  font-size: 14px;
  color: #4A4137;
  max-width: 70ch;
  line-height: 1.55;
  margin: 0 0 14px;
}

.adm-card {
  background: #FFFFFF;
  border: 1px solid #ECE5D6;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.adm-card-h {
  font-family: "Instrument Serif", serif;
  font-size: 19px;
  letter-spacing: -0.005em;
}

.adm-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-row label,
.adm-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: #857A6B;
  text-transform: uppercase;
}
.adm-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.adm-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 720px) {
  .adm-grid-2, .adm-grid-3 { grid-template-columns: 1fr; }
}

.adm-input,
.adm-textarea,
.adm-select {
  appearance: none;
  width: 100%;
  background: #FBFAF6;
  border: 1px solid #E2DAC7;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: #100D08;
  transition: border-color 0.12s, background 0.12s;
}
.adm-input:focus,
.adm-textarea:focus,
.adm-select:focus {
  outline: none;
  border-color: #5C3A22;
  background: #FFFFFF;
}
.adm-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.45;
}

.adm-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #100D08;
  color: #FBFAF6;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s, background 0.12s;
}
.adm-btn:hover { transform: translateY(-1px); opacity: 0.94; }
.adm-btn:active { transform: none; }
.adm-btn[data-variant="ghost"] {
  background: #FFFFFF;
  color: #4A4137;
  border-color: #E2DAC7;
}
.adm-btn[data-variant="ghost"]:hover { background: #F4EFE6; }
.adm-btn[data-variant="danger"] {
  background: #FFFFFF;
  color: #B53A2C;
  border-color: #E5B8B0;
}
.adm-btn[data-variant="danger"]:hover { background: #FBEEEC; }
.adm-btn[data-variant="primary-accent"] {
  background: #5C3A22;
}

.adm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adm-list-item {
  background: #FFFFFF;
  border: 1px solid #ECE5D6;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adm-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.adm-list-h {
  font-family: "Instrument Serif", serif;
  font-size: 18px;
  letter-spacing: -0.005em;
}
.adm-list-meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #857A6B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.adm-list-actions {
  display: flex;
  gap: 6px;
}

.adm-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid #ECE5D6;
  background: #FFFFFF;
  flex-wrap: wrap;
}
.adm-foot-left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #4A4137;
}
.adm-foot-left b { font-weight: 600; color: #100D08; }
.adm-foot-right { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-status {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #4F7A3F;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.adm-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4F7A3F;
  box-shadow: 0 0 0 3px rgba(79, 122, 63, 0.2);
}
.adm-status[data-dirty="1"] { color: #B5654A; }
.adm-status[data-dirty="1"]::before { background: #B5654A; box-shadow: 0 0 0 3px rgba(181, 101, 74, 0.2); }

/* Şifre kapısı */
.adm-gate {
  background: #FBFAF6;
  border-radius: 16px;
  padding: 36px 40px 32px;
  width: min(440px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  text-align: center;
}
.adm-gate h2 {
  font-family: "Instrument Serif", serif;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.01em;
}
.adm-gate p { color: #4A4137; font-size: 14.5px; line-height: 1.5; margin: 0; }
.adm-gate-warn {
  font-size: 12px;
  color: #857A6B;
  background: #F4EFE6;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.5;
}
.adm-gate-err { color: #B53A2C; font-size: 13px; }

/* Görsel dropzone */
.adm-dropzone {
  border: 1.5px dashed #D2C7AE;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: #FFFFFF;
  font-size: 13px;
  color: #4A4137;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}
.adm-dropzone:hover { background: #FBFAF6; border-color: #5C3A22; }
.adm-dropzone small { font-size: 11px; color: #857A6B; }
.adm-dropzone input { display: none; }

.adm-thumb {
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: 10px;
  background: #F4EFE6 center / cover no-repeat;
  border: 1px solid #ECE5D6;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #857A6B;
  text-align: center;
  padding: 12px;
}
.adm-thumb[data-has="1"] {
  background-size: cover;
  color: transparent;
}

.adm-thumb-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: start;
}
.adm-thumb-row .adm-thumb { aspect-ratio: 1; }

.adm-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.adm-img-tile {
  background: #FFFFFF;
  border: 1px solid #ECE5D6;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-img-tile .adm-thumb { aspect-ratio: 4/3; }
.adm-img-tile-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.adm-mini-btn {
  appearance: none;
  border: 1px solid #E2DAC7;
  background: #FFFFFF;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #4A4137;
  cursor: pointer;
  transition: background 0.12s;
}
.adm-mini-btn:hover { background: #F4EFE6; }
.adm-mini-btn[data-danger="1"] { color: #B53A2C; border-color: #E5B8B0; }
.adm-mini-btn[data-danger="1"]:hover { background: #FBEEEC; }

.adm-help {
  margin-top: 18px;
  background: #F4EFE6;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: #4A4137;
  line-height: 1.55;
}
.adm-help b { color: #100D08; }
.adm-help ul { margin: 6px 0 0; padding-left: 20px; }
.adm-help li { margin: 4px 0; }

.adm-kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  background: #FFFFFF;
  border: 1px solid #E2DAC7;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  color: #4A4137;
}

/* Diskret panel açma butonu — sol altta, Yusuf'un kolay bulması için */
.adm-launcher {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 60;
  appearance: none;
  background: #100D08;
  color: #FBFAF6;
  border-radius: 999px;
  border: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s, opacity 0.15s;
}
.adm-launcher:hover { transform: translateY(-2px); }
.adm-launcher .adm-launcher-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4F7A3F;
  box-shadow: 0 0 0 3px rgba(79, 122, 63, 0.3);
}
@media (max-width: 720px) {
  .adm-launcher { padding: 8px 14px; font-size: 12px; }
}

/* Dark mode için panel rengi otomatik dönmesin — admin paneli her zaman
   açık tema. Yusuf'un göz yorgunluğunu düşür. */

/* ─── Mobile responsive (Yusuf telefondan düzenleyebilsin) ───────────────
   Yusuf bey saha danışmanı, masaüstüne erişimi az. Admin paneli
   telefon ekranında akıcı çalışmalı: tek-eli kullanım, 44px+ touch target,
   iOS klavye açılınca taşmasın (dvh), tab nav yatay scroll, form full-width. */
@media (max-width: 720px) {

  /* Overlay: padding'siz tam ekran */
  .adm-overlay {
    padding: 0;
    align-items: stretch;
    justify-items: stretch;
  }

  /* Shell: tam ekran, border-radius yok, dvh ile iOS klavye dostu */
  .adm-shell {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }

  /* Header: kompakt */
  .adm-head {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .adm-title { font-size: 18px; gap: 8px; }
  .adm-title small { display: none; }
  .adm-close {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Body: tek kolon — sol nav üstte yatay scroll bar */
  .adm-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  /* Tabs: dikey nav yerine yatay scroll çubuğu */
  .adm-tabs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid #ECE5D6;
    padding: 8px 12px 6px;
    gap: 4px;
    background: #FFFFFF;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Sağda fade — yatay scroll'un olduğu hissi */
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .adm-tabs::-webkit-scrollbar { display: none; }
  .adm-tabs-section, .adm-tabs-divider { display: none; }
  .adm-tab {
    flex: 0 0 auto;
    padding: 9px 14px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 38px;
  }
  .adm-tab small {
    padding: 1px 6px;
    font-size: 10px;
  }

  /* Main: padding sıkıştır, alt boşluk foot için */
  .adm-main {
    padding: 18px 16px 100px;
    gap: 16px;
  }
  .adm-section-title { font-size: 22px; }
  .adm-section-lede { font-size: 13.5px; line-height: 1.5; }

  /* Card: padding küçük */
  .adm-card {
    padding: 14px 16px;
    gap: 12px;
  }
  .adm-card-h { font-size: 17px; }

  /* Form inputs: touch-friendly + iOS 16px (zoom önleme) */
  .adm-input,
  .adm-textarea,
  .adm-select {
    font-size: 16px;        /* iOS Safari focus'ta zoom yapmaz */
    padding: 11px 12px;
    min-height: 44px;
    border-radius: 9px;
  }
  .adm-textarea {
    min-height: 88px;
    line-height: 1.5;
  }
  .adm-label { font-size: 11px; }

  /* Buttons: touch target */
  .adm-btn {
    min-height: 44px;
    padding: 11px 18px;
    font-size: 14px;
    border-radius: 9px;
  }
  .adm-mini-btn {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 8px;
  }

  /* List item: ferah */
  .adm-list-item {
    padding: 14px 14px 12px;
    gap: 10px;
  }
  .adm-list-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .adm-list-row .adm-btn,
  .adm-list-row .adm-mini-btn { align-self: flex-end; }
  .adm-list-h { font-size: 16px; }

  /* Image grid: sıkışık değil ama küçük tile */
  .adm-img-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .adm-thumb-row {
    grid-template-columns: 96px 1fr;
    gap: 12px;
  }
  .adm-thumb {
    padding: 8px;
    font-size: 11px;
  }
  .adm-dropzone {
    padding: 16px 14px;
    font-size: 13px;
  }
  .adm-dropzone small { font-size: 11px; }

  /* Foot: dikey stack, butonlar tam genişlik, safe-area altta */
  .adm-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    border-top: 1px solid #ECE5D6;
  }
  .adm-foot-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    font-size: 12.5px;
  }
  .adm-foot-left > span:last-child {
    font-size: 11.5px;
    line-height: 1.45;
  }
  .adm-foot-right {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
    width: 100%;
  }
  .adm-foot-right .adm-btn {
    justify-content: center;
    width: 100%;
  }

  /* Şifre kapısı: tam ekran */
  .adm-gate {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    padding: 36px 24px;
    justify-content: center;
    box-shadow: none;
  }
  .adm-gate h2 { font-size: 26px; }
  .adm-gate p { font-size: 14px; }
  .adm-gate-warn { font-size: 11.5px; }

  /* Help kart küçük */
  .adm-help { font-size: 12.5px; padding: 12px 14px; }

  /* Color picker mobile'da daha büyük tap area */
  input[type="color"].adm-input {
    height: 44px !important;
    padding: 4px !important;
  }

  /* 2 ve 3 kolonlu grid'leri zaten tek kolona indiriyorduk; doğrulama */
  .adm-grid-2, .adm-grid-3 { grid-template-columns: 1fr; gap: 10px; }

  /* Launcher: dokunmaya rahat, iPhone home bar üstünde */
  .adm-launcher {
    padding: 12px 18px;
    font-size: 14px;
    min-height: 44px;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  }
}

/* Ekstra dar (iPhone SE vb. 360px ve altı) */
@media (max-width: 380px) {
  .adm-foot-right { grid-template-columns: 1fr; }
  .adm-section-title { font-size: 20px; }
  .adm-head { padding: 10px 12px; }
  .adm-main { padding: 14px 12px 100px; }
}

/* Mobile'da yüzen Tweaks paneli gizle — admin paneli zaten her şeyi yapıyor,
   iki yüzen elemanın aynı anda görünmesi mobile'da karmaşıklık yaratır. */
@media (max-width: 720px) {
  .twk-panel { display: none !important; }
}
