/* ═══════════════════════════════════════════════════════════════════
   3Click RMM — Main CSS  |  Signature color: Deep Violet + Ember Gold
═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand palette ──────────────────────────────────────── */
  --brand:          #7c3aed;   /* deep violet */
  --brand-dark:     #5b21b6;
  --brand-light:    #a78bfa;
  --brand-glow:     rgba(124,58,237,0.22);
  --brand-glow-sm:  rgba(124,58,237,0.12);

  --gold:           #f59e0b;   /* ember gold accent */
  --gold-dark:      #d97706;
  --gold-glow:      rgba(245,158,11,0.2);

  --emerald:        #10b981;
  --red:            #ef4444;
  --red-dark:       #dc2626;
  --orange:         #f97316;
  --cyan:           #06b6d4;
  --pink:           #ec4899;

  /* ── Backgrounds ─────────────────────────────────────────── */
  --bg-root:        #07080f;
  --bg-dark:        #0b0d1a;
  --bg-card:        #10122a;  /* deep navy-violet */
  --bg-card2:       #161838;
  --bg-sidebar:     #080a18;
  --bg-topbar:      #09091a;
  --bg-input:       #1a1c3a;
  --bg-hover:       #1e2045;
  --bg-select:      #2a1a5e;

  /* ── Text ────────────────────────────────────────────────── */
  --text:           #ede9fe;   /* lavender white */
  --text-2:         #a89cc8;
  --text-3:         #4c4571;
  --text-link:      #c4b5fd;

  /* ── Borders ─────────────────────────────────────────────── */
  --border:         #1f1d4a;
  --border-2:       #2e2a6a;

  /* ── Status ──────────────────────────────────────────────── */
  --status-online:  #10b981;
  --status-offline: #ef4444;
  --status-warning: #f59e0b;
  --status-stale:   #6b7280;

  /* ── Sizing ──────────────────────────────────────────────── */
  --sidebar-w:      224px;
  --titlebar-h:     42px;
  --radius:         9px;
  --radius-sm:      5px;
  --radius-lg:      14px;

  --font:           'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:      'Cascadia Code', 'Consolas', monospace;

  --shadow:         0 4px 28px rgba(0,0,0,0.6);
  --shadow-lg:      0 10px 56px rgba(0,0,0,0.8);
  --shadow-brand:   0 0 24px rgba(124,58,237,0.28);
  --shadow-gold:    0 0 20px rgba(245,158,11,0.2);
}

/* ── RTL support for Arabic ──────────────────────────────────────────── */
[dir="rtl"] #app-layout    { direction: rtl; }
[dir="rtl"] #sidebar       { order: 1; border-left: none; border-right: 1px solid var(--border); }
[dir="rtl"] #main-content  { order: 0; }
[dir="rtl"] .nav-item      { flex-direction: row-reverse; }
[dir="rtl"] .nav-badge     { margin-left: 0; margin-right: auto; }
[dir="rtl"] .card-title    { flex-direction: row-reverse; }
[dir="rtl"] .page-header   { flex-direction: row-reverse; }
[dir="rtl"] .page-actions  { margin-left: 0; margin-right: auto; }
[dir="rtl"] .tb-left       { flex-direction: row-reverse; padding-left: 0; padding-right: 14px; }
[dir="rtl"] .tb-right      { flex-direction: row-reverse; padding-right: 0; padding-left: 4px; }
[dir="rtl"] .sidebar-footer{ direction: rtl; }
[dir="rtl"] body           { font-family: 'Segoe UI', 'Arabic Typesetting', system-ui, sans-serif; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-root);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: var(--font); outline: none; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ══════════════════════════════════════════════════════════════════
   TITLE BAR — full command bar
══════════════════════════════════════════════════════════════════ */
#titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--titlebar-h);
  background: linear-gradient(90deg, #08091a 0%, #0c0e22 40%, #0a0c1e 100%);
  border-bottom: 1px solid rgba(124,58,237,0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  -webkit-app-region: no-drag;
  box-shadow: 0 2px 24px rgba(0,0,0,0.55), 0 1px 0 rgba(124,58,237,0.12);
}

/* Animated rainbow-shimmer accent line at top */
.tb-accent-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    #7c3aed, #1de9c6, #29b6f6, #f59e0b, #ec4899, #7c3aed);
  background-size: 300% 100%;
  animation: tbAccentShimmer 4s linear infinite;
}
@keyframes tbAccentShimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

/* Bottom glow line */
#titlebar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(124,58,237,0.5) 30%,
    rgba(29,233,198,0.4) 60%, rgba(245,158,11,0.3) 80%, transparent 100%);
}

/* LEFT section (drag region) */
.tb-left {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  -webkit-app-region: drag;
  padding-left: 14px;
  gap: 16px;
  min-width: 0;
}

/* Logo block */
.titlebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tb-brand-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}
.titlebar-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.7px;
  background: linear-gradient(90deg, #a78bfa, #1de9c6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.tb-edition-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 3px;
  padding: 0px 5px;
  text-transform: uppercase;
  align-self: flex-start;
}

