/* =========================================================================
   Yönetim > E-posta Gönder + Kullanıcılar listesi (e-posta / silme / seçim)
   public/js/admin-mail.js. support.css'teki .sup token'ları ve bileşenleri kullanılır;
   koyu tema base.css değişkenleriyle otomatik. Gradyan yok.
   ========================================================================= */

/* ---------------- Kullanıcılar listesi ---------------- */
.admin-users-cb { width: 18px; height: 18px; accent-color: var(--brand, #2563eb); cursor: pointer; vertical-align: middle; }
.admin-users-cb:disabled { cursor: default; opacity: .5; }
.admin-users-table th.admin-users-check, .admin-users-table td.admin-users-check { width: 36px; }
.admin-users-email { overflow-wrap: anywhere; }
.admin-users-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.admin-users-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0); background: var(--background, #fff); color: var(--foreground, #0f172a);
  font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.admin-users-btn:hover:not(:disabled) { border-color: var(--brand, #2563eb); color: var(--brand, #2563eb); }
.admin-users-btn:focus-visible { outline: 2px solid var(--brand, #2563eb); outline-offset: 2px; }
.admin-users-btn:disabled { opacity: .45; cursor: not-allowed; }
.admin-users-btn.is-danger { color: #dc2626; border-color: rgba(220, 38, 38, .35); }
.admin-users-btn.is-danger:hover:not(:disabled) { background: rgba(220, 38, 38, .08); color: #dc2626; border-color: #dc2626; }
.admin-users-btn.is-primary { background: var(--brand, #2563eb); border-color: var(--brand, #2563eb); color: var(--brand-foreground, #fff); }
.admin-users-btn.is-primary:hover { filter: brightness(1.06); color: var(--brand-foreground, #fff); }
:root.dark .admin-users-btn.is-danger, .dark .admin-users-btn.is-danger { color: #f87171; }

.admin-users-bulk {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  border: 1px solid rgba(var(--brand-rgb, 37, 99, 235), .3); background: rgba(var(--brand-rgb, 37, 99, 235), .06);
  color: var(--foreground, #0f172a);
}
.admin-users-bulk[hidden] { display: none; }
.admin-users-bulk-btns { display: flex; flex-wrap: wrap; gap: 8px; }
#adminUsersNotice .sup-alert, #adminUsersNotice > div { font-size: 13px; }
#adminUsersNotice:empty { display: none; }
#adminUsersNotice .sup-alert { border-radius: 10px; padding: 10px 12px; border: 1px solid; }

/* Telefon: tablo kartlara dönüşür, hiçbir bilgi ve düğme kaybolmaz */
@media (max-width: 639.98px) {
  /* account.css dar ekranda tablolara 600px alt genişlik verir; kart görünümünde gerekmez */
  #profileViewSection .overflow-x-auto > table.admin-users-table, .admin-users-table { min-width: 0; }
  .admin-users-table thead { display: none; }
  .admin-users-table, .admin-users-table tbody, .admin-users-table tr, .admin-users-table td { display: block; width: 100%; }
  .admin-users-table tbody tr[data-user-id] { position: relative; padding: 10px 6px 10px 44px; }
  .admin-users-table tbody tr[data-user-id] td { padding: 3px 6px; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  .admin-users-table tbody tr[data-user-id] td::before { content: attr(data-label); font-weight: 700; color: var(--muted-foreground, #64748b); text-align: left; flex: none; }
  .admin-users-table td.admin-users-check { position: absolute; left: 8px; top: 12px; width: auto; padding: 0 !important; }
  .admin-users-table td.admin-users-check::before,
  .admin-users-table td.admin-users-who::before,
  .admin-users-table td.admin-users-actions::before { display: none; }
  .admin-users-table td.admin-users-who { display: block !important; text-align: left !important; padding-bottom: 6px !important; }
  .admin-users-table td.admin-users-actions { display: block !important; padding-top: 8px !important; }
  .admin-users-btns { justify-content: stretch; }
  .admin-users-btns > .admin-users-btn { flex: 1 1 0; min-height: 40px; }
  .admin-users-bulk-btns, .admin-users-bulk-btns > .admin-users-btn { width: 100%; }
  .admin-users-bulk-btns > .admin-users-btn { min-height: 40px; }
}

/* ---------------- Yazma formu ---------------- */
.sup .am-card { padding: 16px; margin-bottom: 14px; }
.sup .am-sub { margin: 2px 0 0; max-width: 72ch; }
.sup .am-gap-b { margin-bottom: 12px; }
.sup .am-gap { margin: 6px 0 0; }
.sup .am-form { display: grid; gap: 14px; min-width: 0; }
.sup .am-block { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.sup .am-block > legend { padding: 0; margin-bottom: 8px; }
.sup .am-count { font-weight: 400; color: var(--sup-muted); font-variant-numeric: tabular-nums; }
.sup .am-count.is-over { color: #dc2626; font-weight: 700; }
.sup .am-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px;
  max-height: 168px; overflow-y: auto; padding: 8px; border: 1px dashed var(--sup-border); border-radius: 10px;
}
.sup .am-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0;
  padding: 4px 4px 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--sup-bg); border: 1px solid var(--sup-border);
}
.sup .am-chip.is-member { background: var(--sup-soft); border-color: rgba(var(--sup-brand-rgb), .3); }
.sup .am-chip > i { color: var(--sup-muted); font-size: 11px; flex: none; }
.sup .am-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup .am-chip-text span { color: var(--sup-muted); margin-left: 4px; }
.sup .am-chip-x {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 0; background: transparent;
  color: var(--sup-muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.sup .am-chip-x:hover { background: rgba(220, 38, 38, .1); color: #dc2626; }
.sup .am-clear { font-size: 12px; margin-left: 4px; }
.sup .am-pick { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .sup .am-pick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.sup .am-search { position: relative; }
.sup .am-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px;
  max-height: 300px; overflow-y: auto; border: 1px solid var(--sup-border); border-radius: 10px;
  background: var(--sup-card); box-shadow: 0 12px 28px rgba(2, 6, 23, .18);
}
.sup .am-res {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; align-items: center; width: 100%;
  padding: 9px 12px; border: 0; border-bottom: 1px solid var(--sup-border); background: none;
  font: inherit; font-size: 13px; color: var(--sup-fg); text-align: left; cursor: pointer;
}
.sup .am-res:last-child { border-bottom: 0; }
.sup .am-res:hover, .sup .am-res:focus-visible { background: var(--sup-soft); outline: none; }
.sup .am-res b { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup .am-res span:not(.sup-badge) { grid-column: 1; color: var(--sup-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup .am-res i { grid-column: 2; grid-row: 1 / span 2; color: #059669; }
.sup .am-res[aria-selected="true"] { background: rgba(16, 185, 129, .06); }
.sup .am-res-all { display: block; font-weight: 700; color: var(--sup-brand); }
.sup .am-res-empty { padding: 12px; font-size: 13px; color: var(--sup-muted); }
.sup .am-inline { display: flex; gap: 8px; min-width: 0; }
.sup .am-inline .sup-input { flex: 1 1 auto; }
.sup .am-inline .sup-btn { flex: none; }
.sup .am-message { min-height: 220px; }
.sup .am-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.sup .am-cta { border: 1px solid var(--sup-border); border-radius: 10px; padding: 10px 12px; }
.sup .am-cta > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.sup .am-cta[open] > summary { margin-bottom: 10px; }
.sup .am-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sup .am-actions-end { justify-content: flex-end; }
.sup .am-btn-confirm { background: #059669; border-color: #059669; }
.sup .am-btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.sup .am-btn-danger:disabled { opacity: .45; }
@media (max-width: 639.98px) {
  .sup .am-actions > .sup-btn { flex: 1 1 100%; }
  .sup .am-actions-end > .sup-btn { flex: 1 1 0; }
}

/* Sonuç listesi */
.sup .am-result:empty { display: none; }
.sup .am-result { display: grid; gap: 8px; }
.sup .am-res-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.sup .am-res-list li {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px;
  padding: 8px 10px; border: 1px solid var(--sup-border); border-radius: 10px; background: var(--sup-bg); font-size: 12px;
}
.sup .am-res-who { min-width: 0; display: grid; }
.sup .am-res-who b, .sup .am-res-who span { overflow-wrap: anywhere; }
.sup .am-res-who span { color: var(--sup-muted); }
.sup .am-res-err { flex-basis: 100%; color: #b91c1c; font-size: 11px; overflow-wrap: anywhere; }
.sup .am-badge-fail { color: #b91c1c; background: rgba(220, 38, 38, .1); border-color: rgba(220, 38, 38, .35); }
:root.dark .sup .am-badge-fail, .dark .sup .am-badge-fail, :root.dark .sup .am-res-err, .dark .sup .am-res-err { color: #fca5a5; }

/* Önizleme */
.sup .am-preview { border: 1px solid var(--sup-border); border-radius: 12px; overflow: hidden; background: #0b0f19; }
.sup .am-preview[hidden] { display: none; }
.sup .am-preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  background: var(--sup-card); border-bottom: 1px solid var(--sup-border);
}
.sup .am-preview-head > div { min-width: 0; display: grid; }
.sup .am-preview-head b { font-size: 13px; overflow-wrap: anywhere; }
.sup .am-frame { display: block; width: 100%; height: 640px; border: 0; background: #0b0f19; }
@media (max-width: 639.98px) { .sup .am-frame { height: 520px; } }

/* Gönderim geçmişi */
.sup .am-history .sup-table tbody tr[data-am-h]:focus-visible { outline: 2px solid var(--sup-brand); outline-offset: -2px; }
.sup .am-history .am-hist-detail-row { cursor: default; }
.sup .am-history .am-hist-detail-row > td { background: var(--sup-soft) !important; }
.sup .am-hist-detail { display: grid; gap: 12px; padding: 4px 0; text-align: left; }
.sup .am-hist-msg { display: grid; gap: 4px; }
.sup .am-hist-msg .sup-msg-text { border: 1px solid var(--sup-border); border-radius: 10px; background: var(--sup-bg); padding: 10px 12px; max-height: 260px; overflow-y: auto; }
.sup .am-nowrap { white-space: nowrap; }
.sup .am-break { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .sup .am-history .am-hist-detail-row > td { display: block !important; text-align: left; }
  .sup .am-history .am-hist-detail-row > td::before { display: none; }
}

/* ---------------- Pencereler ---------------- */
html.am-lock, html.am-lock body { overflow: hidden; }
.am-dialog {
  width: min(760px, calc(100vw - 24px)); max-height: min(92vh, 960px); padding: 0;
  border: 1px solid var(--border, #e2e8f0); border-radius: 14px;
  background: var(--card, #fff); color: var(--foreground, #0f172a);
  overflow: hidden; display: none; flex-direction: column;
}
.am-dialog[open] { display: flex; }
.am-dialog.am-dialog-del { width: min(520px, calc(100vw - 24px)); }
.am-dialog::backdrop { background: rgba(2, 6, 23, .6); }
.am-dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex: none;
  padding: 12px 16px; border-bottom: 1px solid var(--border, #e2e8f0); background: var(--card, #fff);
}
.am-dialog-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.am-x {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0);
  background: transparent; color: var(--foreground, #0f172a); font-size: 22px; line-height: 1; cursor: pointer;
}
.am-x:hover { border-color: var(--brand, #2563eb); color: var(--brand, #2563eb); }
.am-dialog-body { min-height: 0; flex: 1 1 auto; padding: 14px 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.am-del-who { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--sup-border); background: var(--sup-soft); overflow-wrap: anywhere; }
.am-del-who span { color: var(--sup-muted); font-size: 13px; }
.sup .am-del-reason { min-height: 84px; }
/* Telefon: pencere tam ekran */
@media (max-width: 639.98px) {
  .am-dialog, .am-dialog.am-dialog-del {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0;
  }
  .am-dialog-body { padding: 12px 14px calc(18px + env(safe-area-inset-bottom)); flex: 1 1 auto; }
}
