:root {
  --sidebar-width: 250px;
  --header-height: 60px;
  --primary-color: #1877f2;
  --sidebar-bg: #1c1e21;
  --body-bg: #f0f2f5;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--body-bg);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
  font-size: 28px;
  color: var(--primary-color);
}

.sidebar-header span {
  font-size: 18px;
  font-weight: 600;
}

.sidebar-nav {
  padding: 15px 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--primary-color);
  color: #fff;
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.main-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Live Indicator */
.live-indicator {
  display: flex;
  align-items: center;
}

.live-dot {
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
}

.live-dot.disconnected {
  background-color: #ef4444;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.page-content {
  padding: 24px;
}

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Stat Cards */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  color: #666;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: #1c1e21;
}

/* Metric Cards (Insights) */
.metric-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.metric-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.metric-value {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: #1c1e21;
}

/* Cards */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 16px 20px;
}

.card-body {
  padding: 20px;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  font-size: 13px;
  color: #666;
  border-bottom: 2px solid #eee;
  padding: 12px 16px;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* Status Badges */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-active {
  background: #d4edda;
  color: #155724;
}

.badge-paused {
  background: #fff3cd;
  color: #856404;
}

.badge-deleted {
  background: #f8d7da;
  color: #721c24;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: var(--primary-color);
  background: #f8f9ff;
}

.upload-zone i {
  font-size: 48px;
  color: #aaa;
  margin-bottom: 16px;
  display: block;
}

.upload-zone p {
  color: #666;
  margin-bottom: 16px;
}

.upload-zone.dragover {
  border-color: var(--primary-color);
  background: #e8f0fe;
}

/* Action Buttons */
.btn-action {
  padding: 4px 8px;
  font-size: 14px;
}

/* Cursor pointer utility */
.cursor-pointer {
  cursor: pointer;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}

/* Form Styles */
.form-label {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-control, .form-select {
  border-radius: 8px;
  border-color: #ddd;
  padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

/* Modal */
.modal-content {
  border: none;
  border-radius: 12px;
}

.modal-header {
  border-bottom: 1px solid #eee;
  padding: 16px 20px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid #eee;
  padding: 16px 20px;
}

/* Toast */
.toast {
  border-radius: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Utility */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
