/* =========================================================
   Telegram Manager — استایل اختصاصی
   ========================================================= */

/* Tabs */
.tm-tabs {
  display: flex;
  gap: 4px;
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
  border: 1px solid var(--border-soft, rgba(42, 46, 66, 0.4));
}

.tm-tab {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim, #8b90a8);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tm-tab:hover {
  color: var(--text, #e8eaf2);
  background: rgba(124, 92, 255, 0.08);
}

.tm-tab.active {
  background: var(--accent, #7c5cff);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.3);
}

/* Account bar */
.tm-account-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card, rgba(28, 31, 46, 0.65));
  border: 1px solid var(--border, rgba(42, 46, 66, 0.8));
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tm-account-bar label {
  font-size: 12px;
  color: var(--text-dim, #8b90a8);
  margin: 0;
}

.tm-account-select {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  font-size: 13px;
}

.tm-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
  transition: background 0.3s;
}

.tm-status-dot.connected {
  background: var(--success, #22c55e);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Job log */
.tm-log {
  background: #050608;
  color: #a5f3a5;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: 10px;
  height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  direction: ltr;
  text-align: left;
  border: 1px solid var(--border, rgba(42, 46, 66, 0.8));
  line-height: 1.7;
}

body.light .tm-log {
  background: #0f1219;
  color: #7dd87d;
}

/* Members list */
.tm-results-list {
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
  border: 1px solid var(--border, rgba(42, 46, 66, 0.8));
  border-radius: 10px;
  max-height: 380px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.9;
  margin-top: 12px;
}

.tm-member-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-soft, rgba(42, 46, 66, 0.4));
  align-items: center;
}

.tm-member-row:last-child { border-bottom: none; }
.tm-member-row:hover { background: var(--card-hover, rgba(35, 39, 56, 0.9)); }

.tm-member-row .idx {
  color: var(--text-mute, #5a6078);
  text-align: left;
  direction: ltr;
}

.tm-member-row .uname {
  color: var(--accent, #7c5cff);
  direction: ltr;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-member-row .uname.empty {
  color: var(--text-mute, #5a6078);
  font-style: italic;
  direction: rtl;
  text-align: right;
}

.tm-member-row .name {
  color: var(--text, #e8eaf2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  max-width: 220px;
}

/* Stats */
.tm-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tm-stat {
  flex: 1;
  min-width: 100px;
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
  padding: 14px 12px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border-soft, rgba(42, 46, 66, 0.4));
}

.tm-stat .label {
  font-size: 11px;
  color: var(--text-dim, #8b90a8);
  margin-bottom: 6px;
  font-weight: 500;
}

.tm-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text, #e8eaf2);
  font-variant-numeric: tabular-nums;
}

.tm-stat.success .value { color: var(--success, #22c55e); }
.tm-stat.danger .value { color: var(--danger, #ef4444); }

/* Progress */
.tm-progress {
  height: 8px;
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--border-soft, rgba(42, 46, 66, 0.4));
}

.tm-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #7c5cff), var(--accent-hover, #9b7fff));
  width: 0%;
  transition: width 0.3s ease;
}

/* Checker result rows */
.tm-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(42, 46, 66, 0.8));
  margin-bottom: 8px;
  font-size: 13px;
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
}

.tm-result-row.ok {
  border-color: var(--success, #22c55e);
  background: rgba(34, 197, 94, 0.1);
}

.tm-result-row.fail {
  border-color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.1);
}

.tm-result-row .info { flex: 1; min-width: 0; }
.tm-result-row .title {
  font-weight: 600;
  color: var(--text, #e8eaf2);
  font-size: 13px;
}
.tm-result-row .sub {
  color: var(--text-dim, #8b90a8);
  font-size: 11px;
  margin-top: 3px;
}

/* Auto sender target row */
.tm-target-row {
  background: var(--input-bg, rgba(35, 39, 56, 0.6));
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(42, 46, 66, 0.8));
  position: relative;
  margin-bottom: 10px;
}

.tm-target-row .tm-target-remove {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 4px 8px;
  font-size: 11px;
}

/* Empty state */
.tm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute, #5a6078);
  font-size: 13px;
}

.tm-empty .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 720px) {
  .tm-tab { padding: 8px 12px; font-size: 12px; }
  .tm-account-bar { flex-direction: column; align-items: stretch; }
  .tm-member-row { grid-template-columns: 40px 1fr; }
  .tm-member-row .name { display: none; }
  .tm-stat .value { font-size: 20px; }
}