/* DBIS Operator Console — Shared Styles */
:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #334155;
  --bg-sidebar: #1e293b;
  --border: #475569;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 6px;
  --sidebar-w: 220px;
}

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

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

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
}
.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.03em;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar-nav a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(59,130,246,0.08);
  border-left-color: var(--accent);
}
.sidebar-nav a .icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-nav a .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.sidebar-footer .user-name { color: var(--text); font-weight: 500; }
.sidebar-footer .user-role {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
}
.sidebar-footer button {
  margin-top: 8px;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 4px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
  width: 100%;
}
.sidebar-footer button:hover { color: var(--text); border-color: var(--text-muted); }

.admin-only { display: none; }
body.role-admin .admin-only { display: flex; }

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  padding: 24px 32px;
  min-height: 100vh;
}

/* Header bar */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-header .actions { display: flex; gap: 8px; align-items: center; }

/* Cards */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-header h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Metric boxes */
.metrics-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.metric-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 160px;
  flex: 1;
}
.metric-box .value { font-size: 28px; font-weight: 700; }
.metric-box .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.metric-box.success .value { color: var(--success); }
.metric-box.warning .value { color: var(--warning); }
.metric-box.danger .value { color: var(--danger); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 13px; }
th {
  color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px;
  border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid rgba(71,85,105,0.4); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 4px;
  font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 3px; font-size: 11px;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-open { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-acknowledged { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-resolved { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-sent { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-skipped { background: rgba(100,116,139,0.15); color: var(--text-dim); }
.badge-admin { background: var(--accent); color: #fff; }
.badge-support { background: var(--info); color: #fff; }
.badge-online { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-offline { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-unknown { background: rgba(100,116,139,0.15); color: var(--text-dim); }

/* Forms / Inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], textarea, select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

/* Search bar */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.search-bar input { flex: 1; }

/* Detail panel */
.detail-panel {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.detail-row {
  display: flex; gap: 20px; margin-bottom: 8px; font-size: 13px;
}
.detail-row .label { color: var(--text-muted); min-width: 140px; }
.detail-row .value { color: var(--text); }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-dim); font-size: 14px;
}

/* Login page (no sidebar) */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  width: 100%; max-width: 400px;
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-box label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.login-box input { margin-bottom: 16px; }
.login-box .btn { width: 100%; justify-content: center; padding: 10px; }
.login-error {
  background: rgba(239,68,68,0.1); border: 1px solid var(--danger);
  color: var(--danger); padding: 8px 12px; border-radius: 4px;
  font-size: 13px; margin-bottom: 16px; display: none;
}

/* Spinner */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 100;
  justify-content: center; align-items: center;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px; width: 100%; max-width: 520px;
}
.modal h3 { margin-bottom: 16px; }
.modal textarea { min-height: 100px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Timeline */
.timeline-item {
  display: flex; gap: 12px; padding: 8px 0; font-size: 13px;
  border-bottom: 1px solid rgba(71,85,105,0.3);
}
.timeline-item .time { color: var(--text-dim); min-width: 140px; white-space: nowrap; }
.timeline-item .event { flex: 1; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .metrics-row { flex-direction: column; }
}

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
