/* ============================================================================
   EIN-Guard — CS:GO Dark/Gold Theme
   Design tokens, layout, components — fully responsive
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Rajdhani:wght@300;400;500;600;700&family=Teko:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Colors */
  --bg-base:        #0a0a0c;
  --bg-surface:     #16161a;
  --bg-elevated:    #1c1c21;
  --bg-input:       #0e0e10;
  --bg-hover:       #22222a;

  --border:         #2a2a2e;
  --border-strong:  #3a3a42;

  --text-primary:   #e8e8ea;
  --text-secondary: #a0a0a6;
  --text-muted:     #6a6a72;

  --gold:           #de9b35;
  --gold-bright:    #f1b04a;
  --gold-dim:       #a87420;
  --gold-glow:      rgba(222, 155, 53, 0.18);

  --green:          #4ade80;
  --red:            #ef4444;
  --orange:         #fb923c;
  --blue:           #60a5fa;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--gold-glow);

  --radius:    6px;
  --radius-lg: 10px;

  --font-display: 'Bebas Neue', sans-serif;
  --font-heading: 'Teko', sans-serif;
  --font-body:    'Rajdhani', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

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

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse at top, rgba(222, 155, 53, 0.04), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(60, 60, 80, 0.03), transparent 50%),
    var(--bg-base);
}

/* ============================================================================
   Typography
============================================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

a { color: var(--gold); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--gold-bright); }

code, pre, .mono { font-family: var(--font-mono); font-size: 13px; }
.mono-sm { font-family: var(--font-mono); font-size: 12px; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold { color: var(--gold); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }

/* ============================================================================
   Layout — Sidebar + Main
============================================================================ */

.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 20px 22px;
  border-bottom: 2px solid var(--gold);
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
}
.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--gold);
  margin: 0;
}
.sidebar-brand .tag {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}
.nav-section-label {
  padding: 12px 22px 6px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  color: var(--text-secondary);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
  background: linear-gradient(90deg, var(--gold-glow), transparent);
  border-left-color: var(--gold);
  color: var(--gold);
}
.nav-link svg, .nav-link .icon { width: 18px; height: 18px; }

.sidebar-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.main {
  padding: 28px 36px;
  max-width: 1400px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.topbar h2 { color: var(--gold); }
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 13px;
}
.user-pill .role {
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--gold);
  color: var(--bg-base);
  font-weight: 700;
  text-transform: uppercase;
}
.user-pill .role.client { background: var(--blue); }

/* ============================================================================
   Cards
============================================================================ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, var(--gold-glow), transparent 70%);
  opacity: 0.5;
}
.stat-card .label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 1px;
  color: var(--gold);
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.stat-card.green { border-left-color: var(--green); }
.stat-card.green .value { color: var(--green); }
.stat-card.red { border-left-color: var(--red); }
.stat-card.red .value { color: var(--red); }

/* ============================================================================
   Tables
============================================================================ */

.table-wrap { overflow-x: auto; }

table.eg {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.eg thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 2px solid var(--gold);
}
table.eg tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.eg tbody tr:hover { background: var(--bg-hover); }
table.eg tbody tr:last-child td { border-bottom: none; }

