/* ═══════════════════════════════════════════════════════════════════
   3Click RMM — Components  |  Brand: Deep Violet + Ember Gold
═══════════════════════════════════════════════════════════════════ */

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
  transition: all 0.15s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn svg { width: 13px; height: 13px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-color: var(--brand-dark);
  box-shadow: 0 2px 12px rgba(124,58,237,0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #8b5cf6, var(--brand)); box-shadow: var(--shadow-brand); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0b0d1a;
  border-color: var(--gold-dark);
  box-shadow: 0 2px 12px rgba(245,158,11,0.3);
}
.btn-gold:hover { box-shadow: var(--shadow-gold); }

.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-2); }

.btn-danger {
  background: rgba(239,68,68,0.14);
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.24); }

.btn-success {
  background: rgba(16,185,129,0.14);
  color: var(--emerald);
  border-color: rgba(16,185,129,0.3);
}
.btn-success:hover { background: rgba(16,185,129,0.24); }

.btn-warning {
  background: rgba(245,158,11,0.14);
  color: var(--gold);
  border-color: rgba(245,158,11,0.3);
}
.btn-warning:hover { background: rgba(245,158,11,0.24); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 24px; font-size: 13px; }
.btn-icon { padding: 6px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-sm { padding: 14px; }
.card-flush { padding: 0; overflow: hidden; }

.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.card-title svg { width: 14px; height: 14px; color: var(--brand-light); }

/* ── Stat cards ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-accent, var(--brand));
}
.stat-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }

.stat-card .stat-icon {
  width: 36px; height: 36px;
  background: var(--brand-glow-sm);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-light);
}
.stat-card .stat-icon svg { width: 17px; height: 17px; }
.stat-card .stat-value { font-size: 30px; font-weight: 900; color: var(--text); line-height: 1; }
.stat-card .stat-label { font-size: 10.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.6px; }

/* ── Table ──────────────────────────────────────────────────────── */
.rmm-table-wrap { overflow-x: auto; }
.rmm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rmm-table th {
  background: var(--bg-card2);
  color: var(--text-2);
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.rmm-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(31,29,74,0.5);
  color: var(--text);
  vertical-align: middle;
}
.rmm-table tr:hover td { background: var(--bg-hover); cursor: pointer; }
.rmm-table tr:last-child td { border-bottom: none; }

/* ── Status badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.4px;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
}
.badge-online    { background: rgba(16,185,129,0.15);  color: var(--emerald); }
.badge-offline   { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge-warning   { background: rgba(245,158,11,0.15);  color: var(--gold); }
.badge-critical  { background: rgba(239,68,68,0.2);    color: #ff7b7b; animation: pulse-badge 2s infinite; }
.badge-info      { background: var(--brand-glow-sm);   color: var(--brand-light); }
.badge-stale     { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-open      { background: var(--brand-glow-sm);   color: var(--brand-light); }
.badge-closed    { background: rgba(16,185,129,0.15);  color: var(--emerald); }
.badge-pending   { background: rgba(245,158,11,0.15);  color: var(--gold); }
.badge-inprogress{ background: rgba(124,58,237,0.2);   color: var(--brand-light); }
.badge-high      { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge-medium    { background: rgba(245,158,11,0.15);  color: var(--gold); }
.badge-low       { background: rgba(16,185,129,0.15);  color: var(--emerald); }
.badge-critical-sev { background: rgba(220,38,38,0.2); color: #fca5a5; animation: pulse-badge 2s infinite; }

@keyframes pulse-badge { 0%,100%{opacity:1} 50%{opacity:0.55} }

/* ── Form elements ──────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 10.5px; font-weight: 700;
  color: var(--text-2); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-glow-sm); }
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 80px; font-family: var(--font-mono); }
select.form-control { cursor: pointer; background: var(--bg-input); }
option { background: var(--bg-card2); }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 38px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-card2);
  border-radius: 22px; border: 1px solid var(--border);
  cursor: pointer; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 15px; height: 15px; left: 3px; top: 3px;
  background: var(--text-3); border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--brand); border-color: var(--brand-dark); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

/* ── Modal ──────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}
#modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 580px; max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124,58,237,0.12);
}
#modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
#modal-title { font-size: 15px; font-weight: 800; color: var(--text); }
.modal-close-x {
  background: none; color: var(--text-2);
  font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 4px;
}
.modal-close-x:hover { background: var(--bg-hover); color: var(--text); }
#modal-body { padding: 22px; overflow-y: auto; flex: 1; }
#modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-card2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Toast ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 99999;
}
.toast {
  background: var(--bg-card2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 290px; max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.22s ease;
  border-left: 3px solid var(--toast-accent, var(--brand));
}
.toast.success { --toast-accent: var(--emerald); }
.toast.error   { --toast-accent: var(--red); }
.toast.warning { --toast-accent: var(--gold); }

@keyframes slide-in { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slide-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }
.toast.out { animation: slide-out 0.22s ease forwards; }
.toast-icon svg { width: 15px; height: 15px; margin-top: 1px; }
.toast-title { font-weight: 700; font-size: 12px; color: var(--text); }
.toast-body  { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ── Search bar ─────────────────────────────────────────────────── */
.search-bar { position: relative; display: inline-flex; align-items: center; }
.search-bar svg { position: absolute; left: 10px; width: 13px; height: 13px; color: var(--text-3); }
.search-bar input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 7px 10px 7px 30px; font-size: 12px; width: 220px;
  transition: border-color 0.15s, width 0.2s;
}
.search-bar input:focus { border-color: var(--brand); width: 280px; }
.search-bar input::placeholder { color: var(--text-3); }

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px; font-size: 12px; font-weight: 700;
  color: var(--text-2); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand-light); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress bar ───────────────────────────────────────────────── */
.progress-bar { height: 5px; background: var(--bg-card2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--brand); transition: width 0.5s ease; }
.progress-fill.danger  { background: var(--red); }
.progress-fill.warning { background: var(--gold); }
.progress-fill.success { background: var(--emerald); }

/* ── Metric row ─────────────────────────────────────────────────── */
.metric-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.metric-label { font-size: 11px; color: var(--text-2); width: 38px; flex-shrink: 0; }
.metric-bar   { flex: 1; }
.metric-val   { font-size: 11px; font-weight: 800; width: 36px; text-align: right; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-3); gap: 12px;
}
.empty-state svg { width: 44px; height: 44px; opacity: 0.35; }
.empty-state .empty-title { font-size: 14px; font-weight: 700; color: var(--text-2); }
.empty-state .empty-sub   { font-size: 12px; }

/* ── Divider ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Code block ─────────────────────────────────────────────────── */
.code-block {
  background: #050710; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono); font-size: 11px;
  color: #c4b5fd; white-space: pre-wrap; word-break: break-all;
  max-height: 240px; overflow-y: auto;
  line-height: 1.7;
}

/* ── Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Glow line divider ───────────────────────────────────────────── */
.glow-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--gold), transparent);
  margin: 20px 0; opacity: 0.4;
}
