@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@400;600;700&display=swap');

:root {
  /* ======================================================== */
  /* LIGHT THEME (فاتحة مريحة وعصرية - الافتراضي) */
  /* ======================================================== */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-glow: rgba(37, 99, 235, 0.25);

  --accent-blue: #2563eb;
  --accent-blue-light: #eff6ff;
  --accent-cyan: #0284c7;
  --accent-cyan-light: #f0f9ff;
  --accent-emerald: #059669;
  --accent-emerald-light: #ecfdf5;
  --accent-purple: #7c3aed;
  --accent-purple-light: #f5f3ff;
  --accent-amber: #d97706;
  --accent-amber-light: #fffbeb;
  --accent-rose: #e11d48;
  --accent-rose-light: #fff1f2;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  /* Terminal Console (Dark contrast for developer clarity) */
  --terminal-bg: #0b1120;
  --terminal-header: #1e293b;
  --terminal-text: #f8fafc;
  --terminal-green: #22c55e;
  --terminal-cyan: #38bdf8;
  --terminal-amber: #fbbf24;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================================================== */
/* DARK THEME (اختياري عند التبديل) */
/* ======================================================== */
[data-theme="dark"] {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #111827;
  --bg-card-hover: #1e293b;
  --border-color: rgba(255, 255, 255, 0.09);
  --border-glow: rgba(59, 130, 246, 0.35);

  --accent-blue-light: rgba(37, 99, 235, 0.15);
  --accent-emerald-light: rgba(5, 150, 105, 0.15);
  --accent-purple-light: rgba(124, 58, 237, 0.15);
  --accent-amber-light: rgba(217, 119, 6, 0.15);
  --accent-rose-light: rgba(225, 29, 72, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --terminal-bg: #030712;
  --terminal-header: #0f172a;
  --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Cairo', 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(124, 58, 237, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #334155;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navigation Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-logo svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
}

.status-dot.offline {
  background-color: var(--accent-rose);
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.theme-toggle-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
}
.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

/* Main Navigation Tabs Bar (Desktop) */
.main-tabs-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 1.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main-tabs-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.tab-btn.active {
  color: var(--accent-blue);
  background: var(--accent-blue-light);
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}
[data-theme="dark"] .tab-btn.active {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(59, 130, 246, 0.4);
}

/* Content Area */
.content-wrapper {
  padding: 1.5rem 1.75rem;
  flex: 1;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* Tab Panels */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: tabFadeIn 0.25s ease;
}

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

/* Compact Quick Stats Strip */
.quick-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.stat-pill:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.stat-data {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: 'Outfit', 'Cairo', sans-serif;
  line-height: 1;
}

.stat-lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-pill.online-pill {
  border-color: rgba(5, 150, 105, 0.3);
  background: linear-gradient(135deg, var(--bg-card), rgba(5, 150, 105, 0.05));
}

.stat-dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.7);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}
.section-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.section-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  min-height: 38px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}
.btn-emerald:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.btn-outline {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  min-height: 32px;
}

/* Filters & Search */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 0.55rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  transition: var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cat-chip {
  padding: 0.45rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  user-select: none;
}
.cat-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}
.cat-chip.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.15rem;
}

.data-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.data-card:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: var(--shadow-hover);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}
.card-badge.rdp { background: var(--accent-blue-light); color: var(--accent-blue); }
.card-badge.hardening { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.card-badge.winrm { background: var(--accent-purple-light); color: var(--accent-purple); }
.card-badge.screen { background: var(--accent-amber-light); color: var(--accent-amber); }
.card-badge.network { background: var(--accent-cyan-light); color: var(--accent-cyan); }
.card-badge.custom { background: #f1f5f9; color: #475569; }

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.device-props {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prop-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-main);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  gap: 0.4rem;
}

/* ======================================================== */
/* EXECUTION HUB & LIVE TERMINAL (الشاشة الرئيسية) */
/* ======================================================== */
.hub-control-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.6rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.hub-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.hub-header-title h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}
.hub-header-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.hub-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1rem;
}

.device-quick-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  float: left;
  font-weight: 600;
  transition: var(--transition);
}
.device-quick-badge.online {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  border-color: rgba(5, 150, 105, 0.35);
  font-weight: 700;
}
.device-quick-badge.offline {
  background: var(--accent-rose-light);
  color: var(--accent-rose);
  border-color: rgba(225, 29, 72, 0.35);
}

.text-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  float: left;
  font-weight: normal;
}