/* ============================================================================
   Forms
============================================================================ */

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.form-control,
.form-control:not(textarea) {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.form-control { min-height: 80px; resize: vertical; font-family: var(--font-body); }
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
                    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

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

@media (max-width: 720px) {
  .form-row, .form-row.three { grid-template-columns: 1fr; }
}

/* ============================================================================
   Buttons
============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--gold); color: var(--text-primary); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border-color: var(--gold);
  color: var(--bg-base);
  font-weight: 700;
}
.btn-primary:hover { background: var(--gold-bright); color: var(--bg-base); box-shadow: var(--shadow-glow); }

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

.btn-success { color: var(--green); border-color: rgba(74, 222, 128, 0.3); }
.btn-success:hover { background: rgba(74, 222, 128, 0.12); border-color: var(--green); color: var(--green); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================================
   Badges & status
============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-online    { background: rgba(74, 222, 128, 0.15); color: var(--green); border-color: rgba(74, 222, 128, 0.3); }
.badge-offline   { background: rgba(239, 68, 68, 0.12); color: var(--red); border-color: rgba(239, 68, 68, 0.3); }
.badge-connecting{ background: rgba(251, 146, 60, 0.15); color: var(--orange); border-color: rgba(251, 146, 60, 0.3); }
.badge-warn      { background: rgba(251, 146, 60, 0.15); color: var(--orange); border-color: rgba(251, 146, 60, 0.3); }
.badge-info      { background: rgba(96, 165, 250, 0.15); color: var(--blue); border-color: rgba(96, 165, 250, 0.3); }
.badge-gold      { background: var(--gold-glow); color: var(--gold); border-color: var(--gold-dim); }

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot.offline { background: var(--red); }
.dot.connecting { background: var(--orange); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================================
   Login / Auth pages
============================================================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, rgba(222, 155, 53, 0.06), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(60, 60, 80, 0.05), transparent 60%),
    var(--bg-base);
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.auth-head {
  padding: 28px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border-bottom: 2px solid var(--gold);
  text-align: center;
}
.auth-head h1 {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 6px;
  color: var(--gold);
}
.auth-head p {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.auth-body { padding: 28px; }

.code-input {
  width: 100%;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 600;
}
.code-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ============================================================================
   Alerts / Flash
============================================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.alert-success { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.3); color: var(--green); }
.alert-error   { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.3); color: var(--red); }
.alert-warn    { background: rgba(251, 146, 60, 0.08); border-color: rgba(251, 146, 60, 0.3); color: var(--orange); }
.alert-info    { background: rgba(96, 165, 250, 0.08); border-color: rgba(96, 165, 250, 0.3); color: var(--blue); }

/* ============================================================================
   Module toggles (guard config)
============================================================================ */

.module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.module-card.enabled {
  border-color: var(--gold-dim);
  background: linear-gradient(135deg, var(--bg-surface), rgba(222, 155, 53, 0.03));
}
.module-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.module-head h4 {
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 4px;
}
.module-head .desc {
  font-size: 13px;
  color: var(--text-secondary);
}
.module-card.enabled .module-head h4 { color: var(--gold); }

.module-settings {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.module-settings textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-input);
  min-height: 100px;
}

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  transition: 0.2s;
}
.switch .slider:before {
  position: absolute; content: '';
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  background: var(--gold-glow);
  border-color: var(--gold);
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
  background: var(--gold);
}

/* ============================================================================
   Logs
============================================================================ */

.log-row {
  display: grid;
  grid-template-columns: 130px 80px 100px 1fr;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.log-row:hover { background: var(--bg-hover); }
.log-row .time { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.log-row .module { font-weight: 600; color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.log-row .msg { color: var(--text-primary); }
.log-level {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.log-level-info  { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.log-level-warn  { background: rgba(251, 146, 60, 0.15); color: var(--orange); }
.log-level-alert { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.log-level-critical { background: var(--red); color: var(--bg-base); }
.log-level-debug { background: var(--bg-elevated); color: var(--text-muted); }

@media (max-width: 720px) {
  .log-row { grid-template-columns: 1fr; gap: 4px; padding: 12px; }
}

/* ============================================================================
   Mobile / responsive
============================================================================ */

.mobile-toggle {
  display: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    width: 240px;
    z-index: 100;
    transition: left 0.25s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .mobile-toggle { display: inline-block; }
  .main { padding: 16px; }
  .topbar h2 { font-size: 18px; }
}

@media (max-width: 480px) {
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .stat-card .value { font-size: 28px; }
  .auth-head h1 { font-size: 26px; letter-spacing: 4px; }
  .code-input { font-size: 22px; letter-spacing: 8px; }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ============================================================================
   Utility
============================================================================ */

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; gap: 8px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* Selection */
::selection { background: var(--gold); color: var(--bg-base); }
