/* GilGamez Messenger — Command Center Stylesheet
 * Strict Anti-Slop, Glassmorphism, Tabular Numerals & 4-Viewport Responsive Grid
 */

:root {
  --bg-primary: #0a0d14;
  --bg-surface: #121824;
  --bg-card: #182234;
  --bg-card-hover: #1f2c42;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(0, 229, 255, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #00e5ff;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* App Layout Grid */
.cmc-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.cmc-sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  justify-content: space-between;
}

.cmc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(0, 229, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.cmc-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.nav-item.active {
  background-color: rgba(0, 229, 255, 0.08);
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.25);
  font-weight: 600;
}

.sidebar-status-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.status-indicator-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.status-ping-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-text {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.version-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.cmc-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-primary);
}

.cmc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(18, 24, 36, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  gap: 12px;
}

.metric-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
}

.pill-label {
  color: var(--text-muted);
}

.pill-value {
  color: var(--text-primary);
  font-weight: 500;
}

.pill-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.cmc-content {
  padding: 32px;
  flex-grow: 1;
  overflow-y: auto;
}

/* Panels */
.cmc-panel {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.cmc-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-footer {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-emerald {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-cyan {
  background-color: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
}

.badge-amber {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-rose {
  background-color: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

/* Sections & Tables */
.section-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.cmc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cmc-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.cmc-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}

.cmc-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.cmc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.cmc-btn:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-light);
}

.cmc-btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

.cmc-btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.5);
}

/* User Avatar & Info */
.user-info-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-cyan);
  border: 1px solid var(--border-subtle);
}

.user-names {
  display: flex;
  flex-direction: column;
}

.user-display-name {
  font-weight: 600;
  color: var(--text-primary);
}

.user-uid-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Breakpoint 1: 360px viewport */
@media (max-width: 480px) {
  .cmc-layout {
    flex-direction: column;
  }
  .cmc-sidebar {
    width: 100%;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .cmc-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav-item {
    white-space: nowrap;
    padding: 8px 12px;
  }
  .sidebar-status-box {
    display: none;
  }
  .cmc-topbar {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .cmc-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .section-card {
    padding: 16px;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Breakpoint 2: 768px tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .cmc-sidebar {
    width: 220px;
    padding: 20px 12px;
  }
  .cmc-topbar {
    padding: 16px 24px;
  }
  .cmc-content {
    padding: 24px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Breakpoint 3: 1280px standard */
@media (min-width: 769px) and (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Breakpoint 4: 1920px widescreen */
@media (min-width: 1281px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .cmc-content {
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
  }
}
