/* ============================================
   VARIABLES — mirror portfolio site palette
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary:    #06060f;
  --bg-secondary:  #09091a;
  --bg-card:       rgba(255,255,255,0.03);
  --bg-card-hover: rgba(255,255,255,0.06);
  --cyan:          #00d4ff;
  --purple:        #7b2ff7;
  --green:         #00e676;
  --red:           #ff4f4f;
  --text-primary:  #f0f0ff;
  --text-secondary:#7878a0;
  --text-muted:    #3c3c5a;
  --border:        rgba(255,255,255,0.06);
  --border-cyan:   rgba(0,212,255,0.2);
  --border-purple: rgba(123,47,247,0.2);
  --radius:        12px;
  --radius-lg:     20px;
  --font:          'Inter', system-ui, sans-serif;
  --mono:          'Fira Code', monospace;
  --sidebar-w:     220px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

.hidden { display: none !important; }
.accent { color: var(--cyan); }

/* ============================================
   LOADING
   ============================================ */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  z-index: 999;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   LOGIN
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
}

.login-box {
  width: 100%; max-width: 380px;
  padding: 48px 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.login-logo {
  font-size: 1.6rem; font-weight: 900;
  letter-spacing: -0.04em; margin-bottom: 4px;
}

.login-sub {
  font-size: 0.82rem; color: var(--text-muted);
  font-family: var(--mono); margin-bottom: 36px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 0.78rem;
  color: var(--text-secondary); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--mono); margin-bottom: 7px;
}
.field input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font); font-size: 0.92rem;
  transition: border-color 0.2s;
  outline: none;
}
.field input:focus { border-color: var(--border-cyan); }

.error-msg {
  padding: 10px 14px; margin-bottom: 14px;
  background: rgba(255,79,79,0.08);
  border: 1px solid rgba(255,79,79,0.2);
  border-radius: var(--radius);
  font-size: 0.84rem; color: var(--red);
}

.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff; border: none;
  border-radius: var(--radius);
  font-family: var(--font); font-size: 0.92rem;
  font-weight: 700; cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
  display: flex; min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  font-size: 1.3rem; font-weight: 900;
  letter-spacing: -0.04em;
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav { flex: 1; padding: 0 12px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text-secondary);
  font-size: 0.88rem; font-weight: 500;
  transition: all 0.2s; margin-bottom: 2px;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-item.active {
  color: var(--cyan);
  background: rgba(0,212,255,0.07);
  border: 1px solid rgba(0,212,255,0.12);
}
.nav-item svg { flex-shrink: 0; }

.nav-divider { height: 1px; background: var(--border); margin: 10px 0; }

.logout-btn {
  display: flex; align-items: center; gap: 8px;
  margin: 12px; padding: 9px 12px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  font-size: 0.82rem; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; padding: 36px 40px;
  min-height: 100vh;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header { margin-bottom: 28px; }
.page-title {
  font-size: 1.5rem; font-weight: 800;
  letter-spacing: -0.02em;
}
.page-subtitle { font-size: 0.84rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================
   STAT CARDS
   ============================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border-cyan); }

.stat-card-label {
  font-size: 0.7rem; font-family: var(--mono);
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.15em; margin-bottom: 8px;
}
.stat-card-value {
  font-size: 2rem; font-weight: 800; line-height: 1;
  color: var(--cyan);
}
.stat-card-sub {
  font-size: 0.75rem; color: var(--text-muted);
  margin-top: 5px;
}
.stat-card-sub.up   { color: var(--green); }
.stat-card-sub.down { color: var(--red); }

/* ============================================
   CARDS & PANELS
   ============================================ */
.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 0.85rem; font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--mono); margin-bottom: 20px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ============================================
   TABLES
   ============================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 0.7rem;
  font-family: var(--mono); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 0 12px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 0; font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-wrap { position: relative; height: 220px; }
.chart-wrap canvas { max-height: 220px; }

/* ============================================
   STATUS DOTS
   ============================================ */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px;
}
.status-dot.ok  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.err { background: var(--red);   box-shadow: 0 0 6px var(--red); }

/* ============================================
   UPTIME GRID
   ============================================ */
.uptime-grid {
  display: flex; gap: 3px; flex-wrap: wrap; margin-top: 12px;
}
.uptime-tick {
  width: 10px; height: 28px; border-radius: 3px;
  background: var(--green);
  transition: opacity 0.2s;
  cursor: default;
}
.uptime-tick.fail { background: var(--red); }
.uptime-tick:hover { opacity: 0.7; }

/* ============================================
   BAR CHART (inline CSS bars)
   ============================================ */
.bar-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.bar-label { min-width: 100px; font-size: 0.82rem; color: var(--text-secondary); }
.bar-track { flex: 1; height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.bar-fill  { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--purple)); border-radius: 3px; }
.bar-count { font-size: 0.78rem; color: var(--text-muted); font-family: var(--mono); min-width: 40px; text-align: right; }

/* ============================================
   SETTINGS FORM
   ============================================ */
.settings-panel { max-width: 440px; }
.settings-panel .field { margin-bottom: 16px; }
.btn-save {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff; border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 0.88rem;
  font-weight: 700; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.85; }
.settings-divider { height: 1px; background: var(--border); margin: 28px 0; }
.settings-info { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; }

/* ============================================
   ACTIVE NOW BADGE
   ============================================ */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-family: var(--mono);
  color: var(--green);
  background: rgba(0,230,118,0.08);
  border: 1px solid rgba(0,230,118,0.2);
  padding: 3px 10px; border-radius: 100px;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: 60px; flex-direction: row; position: fixed; bottom: 0; top: auto; border-right: none; border-top: 1px solid var(--border); padding: 0; }
  .sidebar-logo, .logout-btn { display: none; }
  .sidebar-nav { display: flex; align-items: center; justify-content: space-around; padding: 0 8px; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 0.65rem; padding: 6px 8px; }
  .main-content { margin-left: 0; margin-bottom: 60px; padding: 20px 16px; }
  .two-col, .three-col { grid-template-columns: 1fr; }
}