/* 1-Tap Quick Action Presets */
.presets-section {
  margin-bottom: 1.15rem;
  background: var(--bg-primary);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.6rem;
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.preset-chip:hover {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

.preset-chip:active {
  transform: scale(0.96);
}

/* Custom Script Code Area */
.hub-code-group {
  margin-bottom: 1.15rem;
}

.code-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.code-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.badge-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.btn-text-action {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-text-action:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
  background: var(--bg-card-hover);
}

.terminal-font {
  font-family: 'JetBrains Mono', monospace !important;
  direction: ltr !important;
  text-align: left !important;
  background: #0f172a !important;
  color: #38bdf8 !important;
  border-color: #334155 !important;
  font-size: 0.88rem !important;
  line-height: 1.55;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.terminal-font:focus {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Execute Button */
.hub-action-row {
  display: flex;
}

.btn-execute {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-execute:hover {
  box-shadow: 0 6px 22px rgba(5, 150, 105, 0.45);
  transform: translateY(-2px);
}

.btn-execute:active {
  transform: translateY(0);
}

.btn-execute.loading {
  opacity: 0.85;
  pointer-events: none;
  background: #047857;
}

/* Terminal Console (In the same page right below) */
.terminal-container {
  background: var(--terminal-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-header {
  background: var(--terminal-header);
  padding: 0.75rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 0.6rem;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #94a3b8;
}

.terminal-dots {
  display: flex;
  gap: 0.35rem;
}
.t-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.t-dot.red { background: #ef4444; }
.t-dot.yellow { background: #f59e0b; }
.t-dot.green { background: #10b981; }

.term-status-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
}
.term-status-pill.idle {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.term-status-pill.running {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  animation: pulseDot 1s infinite;
}

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-term-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-term-action:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.terminal-body {
  padding: 1.15rem 1.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  color: #e2e8f0;
  min-height: 250px;
  max-height: 460px;
  overflow-y: auto;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
  background-color: var(--terminal-bg);
}

.terminal-body .term-line-info { color: var(--terminal-cyan); }
.terminal-body .term-line-success { color: var(--terminal-green); }
.terminal-body .term-line-warn { color: var(--terminal-amber); }
.terminal-body .term-line-error { color: #f87171; }

/* History Table */
.data-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.85rem;
  min-width: 600px;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 700;
}
.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.status-badge.pending { background: var(--accent-amber-light); color: var(--accent-amber); }
.status-badge.running { background: var(--accent-blue-light); color: var(--accent-blue); }
.status-badge.success { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.status-badge.failed { background: var(--accent-rose-light); color: var(--accent-rose); }

/* Guide Card */
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.guide-card h3 {
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.guide-step {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.code-box {
  background: #0f172a;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #38bdf8;
  margin-top: 0.4rem;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-modal);
  position: relative;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}
.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.25rem;
}
.modal-close:hover {
  color: var(--accent-rose);
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}
.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: var(--bg-secondary);
}
textarea.form-control {
  font-family: 'JetBrains Mono', monospace;
  direction: ltr;
  text-align: left;
  min-height: 110px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast {
  background: var(--text-main);
  color: var(--bg-secondary);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideToast 0.25s ease;
}
@keyframes slideToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); }
}

/* Mobile Bottom Navigation Bar (Hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

/* ======================================================== */
/* 📱 MOBILE RESPONSIVENESS & TOUCH OPTIMIZATION (عرض الموبايل) */
/* ======================================================== */
@media (max-width: 768px) {
  /* Reserve space for fixed bottom navigation */
  .app-container {
    padding-bottom: 74px;
  }

  /* Top Nav */
  .top-nav {
    padding: 0.65rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .brand-section {
    gap: 0.55rem;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .brand-logo svg {
    width: 17px;
    height: 17px;
  }
  .brand-text h1 {
    font-size: 0.95rem;
  }
  .brand-text span {
    display: none;
  }

  .header-status-group {
    gap: 0.4rem;
  }
  .header-quick-btn {
    display: none;
  }
  .status-pill {
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
  }
  .status-pill span:not(.status-dot) {
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide Desktop Tabs on Mobile */
  .main-tabs-bar {
    display: none;
  }

  /* Smart Mobile Bottom Navigation Bar (شريط سفلي ثابت احترافي وسريع) */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.25rem;
  }
  [data-theme="dark"] .mobile-bottom-nav {
    background: rgba(17, 24, 39, 0.95);
    border-top-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .b-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.35rem 0;
    gap: 0.2rem;
    transition: var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .b-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .b-nav-text {
    font-family: 'Cairo', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
  }
  .b-nav-item.active {
    color: var(--accent-blue);
  }
  .b-nav-item.active .b-nav-icon {
    transform: scale(1.15) translateY(-2px);
  }

  /* Content Wrapper */
  .content-wrapper {
    padding: 0.85rem 0.75rem;
  }

  /* Compact Quick Stats Strip on Mobile (2 Columns) */
  .quick-stats-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .stat-pill {
    padding: 0.55rem 0.7rem;
    gap: 0.55rem;
    border-radius: var(--radius-sm);
  }
  .stat-icon {
    font-size: 1.15rem;
  }
  .stat-num {
    font-size: 1.05rem;
  }
  .stat-lbl {
    font-size: 0.72rem;
  }

  /* Hub Control Card on Mobile */
  .hub-control-card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }
  .hub-card-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
  }
  .hub-header-title h2 {
    font-size: 1.1rem;
  }
  .hub-header-title p {
    font-size: 0.75rem;
  }
  .hub-select-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* Presets Chips Horizontal Touch Scrolling */
  .presets-section {
    padding: 0.65rem 0.75rem;
    margin-bottom: 1rem;
  }
  .presets-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .presets-chips::-webkit-scrollbar {
    display: none;
  }
  .preset-chip {
    flex-shrink: 0;
    font-size: 0.76rem;
    padding: 0.35rem 0.75rem;
  }

  /* Execute Button on Mobile */
  .btn-execute {
    font-size: 0.98rem;
    padding: 0.75rem 1rem;
    min-height: 46px;
  }

  /* Cards Grid: 1 Full Column on Mobile */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .data-card {
    padding: 1rem;
  }

  /* Filter Bar on Mobile */
  .filter-bar {
    gap: 0.4rem;
  }
  .search-input {
    min-width: 100%;
    order: -1;
    font-size: 16px;
  }
  .cat-chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
  }

  /* Mobile Bottom Sheet Style for Modals */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    max-height: 85vh;
    padding: 1.25rem 1rem;
    animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .form-control {
    font-size: 16px;
  }

  /* Terminal on Mobile */
  .terminal-container {
    margin-top: 1rem;
    border-radius: var(--radius-md);
  }
  .terminal-header {
    padding: 0.65rem 0.85rem;
  }
  .terminal-body {
    min-height: 220px;
    max-height: 380px;
    font-size: 0.76rem;
    padding: 0.85rem;
  }

  /* Toasts */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 4.8rem;
  }
  .toast {
    width: 100%;
    justify-content: center;
  }
}
