/* ==========================================================================
   4 Ekim Part 3 — 👋 Karşılama sekmesi: Hoşgeldin + 📩 DM Karşılama
   --------------------------------------------------------------------------
   Ticket/çekiliş editörleriyle aynı ilke: form ve canlı önizleme iki sabit
   bölme (form ≥560px, önizleme ≥440px). Ayarlar paneli normalde ~680px
   olduğundan bu sekme açıkken kimlik paneli (Bot Kimliği + İstatistikler)
   panelin ALTINA iner ve panel genişler. Bölmelerin yan yana mı alt alta mı
   duracağına viewport değil editörün gerçek genişliği (container query)
   karar verir; sığmıyorsa önizleme ÜSTTE, form altında, ikisi de tam genişlik.
   ========================================================================== */

/* ---- Sekme açıkken düzen: nav | panel, kimlik paneli altta ---- */
@media (min-width: 1240px) {
  .settings-layout:has(.settings-section[data-panel="karsilama"]:not([hidden])) {
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-areas:
      "nav panels"
      "nav identity";
  }
  .settings-layout:has(.settings-section[data-panel="karsilama"]:not([hidden])) .identity-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .settings-layout:has(.settings-section[data-panel="karsilama"]:not([hidden])) .identity-sidebar .identity-card { flex: 1 1 340px; }
}