/* CENTER status area */
#titlebar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-2);
  flex-shrink: 0;
}
.tb-divider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.tb-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--emerald);
  white-space: nowrap;
}
.tb-stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tb-chip-green  { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.18); color: #10b981; }
.tb-chip-red    { background: rgba(239,68,68,0.10);  border-color: rgba(239,68,68,0.18);  color: #ef4444; }
.tb-chip-purple { background: rgba(124,58,237,0.10); border-color: rgba(124,58,237,0.18); color: #a78bfa; }
.tb-chip-green svg, .tb-chip-red svg, .tb-chip-purple svg { stroke: currentColor; }

.tb-clock {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 56px;
}

/* RIGHT section */
.tb-right {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 4px;
  height: 100%;
  flex-shrink: 0;
}

/* Quick action icon buttons */
.tb-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tb-action-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
  border: 1px solid transparent;
}
.tb-action-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.tb-action-btn:hover {
  background: rgba(124,58,237,0.14);
  color: var(--brand-light);
  border-color: rgba(124,58,237,0.22);
  box-shadow: 0 0 8px rgba(124,58,237,0.15);
}

/* Telegram button */
.tb-tg-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(41,182,246,0.10);
  border: 1px solid rgba(41,182,246,0.22);
  color: #29b6f6;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s, box-shadow 0.14s;
  cursor: pointer;
}
.tb-tg-btn:hover {
  background: rgba(41,182,246,0.18);
  box-shadow: 0 0 10px rgba(41,182,246,0.2);
}
.tb-tg-btn svg { flex-shrink: 0; }

/* Window controls */
.titlebar-controls { display: flex; align-items: center; }
.tb-btn {
  width: 46px; height: var(--titlebar-h);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.14s, color 0.14s;
}
.tb-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.tb-btn.tb-close:hover { background: #ef4444; color: #fff; }

/* Status dot */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); animation: dotPulse 2s ease infinite; }
.status-dot.offline { background: var(--red); }
.status-dot.warning { background: var(--gold); }
@keyframes dotPulse {
  0%,100% { box-shadow: 0 0 4px var(--emerald); }
  50%      { box-shadow: 0 0 10px var(--emerald); }
}

/* Sidebar Telegram link */
.sb-tg-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(41,182,246,0.08);
  border: 1px solid rgba(41,182,246,0.15);
  color: #29b6f6;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 6px;
  transition: background 0.14s;
  cursor: pointer;
}
.sb-tg-link:hover { background: rgba(41,182,246,0.15); }

/* ── Language switcher ───────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 2px;
}
.lang-btn {
  padding: 2px 10px;
  border-radius: 16px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  background: none;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}
.lang-btn:hover  { background: rgba(255,255,255,0.07); color: var(--text-2); }
.lang-btn.lang-active { background: var(--brand); color: #fff; }

/* FAQ accordion */
.faq-item { cursor: default; }
.faq-q    { cursor: pointer; }
.faq-q:hover { background: rgba(255,255,255,0.03) !important; }

/* ── Layout ─────────────────────────────────────────────────────── */
#app-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--titlebar-h);
}

/* ── Sidebar ────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 0;
}

.sidebar-section { padding: 2px 0; }

.sidebar-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: var(--text-3);
  padding: 14px 16px 5px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  color: var(--text-2);
  font-size: 12.5px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); border-left-color: var(--border-2); }
.nav-item.active {
  background: var(--brand-glow-sm);
  color: var(--brand-light);
  border-left-color: var(--brand);
  font-weight: 700;
}
.nav-icon { width: 15px; height: 15px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--bg-card2);
  color: var(--text-2);
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px; text-align: center;
}
.nav-badge.danger  { background: rgba(239,68,68,0.2);  color: var(--red); }
.nav-badge.warning { background: rgba(245,158,11,0.2); color: var(--gold); }
.nav-badge.brand   { background: var(--brand-glow);    color: var(--brand-light); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 13px 14px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand), var(--gold));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-brand);
}
.user-name { font-size: 12px; font-weight: 700; color: var(--text); }
.user-role { font-size: 10px; color: var(--text-3); }

/* ── Main content ───────────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  position: relative;
}

/* Background — PNG over gradient mesh fallback */
#main-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../3clickbackground.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}
/* Gradient mesh shows when PNG is unavailable (same element, behind) */
#main-content {
  background:
    radial-gradient(ellipse 90% 70% at 15% 5%,  rgba(124,58,237,0.22) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 85% 95%, rgba(16,185,129,0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 15%, rgba(6,182,212,0.10)  0%, transparent 50%),
    var(--bg-dark);
}

#page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 26px 28px;
  position: relative;
  z-index: 1;
}

/* ── Page header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}
.page-title svg { width: 20px; height: 20px; color: var(--brand-light); }
.page-subtitle { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.hidden { display: none !important; }
