/* DIGIT Workflow Explorer — Styles */

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

:root {
  --digit-orange: #F47738;
  --digit-orange-dark: #d4621e;
  --sidebar-bg: #1A1A2E;
  --sidebar-text: #e0e0e0;
  --sidebar-hover: #16213E;
  --sidebar-active: #0F3460;
  --card-border: #2a2a4a;
  --header-height: 56px;
  --sidebar-width: 300px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
  background: #0a0a1a;
  color: #fff;
}

/* ─── Header ─────────────────────────────────────────────────────── */

.header {
  height: var(--header-height);
  background: var(--digit-orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
  position: relative;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
}

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

.tenant-select {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}

.tenant-select:focus {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.25);
}

.tenant-select option {
  background: var(--sidebar-bg);
  color: #fff;
}

/* ─── Layout ─────────────────────────────────────────────────────── */

.layout {
  display: flex;
  height: calc(100vh - var(--header-height));
}

/* ─── Sidebar ────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  overflow-y: auto;
  padding: 12px;
}

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  padding: 8px 12px 12px;
}

.workflow-card {
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

.workflow-card:hover {
  background: var(--sidebar-hover);
  border-color: var(--card-border);
}

.workflow-card.active {
  background: var(--sidebar-active);
  border-color: var(--digit-orange);
}

.workflow-card .name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.workflow-card .module {
  font-size: 12px;
  color: #999;
  margin-bottom: 6px;
}

.workflow-card .meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #777;
}

.workflow-card .meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Main Area ──────────────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16161a;
  position: relative;
}

.main iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ─── Empty State ────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  color: #555;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h2 {
  font-size: 18px;
  font-weight: 500;
  color: #777;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: #555;
}

/* ─── Loading State ──────────────────────────────────────────────── */

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(22, 22, 26, 0.92);
  z-index: 5;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: var(--digit-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

.loading-overlay p {
  font-size: 13px;
  color: #999;
}

/* ─── Sidebar Loading ────────────────────────────────────────────── */

.sidebar-loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 13px;
}

.sidebar-loading .spinner {
  margin: 0 auto 12px;
  width: 24px;
  height: 24px;
}

.sidebar-error {
  padding: 16px;
  color: #e74c3c;
  font-size: 13px;
  text-align: center;
}

.sidebar-error button {
  margin-top: 8px;
  background: var(--digit-orange);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
}

.sidebar-error button:hover {
  background: var(--digit-orange-dark);
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #444;
}

.hidden {
  display: none !important;
}
