/* ==========================================================================
   STATYSTYKI SPRZEDAŻY I ZAROBKÓW BOTÓW - STYLESHEET
   Stylistyka: Premium Dark / Modern Analytics Dashboard
   ========================================================================== */

:root {
  --stats-bg: #090D16;
  --stats-surface: #111827;
  --stats-card: #162032;
  --stats-card-hover: #1C2A42;
  --stats-border: #1F2E47;
  --stats-border-focus: #3B82F6;
  
  --stats-text: #F3F4F6;
  --stats-text-muted: #94A3B8;
  --stats-text-dim: #64748B;
  
  --stats-primary: #3B82F6;
  --stats-primary-glow: rgba(59, 130, 246, 0.25);
  
  --stats-success: #10B981;
  --stats-success-bg: rgba(16, 185, 129, 0.12);
  --stats-success-border: rgba(16, 185, 129, 0.25);
  
  --stats-warning: #F59E0B;
  --stats-warning-bg: rgba(245, 158, 11, 0.12);
  
  --stats-danger: #EF4444;
  --stats-danger-bg: rgba(239, 68, 68, 0.12);
  
  --stats-purple: #8B5CF6;
  --stats-purple-bg: rgba(139, 92, 246, 0.15);
  
  --font-main: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--stats-bg);
  color: var(--stats-text);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.stats-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.stats-navbar {
  height: 64px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stats-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.stats-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.stats-logo-badge {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #FFF;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.stats-brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-brand-sub {
  font-size: 11px;
  color: var(--stats-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--stats-primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: #2563EB;
  box-shadow: 0 0 15px var(--stats-primary-glow);
}

.btn-secondary {
  background: var(--stats-card);
  color: var(--stats-text);
  border-color: var(--stats-border);
}
.btn-secondary:hover {
  background: var(--stats-card-hover);
  border-color: #334155;
}

.btn-outline-success {
  background: var(--stats-success-bg);
  color: var(--stats-success);
  border-color: var(--stats-success-border);
}
.btn-outline-success:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--stats-text-muted);
}
.btn-ghost:hover {
  color: var(--stats-text);
  background: rgba(255, 255, 255, 0.05);
}

/* Kontener główny */
.stats-main {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

/* Mega Hero KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #334155;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.kpi-card-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.kpi-card-glow.gold { background: linear-gradient(90deg, #F59E0B, #10B981); }
.kpi-card-glow.green { background: linear-gradient(90deg, #10B981, #06B6D4); }
.kpi-card-glow.blue { background: linear-gradient(90deg, #3B82F6, #8B5CF6); }
.kpi-card-glow.purple { background: linear-gradient(90deg, #8B5CF6, #EC4899); }
.kpi-card-glow.cyan { background: linear-gradient(90deg, #06B6D4, #3B82F6); }

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

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stats-text-muted);
}

.kpi-icon {
  font-size: 20px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.kpi-sub {
  font-size: 12px;
  color: var(--stats-text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.kpi-pill-success {
  background: var(--stats-success-bg);
  color: var(--stats-success);
}

/* Pasek zakładek */
.stats-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--stats-border);
  margin-bottom: 24px;
  padding-bottom: 8px;
  overflow-x: auto;
}

.stats-tab-btn {
  background: transparent;
  border: none;
  color: var(--stats-text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.stats-tab-btn:hover {
  color: var(--stats-text);
  background: rgba(255, 255, 255, 0.04);
}

.stats-tab-btn.active {
  color: #FFFFFF;
  background: var(--stats-card);
  border: 1px solid var(--stats-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.stats-tab-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--stats-text);
}

/* Zawartość zakładek */
.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}
.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Karty Botów Grid */
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.bot-stat-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s ease;
}

.bot-stat-card:hover {
  border-color: #334155;
  background: var(--stats-card);
}

.bot-stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.bot-stat-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 2px;
}

.bot-stat-store {
  font-size: 12px;
  color: var(--stats-text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.online {
  background: var(--stats-success-bg);
  color: var(--stats-success);
  border: 1px solid var(--stats-success-border);
}

.status-badge.offline {
  background: rgba(148, 163, 184, 0.1);
  color: var(--stats-text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.bot-stat-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  background: var(--stats-bg);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.bot-metric-box {
  display: flex;
  flex-direction: column;
}

.bot-metric-box .label {
  font-size: 11px;
  color: var(--stats-text-dim);
  text-transform: uppercase;
}

.bot-metric-box .value {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #FFFFFF;
}

.bot-metric-box .value.highlight {
  color: var(--stats-success);
}

.bot-stat-footer {
  font-size: 12px;
  color: var(--stats-text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

/* Tabele (Produkty, Transakcje, Oś Czasu) */
.table-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 14px;
  overflow: hidden;
}

.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--stats-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.stats-table th {
  background: var(--stats-card);
  color: var(--stats-text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 20px;
  border-bottom: 1px solid var(--stats-border);
}

.stats-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.stats-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.progress-bar-bg {
  width: 120px;
  height: 6px;
  background: var(--stats-card);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--stats-primary), #8B5CF6);
  border-radius: 3px;
}

/* Ekran Logowania do Statystyk (Password Gate) */
.login-gate-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-gate-card {
  background: var(--stats-surface);
  border: 1px solid var(--stats-border);
  border-radius: 18px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3B82F6, #8B5CF6, #10B981);
}

.login-gate-icon {
  width: 56px;
  height: 56px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
}

.login-gate-title {
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 8px;
}

.login-gate-desc {
  font-size: 13px;
  color: var(--stats-text-muted);
  margin-bottom: 24px;
  line-height: 1.4;
}

.login-form-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--stats-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.login-form-input {
  width: 100%;
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: #FFFFFF;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form-input:focus {
  border-color: var(--stats-primary);
  box-shadow: 0 0 0 3px var(--stats-primary-glow);
}

.login-error-msg {
  color: var(--stats-danger);
  font-size: 12px;
  margin-top: 8px;
  display: none;
}

/* Toast */
.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--stats-card);
  border: 1px solid var(--stats-border);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-box.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsywność */
@media (max-width: 768px) {
  .stats-navbar {
    padding: 0 16px;
  }
  .stats-main {
    padding: 16px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bots-grid {
    grid-template-columns: 1fr;
  }
}
