:root {
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-input: #1f2937;
  --border: #374151;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --radius: 10px;
  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-ar);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glass & Card Effects */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Header & Top Bar */
header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-badge {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.server-pills {
  display: flex;
  gap: 10px;
}

.pill {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* Tab Navigation */
.tabs-nav {
  display: flex;
  gap: 8px;
  background: #0f172a;
  padding: 0.5rem 2rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--primary);
}

/* Container */
main.container {
  max-width: 1400px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.tab-pane {
  display: none;
}

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

/* Buttons & Inputs */
button.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s;
}

button.btn-primary:hover {
  background: var(--primary-hover);
}

button.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

button.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Chat Layout */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 650px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-start;
  background: #1e3a8a;
  color: #f0fdf4;
  border-bottom-left-radius: 2px;
}

.chat-bubble.assistant {
  align-self: flex-end;
  background: #1f2937;
  border: 1px solid #374151;
  border-bottom-right-radius: 2px;
}

.chat-bubble .tool-badge {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-top: 8px;
  display: inline-block;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: #0f172a;
}

/* Terminal */
.terminal-window {
  background: #050811;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  direction: ltr;
  text-align: left;
  height: 480px;
  overflow-y: auto;
  color: #10b981;
}

.terminal-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  direction: ltr;
}

.terminal-prompt span {
  color: #3b82f6;
  font-weight: bold;
}

/* File Explorer */
.file-manager {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: 650px;
}

.file-tree {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.9rem;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-item.active {
  background: rgba(6, 182, 212, 0.2);
  color: var(--primary);
}

.file-editor-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.editor-toolbar {
  padding: 10px 16px;
  background: #0f172a;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.code-editor {
  flex: 1;
  background: #050811;
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 1rem;
  border: none;
  resize: none;
  direction: ltr;
  text-align: left;
  line-height: 1.5;
}

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

.gauge-bar-bg {
  background: var(--bg-input);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin: 10px 0;
}

.gauge-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

/* Tables */
table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th, table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-size: 0.9rem;
}

table.data-table th {
  background: #0f172a;
  color: var(--text-muted);
}

table.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Login Modal / Page */
.login-wrapper {
  max-width: 440px;
  margin: 80px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.alert-box {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent);
  color: #6ee7b7;
}
