@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   GLOBAL RESET & BASE
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
  font-size: 14px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 240px;
  background: #161b22;
  border-right: 1px solid #21262d;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #f0f6fc;
}

.sidebar-section { margin-bottom: 24px; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: #484f58;
  letter-spacing: 0.8px;
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #8b949e;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s;
}

.nav-item:hover {
  background: #1c2128;
  color: #c9d1d9;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(99, 102, 241, 0.08));
  color: #a78bfa;
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  margin-left: 240px;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #f0f6fc;
}

.page-header .subtitle {
  color: #8b949e;
  font-size: 13px;
  margin-top: 4px;
}

/* ============================================
   POLLING BADGE
   ============================================ */
.polling-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: 1px solid;
}

.polling-badge.active {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
  color: #22c55e;
}

.polling-badge.inactive {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.polling-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
}

.polling-badge.active .dot { background: #22c55e; animation: pulse 2s infinite; }
.polling-badge.inactive .dot { background: #ef4444; }

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

/* ============================================
   PERIOD TABS
   ============================================ */
.period-tabs {
  display: flex; gap: 6px; margin-bottom: 20px;
}

.period-btn {
  padding: 7px 16px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  border: 1px solid #21262d;
  background: transparent; color: #8b949e;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.period-btn:hover { border-color: #30363d; color: #c9d1d9; }

.period-btn.active {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.3);
  color: #a78bfa;
}

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

.stat-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: #30363d; }

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-label { font-size: 12px; color: #8b949e; font-weight: 500; }
.stat-icon { font-size: 18px; }

.stat-value {
  font-size: 28px; font-weight: 700; color: #f0f6fc;
  margin-bottom: 4px;
}

.stat-value.green { color: #22c55e; }
.stat-value.blue { color: #58a6ff; }
.stat-value.purple { color: #a78bfa; }

.stat-sub { font-size: 11px; color: #484f58; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #21262d;
}

.card-header h3 { font-size: 14px; font-weight: 600; color: #f0f6fc; }

.link { color: #a78bfa; text-decoration: none; font-size: 12px; font-weight: 500; }
.link:hover { color: #c4b5fd; }

.card-body { padding: 20px; }

/* ============================================
   TABLES
   ============================================ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #484f58;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid #21262d;
}

td {
  padding: 12px 20px;
  font-size: 13px;
  border-bottom: 1px solid #161b22;
}

tr:hover td { background: rgba(124, 58, 237, 0.03); }

.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: #a78bfa; }
.bold { font-weight: 600; color: #f0f6fc; }
.empty-row { text-align: center; color: #484f58; padding: 40px !important; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.badge-warning { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.btn:hover { transform: translateY(-1px); }

.btn-sm { padding: 6px 14px; font-size: 12px; }

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: white;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #21262d;
  color: #8b949e;
}

.btn-ghost:hover { border-color: #30363d; color: #c9d1d9; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #8b949e;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus { border-color: #7c3aed; }
.form-input::placeholder { color: #484f58; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
}

.modal-overlay.show { display: flex; }

.modal {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 16px;
  padding: 28px;
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal h2 { font-size: 18px; font-weight: 700; color: #f0f6fc; margin-bottom: 20px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed; top: 20px; right: 20px;
  background: #161b22;
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e; padding: 14px 20px;
  border-radius: 10px; font-size: 13px;
  display: none; z-index: 1000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ============================================
   UTILITY
   ============================================ */
.copy-btn {
  background: #21262d;
  color: #8b949e;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-family: 'Inter', sans-serif;
}
.copy-btn:hover { background: #30363d; color: #c9d1d9; }

.success-msg {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #22c55e;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 12px;
  display: none;
}
