/* ═══════════════════════════════════════════════════════════════════════════
   ALERT CENTER v2  —  from scratch
   ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper */
.ac2 {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: transparent;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.ac2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--divider);
}
.ac2-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
}
.ac2-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* Settings Button */
.ac2-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--ease-fast);
}
.ac2-settings-btn:hover {
  color: var(--text-primary);
  background: var(--bg-highlight);
}
.ac2-settings-btn.active {
  color: var(--cta-light);
  background: var(--cta-dim);
}

/* Status pill */
.ac2-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-highlight);
  border: 1px solid var(--divider);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  transition: all 0.3s ease;
}
.ac2-status-pill.live {
  background: var(--cta-dim);
  border-color: rgba(16,185,129,0.25);
  color: var(--cta);
}
.ac2-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}
.ac2-status-pill.live .ac2-status-dot {
  background: var(--cta);
  animation: dot-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 5px rgba(16,185,129,0.6);
}

/* ─── Connection Card ─────────────────────────────────────────────────────── */
.ac2-card {
  margin: 12px 12px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--divider);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  display: block; /* Visible by default */
}
.ac2-card:not(.is-connected) {
  border-color: rgba(41,182,246,0.2);
  box-shadow: 0 0 20px rgba(41,182,246,0.06);
  animation: ac2-card-pulse 4s ease-in-out infinite;
}
@keyframes ac2-card-pulse {
  0%,100% { box-shadow: 0 0 16px rgba(41,182,246,0.04); }
  50%      { box-shadow: 0 0 32px rgba(41,182,246,0.12); }
}
.ac2-card.is-connected {
  border-color: rgba(16,185,129,0.3);
  box-shadow: 0 0 24px rgba(16,185,129,0.08);
}

/* Disconnected layout */
.ac2-disconnected {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ac2-connected {
  display: none;
  padding: 22px 14px;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.ac2-card.is-connected .ac2-disconnected { display: none; }
.ac2-card.is-connected .ac2-connected    { display: flex; }

/* Brand row */
.ac2-tg-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ac2-tg-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(41,182,246,0.12);
  color: #29B6F6;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(41,182,246,0.2);
}
.ac2-card-headline {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.ac2-card-sub {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Steps */
.ac2-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  position: relative;
}
.ac2-step:not(.ac2-step--last)::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 22px;
  bottom: -10px;
  width: 1px;
  background: var(--divider);
}
.ac2-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-highlight);
  border: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: var(--font-mono);
  z-index: 1;
  position: relative;
}
.ac2-step-num--done {
  background: var(--cta-dim);
  border-color: rgba(16,185,129,0.25);
  color: var(--cta);
}
.ac2-step-body {
  flex: 1;
  padding-top: 2px;
}
.ac2-step-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.ac2-step-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Code row */
.ac2-code-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-deep);
  border: 1px solid var(--divider);
  border-radius: 8px;
  overflow: hidden;
}
.ac2-code {
  flex: 1;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.08em;
}
.ac2-copy-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  border-left: 1px solid var(--divider);
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.ac2-copy-btn:hover { background: var(--bg-highlight); color: var(--text-primary); }
.ac2-copy-btn.copied { color: var(--cta); }

/* Connect button */
.ac2-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px 10px;
  background: #29B6F6;
  border-top: 1px solid rgba(255,255,255,0.4);
  border-left: 1px solid rgba(255,255,255,0.2);
  border-right: 1px solid rgba(0,0,0,0.2);
  border-bottom: 3px solid #1084b6;
  border-radius: 8px;
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(41,182,246,0.3);
  width: 100%;
  justify-content: center;
}
.ac2-connect-btn:hover {
  background: #1EA8E0;
  box-shadow: 0 6px 20px rgba(41,182,246,0.45);
  transform: translateY(-1px);
  border-bottom-width: 4px;
}
.ac2-connect-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

