/* Design Tokens */
:root {
  --font-family-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Cyberpunk Dark Slate & Neon */
  --bg-primary: #0a0c10;
  --bg-secondary: rgba(18, 22, 31, 0.7);
  --bg-tertiary: rgba(26, 32, 46, 0.9);
  
  --accent-cyan: #0df;
  --accent-blue: #0088ff;
  --accent-purple: #9d4edd;
  --accent-green: #39e75f;
  --accent-orange: #ff7b00;

  --text-primary: #f0f2f5;
  --text-secondary: #9aa5b5;
  --text-muted: #5e6978;

  --border-glass: rgba(255, 255, 255, 0.06);
  --border-active: rgba(0, 221, 255, 0.2);
  --glow-shadow: 0 0 20px rgba(0, 221, 255, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

/* Resets & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Ambient Glows */
.background-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.12;
  pointer-events: none;
}

.bg-glow-1 {
  background: var(--accent-cyan);
  top: -150px;
  left: -100px;
}

.bg-glow-2 {
  background: var(--accent-purple);
  bottom: -150px;
  right: -100px;
}

/* Layout Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 221, 255, 0.4));
  animation: float 4s ease-in-out infinite;
}

.logo-text h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text .badge {
  font-size: 10px;
  font-family: var(--font-family-mono);
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-family-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-indicator.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.status-indicator.offline {
  background-color: #ff3333;
  box-shadow: 0 0 10px #ff3333;
}

.uptime {
  margin-left: 15px;
  padding-left: 15px;
  border-left: 1px solid var(--border-glass);
  color: var(--text-muted);
}

/* Sections */
.section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

/* Services Grid (Card Layout) */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.service-card {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, transparent);
  transition: background 0.3s;
}

.service-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: var(--glow-shadow);
}

.service-card.client-card:hover::before {
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
}

.service-card.files-card:hover::before {
  background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
}

.service-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  margin-right: 20px;
  border: 1px solid var(--border-glass);
}

.service-icon svg {
  width: 28px;
  height: 28px;
}

.qb-color {
  color: var(--accent-cyan);
  background: rgba(0, 221, 255, 0.05);
}

.fb-color {
  color: var(--accent-purple);
  background: rgba(157, 78, 221, 0.05);
}

.service-info {
  flex-grow: 1;
}

.service-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.service-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.service-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: all 0.2s;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.service-card:hover .service-action {
  color: var(--text-primary);
  opacity: 1;
}

.service-card:hover .arrow-icon {
  transform: translateX(4px);
}

/* System Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 15px;
}

.metric-header h4 {
  font-size: 11px;
  font-family: var(--font-family-mono);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-family-mono);
}

.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.1, 1);
}

.cpu-bar {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  box-shadow: 0 0 10px rgba(0, 221, 255, 0.5);
}

.mem-bar {
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.5);
}

.disk-bar {
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-orange));
  box-shadow: 0 0 10px rgba(255, 123, 0, 0.5);
}

.metric-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Speed Capsules */
.speed-capsules {
  display: flex;
  gap: 12px;
}

.speed-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  padding: 8px 16px;
  font-family: var(--font-family-mono);
  font-size: 13px;
  font-weight: 500;
}

.speed-capsule.dl {
  color: var(--accent-cyan);
}

.speed-capsule.ul {
  color: var(--accent-purple);
}

.speed-capsule svg {
  width: 14px;
  height: 14px;
}

/* Glass Panel Main Panel */
.glass-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.panel-header {
  border-bottom: 1px solid var(--border-glass);
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.15);
}

.tab-buttons {
  display: flex;
  gap: 10px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 20px 10px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--accent-cyan);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.panel-body {
  padding: 24px;
}

/* Torrent Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.torrent-table th {
  font-size: 11px;
  font-family: var(--font-family-mono);
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.torrent-table td {
  padding: 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.torrent-table tbody tr:last-child td {
  border-bottom: none;
}

.torrent-name {
  font-weight: 500;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.torrent-size {
  font-family: var(--font-family-mono);
  color: var(--text-secondary);
  white-space: nowrap;
}

.torrent-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.torrent-progress-bar {
  flex-grow: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.torrent-progress-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 3px;
}

.torrent-progress-pct {
  font-family: var(--font-family-mono);
  font-size: 12px;
  width: 36px;
  text-align: right;
}

.torrent-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 11px;
  font-family: var(--font-family-mono);
  font-weight: 600;
  text-transform: uppercase;
}

.status-downloading {
  background: rgba(0, 221, 255, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 221, 255, 0.15);
}

.status-seeding {
  background: rgba(57, 231, 95, 0.08);
  color: var(--accent-green);
  border: 1px solid rgba(57, 231, 95, 0.15);
}

.status-paused {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}

.status-checking {
  background: rgba(255, 123, 0, 0.08);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 123, 0, 0.15);
}

.torrent-speed {
  font-family: var(--font-family-mono);
  font-size: 13px;
  white-space: nowrap;
}

.torrent-peers {
  font-family: var(--font-family-mono);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 0 !important;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 15px;
}

.empty-state p {
  font-size: 14px;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 40px 0 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-glass);
  margin-top: 60px;
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .header-status {
    width: 100%;
    justify-content: flex-start;
  }

  .section-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .speed-capsules {
    width: 100%;
  }

  .speed-capsule {
    flex-grow: 1;
    justify-content: center;
  }
}
