/* ═══════════════════════════════════════
   OceanOS Dashboard — Blue & Black Theme
   ═══════════════════════════════════════ */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1729;
  --bg-card: #131b2e;
  --bg-card-hover: #182240;
  --bg-sidebar: #080c16;
  --border: #1e2a45;
  --border-light: #253352;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-600: #2563eb;
  --blue-900: #1e3a5f;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --teal-500: #14b8a6;
  --orange-500: #f97316;
  --red-500: #ef4444;
  --red-400: #f87171;
  --yellow-500: #eab308;
  --purple-500: #a855f7;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-500); }

/* ═══ SIDEBAR ═══ */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

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

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

.logo-text {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue-400), var(--teal-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--blue-500);
  color: white;
  border-radius: 20px;
  letter-spacing: 1px;
}

.nav-section {
  padding: 12px 12px 0;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  display: block;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
}

.nav-item.active {
  color: var(--blue-400);
  background: rgba(59, 130, 246, 0.12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--blue-500);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-bottom: 16px;
  border-top: 1px solid var(--border);
}

.notif-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--red-500);
  color: white;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ═══ TOPBAR ═══ */
#topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

#page-title {
  font-size: 18px;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: rgba(59,130,246,0.1);
  border-color: var(--blue-500);
  color: var(--blue-400);
}

.bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--red-500);
  color: white;
  border-radius: 10px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-400);
  letter-spacing: 1px;
}

.pulse-dot {
  width: 8px; height: 8px;
  background: var(--green-500);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

.topbar-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

/* ═══ MAIN CONTENT ═══ */
#main-content {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

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

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

.stat-grid.small {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
}

.stat-card.blue::before { background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--green-500), var(--green-400)); }
.stat-card.teal::before { background: linear-gradient(90deg, var(--teal-500), #2dd4bf); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--orange-500), #fb923c); }
.stat-card.red::before { background: linear-gradient(90deg, var(--red-500), var(--red-400)); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple-500), #c084fc); }

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.stat-card.blue .stat-icon { background: rgba(59,130,246,0.12); color: var(--blue-400); }
.stat-card.green .stat-icon { background: rgba(34,197,94,0.12); color: var(--green-400); }
.stat-card.teal .stat-icon { background: rgba(20,184,166,0.12); color: var(--teal-500); }
.stat-card.orange .stat-icon { background: rgba(249,115,22,0.12); color: var(--orange-500); }
.stat-card.red .stat-icon { background: rgba(239,68,68,0.12); color: var(--red-400); }

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

.stat-number {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-card-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all var(--transition);
}

.stat-card-sm:hover {
  border-color: var(--blue-500);
  transform: translateY(-1px);
}

.stat-sm-val {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-400);
}

.stat-sm-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══ CHART CARDS ═══ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-card.full-width {
  margin-bottom: 20px;
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* ═══ SYSTEM STATUS ═══ */
.system-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.status-item:last-child { border-bottom: none; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: var(--green-500); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.status-dot.yellow { background: var(--yellow-500); box-shadow: 0 0 8px rgba(234,179,8,0.5); }
.status-dot.red { background: var(--red-500); box-shadow: 0 0 8px rgba(239,68,68,0.5); }

.status-val {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══ ACTIVITY FEED ═══ */
.activity-feed {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.activity-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.activity-icon.info { background: rgba(59,130,246,0.15); }
.activity-icon.warning { background: rgba(249,115,22,0.15); }
.activity-icon.danger { background: rgba(239,68,68,0.15); }
.activity-icon.success { background: rgba(34,197,94,0.15); }

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.activity-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* ═══ DATA TABLES ═══ */
.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(59,130,246,0.04);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag.danger { background: rgba(239,68,68,0.15); color: var(--red-400); }
.tag.warning { background: rgba(249,115,22,0.15); color: var(--orange-500); }
.tag.info { background: rgba(59,130,246,0.15); color: var(--blue-400); }
.tag.success { background: rgba(34,197,94,0.15); color: var(--green-400); }

/* ═══ GEMINI AI ═══ */
.gemini-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.gemini-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.gemini-panel h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.gemini-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.upload-area:hover {
  border-color: var(--blue-500);
  background: rgba(59,130,246,0.04);
}

#gemini-preview {
  text-align: center;
  margin-top: 16px;
}

#gemini-img-preview {
  max-width: 100%;
  max-height: 250px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.gemini-result {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}

.gemini-result .result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.gemini-result .result-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.gemini-result .result-row:last-child { border-bottom: none; }

.gemini-result .result-key { color: var(--text-muted); }
.gemini-result .result-val { color: var(--text-primary); font-weight: 500; }

.gemini-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  color: var(--text-secondary);
}

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Chat */
.chat-container {
  height: 350px;
  overflow-y: auto;
  padding: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  margin-bottom: 12px;
}

.chat-message {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  animation: fadeIn 0.3s ease;
}

.chat-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-message.bot .chat-avatar { background: var(--blue-500); color: white; }
.chat-message.user .chat-avatar { background: var(--teal-500); color: white; }

.chat-bubble {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 85%;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.chat-input-row input:focus { border-color: var(--blue-500); }

/* ═══ NOTIFICATIONS ═══ */
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.notif-header h3 { font-size: 18px; }

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.notif-item:hover {
  border-color: var(--border-light);
  transform: translateX(4px);
}

.notif-item.unread {
  border-left: 3px solid var(--blue-500);
}

.notif-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.notif-dot.danger { background: rgba(239,68,68,0.12); }
.notif-dot.warning { background: rgba(249,115,22,0.12); }
.notif-dot.info { background: rgba(59,130,246,0.12); }

.notif-content { flex: 1; }

.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.notif-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.notif-source {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ═══ BUTTONS ═══ */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: var(--blue-500);
  color: white;
}

.btn-primary:hover {
  background: var(--blue-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(59,130,246,0.08);
  border-color: var(--blue-500);
  color: var(--blue-400);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) {
  .charts-row { grid-template-columns: 1fr; }
  .gemini-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid.small { grid-template-columns: 1fr 1fr 1fr; }
}

/* ═══ CHART.JS THEME ═══ */
canvas {
  max-height: 280px;
}