/* Connected state */
.ac2-connected-icon {
  color: var(--cta);
  margin-bottom: 4px;
}
.ac2-connected-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ac2-connected-handle {
  font-size: 0.7rem;
  font-weight: 600;
  color: #29B6F6;
  font-family: var(--font-mono);
}
.ac2-connected-meta {
  font-size: 0.6rem;
  color: var(--cta);
  margin-top: 2px;
}

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.ac2-divider {
  height: 1px;
  background: var(--divider);
  margin: 14px 0 0;
  display: none; /* Hidden by default */
}
.ac2-divider.settings-open {
  display: block !important;
}

/* ─── Signal Channels ─────────────────────────────────────────────────────── */
.ac2-channels {
  padding: 12px 14px;
  display: none; /* Hidden by default */
  flex-direction: column;
  gap: 10px;
}
.ac2-channels.settings-open {
  display: flex !important;
}
.ac2-channels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ac2-channels-title {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ac2-rt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--cta);
  background: var(--cta-dim);
  border: 1px solid rgba(16,185,129,0.2);
  padding: 2px 7px;
  border-radius: 99px;
}
.ac2-rt-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cta);
  animation: dot-pulse 2s ease-in-out infinite;
}

/* Channel rows */
.ac2-channel-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ac2-channel-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.ac2-channel-row:hover { background: var(--bg-highlight); }

.ac2-ch-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ac2-ch-icon--amber  { background: var(--cta-dim);  color: var(--cta); }
.ac2-ch-icon--blue   { background: var(--cta-dim);       color: var(--cta-light); }
.ac2-ch-icon--green  { background: var(--cta-dim);   color: var(--cta); }
.ac2-ch-icon--cta    { background: var(--cta-dim);       color: var(--cta-light); }

.ac2-ch-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ac2-ch-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}
.ac2-ch-meta {
  font-size: 0.58rem;
  color: var(--text-muted);
}

/* Custom toggle */
.ac2-ch-toggle {
  flex-shrink: 0;
  position: relative;
}
.ac2-ch-toggle input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.ac2-toggle-track {
  display: flex;
  align-items: center;
  width: 34px; height: 18px;
  background: var(--bg-highlight);
  border: 1px solid var(--divider);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.ac2-ch-toggle input:checked + .ac2-toggle-track {
  background: var(--cta);
  border-color: var(--cta);
}
.ac2-toggle-thumb {
  position: absolute;
  left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.ac2-ch-toggle input:checked + .ac2-toggle-track .ac2-toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}

/* Save button */
.ac2-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 10px;
  width: 100%;
  background: var(--bg-elevated);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-left: 1px solid rgba(255,255,255,0.05);
  border-right: 1px solid rgba(0,0,0,0.15);
  border-bottom: 3px solid var(--divider);
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ac2-save-btn:hover {
  background: var(--bg-highlight);
  border-color: var(--cta);
  color: var(--cta-light);
  border-bottom-width: 4px;
  transform: translateY(-1px);
}
.ac2-save-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}
.ac2-save-btn.saved {
  background: var(--cta-dim);
  border-color: rgba(16,185,129,0.3);
  color: var(--cta);
}

/* ─── Light Theme Overrides ───────────────────────────────────────────────── */
[data-theme="light"] .ac2-card        { background: #fff; }
[data-theme="light"] .ac2-code-row    { background: #F5F7FF; }
[data-theme="light"] .ac2-tg-icon     { background: rgba(41,182,246,0.08); }
[data-theme="light"] .ac2-toggle-track { background: #E2E8F0; border-color: #CBD5E1; }
[data-theme="light"] .ac2-channel-row:hover { background: #F1F5FB; }
[data-theme="light"] .ac2-save-btn    { background: #F5F7FF; }
[data-theme="light"] .ac2-status-pill { background: #F1F5FB; border-color: #D1DCF0; }
[data-theme="light"] .ac2-step-num    { background: #EEF2FB; border-color: #D0DCF0; }
