/*
 * Şablon ayarları ekranı (097, madde 42): solda CRM ayarları, sağda
 * WhatsApp'taki görünümüne yakın önizleme. Dar ekranda alt alta.
 */

.tpl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .tpl-layout { grid-template-columns: minmax(0, 1fr); }
}

.tpl-group {
  margin: 1.5rem 0 .75rem;
  padding-bottom: .375rem;
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card__body > .tpl-group:first-child { margin-top: 0; }

.tpl-keys {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: .5rem;
}

.tpl-keys .chip {
  border: 0;
  cursor: pointer;
}

.tpl-keys .chip:hover { background: var(--brand-light); }

.tpl-side { min-width: 0; }

.tpl-preview {
  max-width: 320px;
  padding: .5rem .625rem;
  border-radius: var(--radius);
  background: var(--brand-light);
  font-size: .875rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tpl-preview__header { font-weight: 700; margin-bottom: .375rem; }

.tpl-preview__media {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  height: 96px;
  margin-bottom: .5rem;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: .8125rem;
}

.tpl-preview__media svg { width: 20px; height: 20px; }

.tpl-preview__footer {
  margin-top: .375rem;
  font-size: .75rem;
  color: var(--text-faint);
}

.tpl-preview__button {
  margin-top: .5rem;
  padding-top: .375rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-weight: 600;
  color: var(--brand);
}

.tpl-preview__var {
  padding: 0 .125rem;
  border-radius: 3px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8125rem;
}

/* Sohbetteki şablon paneli: alıcı satırı ve başlık dosyası uyarısı. */
.tpl-recipient {
  margin-bottom: .75rem;
  font-size: .8125rem;
}

/* --- hızlı mesaj paneli (098, madde 43) ------------------------------------
   Yazma satırının hemen üstünde açılan liste; lead'e uyanlar önce gelir. */
.quick-panel {
  margin: 0 0 .5rem;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.quick-panel__list {
  max-height: 240px;
  margin-top: .5rem;
  overflow-y: auto;
}

.quick-item {
  display: block;
  width: 100%;
  padding: .5rem .625rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.quick-item:hover,
.quick-item[aria-selected="true"] { background: var(--surface-3); }

.quick-item__title { display: flex; gap: .375rem; align-items: center; font-weight: 600; font-size: .875rem; }

.quick-item__text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: .8125rem;
  color: var(--text-muted);
}

.quick-panel__sep { margin: .375rem .625rem .25rem; font-size: .75rem; color: var(--text-muted); }

.quick-panel__hint { margin-top: .375rem; padding: 0 .25rem; }

.quick-attach {
  display: inline-flex;
  gap: .375rem;
  align-items: center;
  margin: 0 0 .5rem;
  padding: .25rem .25rem .25rem .625rem;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  font-size: .8125rem;
}

.quick-attach svg { width: 14px; height: 14px; }

/* --- toplu gönderim (madde 45) --------------------------------------------- */
.bulk-mode { display: flex; flex-wrap: wrap; gap: .75rem; }

.bulk-mode__opt {
  display: flex;
  flex: 1 1 14rem;
  gap: .5rem;
  align-items: flex-start;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.bulk-mode__opt:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }

.bulk-checks {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  max-height: 12rem;
  padding: .5rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
}

.bulk-people { max-height: 26rem; overflow-y: auto; }

.bulk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .75rem;
}

.bulk-stat {
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.bulk-stat__n { display: block; font-size: 1.375rem; font-weight: 700; }
.bulk-stat__l { font-size: .75rem; color: var(--text-muted); }
