/* Orchid Agent Orchestrator - Dark Theme CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(20, 28, 46, 0.75);
  --bg-card-hover: rgba(28, 38, 62, 0.85);
  --bg-input: #1a2336;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --accent-primary: #6366f1; /* Indigo */
  --accent-success: #10b981; /* Emerald */
  --accent-warning: #f59e0b; /* Amber */
  --accent-danger: #ef4444;  /* Red */
  --accent-pink: #ec4899;    /* Pink */
  --accent-cyan: #06b6d4;    /* Cyan */
  
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #273249;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Glassmorphism containers */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.2s ease-in-out;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Login Modal Overlay */
#login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  width: 400px;
  padding: 40px;
  text-align: center;
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* Layout App Structure */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* Sidebar */
sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.brand-icon {
  font-size: 28px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #818cf8, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.15));
  color: #a5b4fc;
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-glow);
}

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

/* Main Content Wrapper */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08), transparent 70%);
}

.top-bar {
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(8px);
}

.top-title {
  font-size: 18px;
  font-weight: 600;
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Metrics Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.metric-sub {
  font-size: 12px;
  color: var(--accent-success);
}

/* Tables & Badges */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active { background: rgba(16, 185, 129, 0.2); color: var(--accent-success); border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-idle { background: rgba(99, 102, 241, 0.2); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.4); }
.badge-busy { background: rgba(245, 158, 11, 0.2); color: var(--accent-warning); border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: var(--accent-danger); border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-offline { background: rgba(107, 114, 128, 0.2); color: var(--text-dim); border: 1px solid rgba(107, 114, 128, 0.4); }

.badge-proto {
  background: rgba(236, 72, 153, 0.15);
  color: var(--accent-pink);
  border: 1px solid rgba(236, 72, 153, 0.3);
  font-family: var(--font-mono);
}

/* Forms & Buttons */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

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

.btn-secondary:hover {
  background: #273249;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
}

/* Chat Console Playground */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.chat-bubble.agent {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.chat-input-bar {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.8);
}

/* Grid Layout for Agent Store */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.store-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

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

.store-avatar {
  font-size: 32px;
}

.store-title {
  font-size: 18px;
  font-weight: 600;
}

.store-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Code block / JSON log viewer */
pre.json-viewer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #a5b4fc;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
}

/* Output Console & Prompt Result Animations */
@keyframes resultPulse {
  0% {
    opacity: 0.3;
    transform: translateY(8px) scale(0.99);
    box-shadow: 0 0 0 rgba(99, 102, 241, 0);
    border-color: var(--accent-primary);
  }
  40% {
    opacity: 1;
    box-shadow: 0 0 28px rgba(99, 102, 241, 0.45);
    border-color: #818cf8;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.15);
  }
}

.output-console {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-main);
  max-height: 500px;
  overflow-y: auto;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.output-console.result-animated,
.result-animated {
  animation: resultPulse 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* NorTK Main Dashboard & Apps Grid Styling */
.nortk-brand-img {
  max-height: 42px;
  object-fit: contain;
}

.system-prompt-bar {
  background: linear-gradient(135deg, rgba(20, 28, 46, 0.9), rgba(99, 102, 241, 0.15));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.system-prompt-input-wrapper {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

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

.app-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.app-title {
  font-size: 16px;
  font-weight: 600;
}

.app-category {
  font-size: 11px;
  color: var(--text-muted);
}

.app-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Notification Drawer Modal */
.notif-drawer {
  display: none;
  position: fixed;
  top: 70px;
  right: 24px;
  width: 380px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  z-index: 999;
  padding: 20px;
}

.notif-item {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

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