/* ---- İki bölme ---- */
.wc-editor { container: wced / inline-size; }
.wc-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "preview" "form";
  gap: 22px;
}
.wc-preview-pane { grid-area: preview; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.wc-form-pane { grid-area: form; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@container wced (min-width: 1020px) {
  .wc-split {
    grid-template-columns: minmax(560px, 1fr) minmax(440px, 520px);
    grid-template-areas: "form preview";
    align-items: start;
  }
  /* Uzun formda önizleme görünür kalsın. */
  .wc-preview-pane { position: sticky; top: 16px; }
}

.wc-pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wc-pane-head .tbc-optional { white-space: nowrap; }

/* ---- Form sekmeleri (👋 Kanal mesajları · 📩 DM karşılama) ---- */
.wc-form-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wc-ftab {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left;
  color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border);
  cursor: var(--c-link); transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.wc-ftab:hover { color: var(--text-primary); border-color: var(--border-strong); }
.wc-ftab:focus-visible, .wc-ptab:focus-visible, .wc-chip:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.wc-ftab.is-active { color: var(--text-primary); background: rgba(255, 193, 7, 0.1); border-color: rgba(255, 193, 7, 0.55); }
.wc-ftab-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-ftab-state {
  flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--text-tertiary); background: rgba(255, 255, 255, 0.06);
}
.wc-ftab-state.is-on { color: #6ee7b7; background: rgba(16, 185, 129, 0.14); }
.wc-ftab-state.is-warn { color: #fdba74; background: rgba(249, 115, 22, 0.14); }

.wc-pane { display: flex; flex-direction: column; gap: 16px; }
.wc-pane[hidden] { display: none; }
.wc-pane > .form-group, .wc-row-2 > .form-group { margin-bottom: 0; }

/* Yalnızca kısa alanlar 2 sütun (kanal + anahtar, iki anahtar); metin kutuları tam genişlik. */
.wc-row-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: stretch; }
@container wced (min-width: 600px) {
  .wc-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.wc-row-2 > .form-group { display: flex; flex-direction: column; justify-content: center; }
.wc-toggle-card { align-items: center; }
.wc-toggle-card > div:first-child { flex: 1 1 auto; min-width: 0; }
.wc-toggle-card .form-hint { margin-top: 4px; }
/* Dar anahtar kartlarında "Kaydedildi ✓ / Açılmadı…" notu anahtarı kartın dışına itmesin. */
.wc-editor .field-head { flex-wrap: wrap; row-gap: 2px; }
.wc-editor .field-status:not(.is-visible) { display: none; }
.wc-toggle-card .field-status { white-space: normal; }

.wc-editor .toggle input:disabled { cursor: var(--c-unavail); }
.wc-editor .toggle input:disabled ~ .toggle-track, .wc-editor .toggle input:disabled ~ .toggle-thumb { opacity: 0.45; }
.wc-toggle-card.is-locked { border-style: dashed; }
.wc-toggle-card.is-locked .form-hint { color: #fdba74; }

.wc-warn {
  margin: -4px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: #fdba74; background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.4);
}
.wc-warn[hidden] { display: none; }

/* n/500 sayaç */
.wc-editor .field-head .wc-counter { margin-left: auto; }
.wc-counter { font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-counter.is-near { color: #fdba74; }
.wc-counter.is-full { color: #fca5a5; }
.wc-editor .form-textarea { min-height: 92px; resize: vertical; }

/* Yer tutucu çipleri — tıklayınca imlecin olduğu yere eklenir */
.wc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wc-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 8px;
  font: inherit; font-size: 12.5px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border);
  cursor: var(--c-link); transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.wc-chip code { font-size: 12px; color: var(--text-primary); background: none; padding: 0; }
.wc-chip small { font-size: 11px; color: var(--text-tertiary); }
.wc-chip:hover { color: var(--text-primary); border-color: rgba(255, 193, 7, 0.5); background: rgba(255, 193, 7, 0.06); }

/* ---- Görsel / GIF ---- */
.wc-media { display: flex; flex-direction: column; gap: 12px; }
.wc-media[hidden] { display: none; }
.wc-media-lock {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(243, 201, 105, 0.06); border: 1px dashed rgba(243, 201, 105, 0.45);
}
.wc-media-lock[hidden] { display: none; }
.wc-media-lock-icon { font-size: 22px; flex-shrink: 0; }
.wc-media-lock p { margin: 0; font-size: 13.5px; color: var(--text-secondary); }
.wc-media-lock a { color: var(--gold); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.wc-link-row { display: flex; flex-direction: column; gap: 6px; }
.wc-link-row .form-label { font-size: 12.5px; color: var(--text-tertiary); }
.wc-link-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wc-link-input .btn[hidden] { display: none; }
.wc-link-row .form-hint { margin: 0; }
.wc-media .img-picker-thumb { object-fit: cover; }

/* ---- Önizleme ---- */
.wc-preview-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.wc-ptab {
  min-height: 34px; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-tertiary); background: var(--surface); border: 1px solid var(--border); cursor: var(--c-link);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.wc-ptab:hover { color: var(--text-primary); }
.wc-ptab.is-active { color: #1a1400; background: var(--blue-bright); border-color: var(--blue-bright); }

.wc-preview { min-height: 220px; overflow-x: auto; position: relative; }
.wc-preview.is-loading .wc-preview-body { opacity: 0.55; transition: opacity 0.2s; }
.wc-preview-chan {
  display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; padding-bottom: 10px;
  font-size: 13px; font-weight: 700; color: #f2f3f5; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.wc-preview-chan.is-empty { color: #949ba4; font-weight: 600; font-style: italic; }
.wc-preview-chan .wc-dm-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.wc-preview-body { min-width: 0; }
.wc-preview-body > * { max-width: 520px; }

.wc-embed .discord-embed-body { padding: 10px 14px 12px; }
.wc-embed-author { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #f2f3f5; }
.wc-embed-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #1e1f22; }
.wc-embed-head { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 14px; align-items: start; }
.wc-embed-head:not(:has(.wc-embed-thumb)) { grid-template-columns: minmax(0, 1fr); }
.wc-embed-thumb { width: 80px; height: 80px; border-radius: 6px; object-fit: cover; }
.wc-embed .discord-embed-desc { white-space: normal; }
.wc-embed .discord-embed-desc > div { min-height: 1.5em; }
.wc-embed .dc-blank { min-height: 0.75em; }
.wc-embed .dc-subtext { font-size: 11.5px; color: #949ba4; }
.wc-embed .dc-h { font-weight: 700; color: #f2f3f5; }
.wc-embed .dc-h1 { font-size: 20px; } .wc-embed .dc-h2 { font-size: 17px; } .wc-embed .dc-h3 { font-size: 15px; }
.wc-embed-image { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 6px; margin-top: 12px; background: rgba(0, 0, 0, 0.18); }
.wc-embed-image.is-card { max-height: none; }
.wc-embed-image.is-broken { min-height: 60px; }
.wc-embed .discord-embed-footer { display: flex; align-items: center; gap: 6px; }
.wc-embed .discord-embed-footer img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
/* Resimli kart örneği — botun arka planları üzerinde örnek üye */
.wc-tcard { position: relative; container: wctc / inline-size; margin-top: 12px; border-radius: 8px; overflow: hidden; aspect-ratio: 1100 / 368; background: #050607; }
.wc-tcard-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Özel arka plan: yazıların okunması için soldan koyu degrade (botun çizimiyle aynı fikir). */
.wc-tcard.is-custom::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(5, 6, 7, 0.8) 0%, rgba(5, 6, 7, 0.55) 45%, rgba(5, 6, 7, 0) 85%); }
.wc-tcard.is-custom .wc-tcard-content { z-index: 2; }
.wc-tcard-content { position: absolute; inset: 0; display: flex; align-items: center; gap: 5cqw; padding: 0 16cqw 0 8cqw; }
.wc-tcard-av {
  width: 21cqw; height: 21cqw; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: #1e1f22;
  display: grid; place-items: center; font: 800 9cqw 'Orbitron', sans-serif; color: #fff;
}
.wc-tcard.is-welcome .wc-tcard-av { box-shadow: 0 0 0 0.9cqw #0b0f0d, 0 0 0 1.6cqw #22c55e, 0 0 4cqw rgba(34, 197, 94, 0.45); }
.wc-tcard.is-leave .wc-tcard-av { box-shadow: 0 0 0 0.9cqw #0f0b0b, 0 0 0 1.6cqw #ef4444, 0 0 4cqw rgba(239, 68, 68, 0.45); }
.wc-tcard-text { display: flex; flex-direction: column; min-width: 0; gap: 0.6cqw; }
.wc-tcard-text small { font: 800 3.1cqw 'Orbitron', sans-serif; letter-spacing: 0.22em; }
.wc-tcard.is-welcome .wc-tcard-text small { color: #4ade80; }
.wc-tcard.is-leave .wc-tcard-text small { color: #f87171; }
.wc-tcard-text b { font-size: 7.4cqw; line-height: 1.1; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.wc-tcard-text span { font-size: 3.2cqw; color: #d4d7dc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-tcard-tag {
  position: absolute; left: 1.6cqw; bottom: 1.6cqw; padding: 0.4cqw 1.4cqw; border-radius: 999px;
  font-size: max(9px, 2.1cqw); color: #c7cbd1; background: rgba(0, 0, 0, 0.55);
}
.wc-local-note { margin-top: 8px; font-size: 11.5px; color: #949ba4; }
.wc-preview-error { margin: 0; font-size: 13px; color: #fca5a5; }

.wc-status {
  margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.45;
  color: #fdba74; background: rgba(249, 115, 22, 0.08); border: 1px solid rgba(249, 115, 22, 0.35);
}
.wc-status[hidden] { display: none; }
.wc-card-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.wc-card-row[hidden] { display: none; }

/* ---- Telefon ---- */
@media (max-width: 640px) {
  .wc-form-tabs { grid-template-columns: minmax(0, 1fr); }
  .wc-ftab { min-height: 44px; }
  .wc-pane-head { flex-direction: column; gap: 2px; }
  .wc-preview { padding: 12px; }
  .wc-embed-head { grid-template-columns: minmax(0, 1fr) 56px; gap: 10px; }
  .wc-embed-thumb { width: 56px; height: 56px; }
  .wc-link-input { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 🎨 Karşılama kartı arka planları (özel bot) ---- */
.wc-bg { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-sm); background: rgba(243, 201, 105, 0.05); border: 1px solid rgba(243, 201, 105, 0.3); }
.wc-bg[hidden] { display: none; }
.wc-bg > .form-hint { margin: 0; }
.wc-bg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.wc-bg-item { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wc-bg-item .form-hint { margin: 0; }
.wc-bg .img-picker-thumb { object-fit: cover; width: 96px; height: 32px; }
