:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a1f2e;
  --bg-glass: rgba(17, 24, 39, 0.7);
  
  --accent-cyan: #00d4ff;
  --accent-blue: #3b82f6;
  --accent-orange: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(59, 130, 246, 0.2);
  --border-glow: rgba(0, 212, 255, 0.3);
  
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', -apple-system, sans-serif;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

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

/* Grid Background */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Glass Panel */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

/* Auth Screen */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 48px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-logo {
  margin-bottom: 40px;
}

.logo-icon {
  font-size: 48px;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

.auth-logo h1 {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  letter-spacing: 2px;
  opacity: 0.7;
}

/* Inputs */
.input-group {
  margin-bottom: 24px;
  text-align: left;
}

.input-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.cyber-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(10, 14, 26, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.cyber-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), 0 0 20px rgba(0, 212, 255, 0.2);
}

.cyber-input::placeholder {
  color: var(--text-muted);
}

.input-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Buttons */
.cyber-btn {
  position: relative;
  padding: 14px 32px;
  background: transparent;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
}

.cyber-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
  transform: translateY(-1px);
}

.cyber-btn.primary {
  width: 100%;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(59, 130, 246, 0.2));
}

.cyber-btn.small {
  padding: 8px 16px;
  font-size: 11px;
}

.btn-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cyber-btn:hover .btn-glow {
  opacity: 1;
}

/* Auth Footer */
.auth-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Dashboard */
.dashboard {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(10, 14, 26, 0.95);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-small {
  font-size: 24px;
  color: var(--accent-cyan);
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-cyan);
  border-left: 2px solid var(--accent-cyan);
}

.nav-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  background: rgba(0, 212, 255, 0.2);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
}

/* System Stats */
.system-stats {
  padding: 0 12px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  width: 30px;
}

.stat-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  width: 40px;
  text-align: right;
}

.stat-value.status-ok {
  color: var(--accent-green);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--bg-primary);
}

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* View */
.view {
  display: none;
  flex-direction: column;
  height: 100%;
}

.view.active {
  display: flex;
}

/* View Header */
.view-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.view-title {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-icon {
  color: var(--accent-cyan);
}

.session-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  background: rgba(0, 212, 255, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.1);
}

/* Chat */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Messages */
.message {
  max-width: 80%;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  position: relative;
  animation: messageIn 0.3s ease;
}

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

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message.system-message {
  align-self: center;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  max-width: 60%;
  text-align: center;
}

.message-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-time {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}

.message.assistant .message-time {
  text-align: left;
}

/* Chat Input */
.chat-input-area {
  padding: 20px 32px;
  border-top: 1px solid var(--border-color);
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
}

.cyber-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 200px;
  min-height: 24px;
  line-height: 1.5;
}

.cyber-textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.send-btn:active {
  transform: scale(0.95);
}

.input-hints {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding: 0 4px;
}

.hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Sessions Grid */
.sessions-grid {
  padding: 24px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  overflow-y: auto;
}

.session-card {
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.session-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.1);
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.session-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.session-card-agent {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  padding: 2px 8px;
  background: rgba(0, 212, 255, 0.1);
  border-radius: 4px;
}

.session-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Agents Grid */
.agents-grid {
  padding: 24px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  overflow-y: auto;
}

.agent-card {
  padding: 24px;
  transition: all 0.3s ease;
}

.agent-card:hover {
  border-color: var(--accent-cyan);
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  color: var(--bg-primary);
}

.agent-avatar.main {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
}

.agent-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.agent-model {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.agent-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.agent-status.active {
  color: var(--accent-green);
}

.agent-stats {
  display: flex;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.agent-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Settings */
.settings-content {
  padding: 24px 32px;
  overflow-y: auto;
}

.settings-card {
  padding: 24px;
  margin-bottom: 16px;
}

.settings-card h3 {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.setting-item {
  margin-bottom: 16px;
}

.setting-item label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.api-key-display {
  display: flex;
  gap: 12px;
}

.api-key-display input {
  flex: 1;
}

.cyber-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(10, 14, 26, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.cyber-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  
  .logo-text,
  .nav-text,
  .nav-label,
  .system-stats,
  .user-details {
    display: none;
  }
  
  .sidebar-header {
    justify-content: center;
  }
  
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  
  .nav-icon {
    width: auto;
  }
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
