/* ==========================================================================
   Design System: Bloomberg / Grafana / Mission-Control Dense Aesthetic
   Calibrated for high-contrast, data-first professional command center.
   ========================================================================== */

:root {
  --bg-main: #07090e;
  --bg-surface: #0c0f16;
  --bg-panel: #111520;
  --bg-active: #171c2c;
  
  --border-dim: #1d2436;
  --border-bright: #2d3853;
  --border-focus: #10b981;
  
  --text-bright: #ffffff;
  --text-main: #cdd9e5;
  --text-muted: #768390;
  --text-disabled: #444c56;
  
  --accent-emerald: #10b981;
  --accent-emerald-dim: #052e21;
  --accent-blue: #38bdf8;
  --accent-blue-dim: #0c4a6e;
  --accent-amber: #fbbf24;
  --accent-amber-dim: #451a03;
  --accent-purple: #c084fc;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-main);
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: "IBM Plex Sans Arabic", "Inter", -apple-system, sans-serif;
  font-size: 13px; /* Dense baseline */
  line-height: 1.6;
  background-image: 
    linear-gradient(rgba(29, 36, 54, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 36, 54, 0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: top center;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.12s ease;
}

a:hover {
  color: var(--accent-emerald);
}

.mono {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  direction: ltr;
  unicode-bidi: isolate;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.top-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-dim);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px; /* Extremely compact */
}

.top-bar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text-bright);
}

.top-bar .logo span.tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  background: var(--accent-emerald-dim);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 4px;
  border-radius: 2px;
  margin-inline-start: 6px;
  font-weight: 500;
}

.top-bar nav {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
}

.top-bar nav a {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  height: 48px;
  border-bottom: 2px solid transparent;
  transition: all 0.12s ease;
}

.top-bar nav a:hover {
  color: var(--text-bright);
}

.top-bar nav a.active {
  color: var(--accent-emerald);
  border-bottom-color: var(--accent-emerald);
}

.btn-submit-header {
  background: var(--accent-emerald);
  color: var(--bg-main);
  border: none;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.1s ease;
}

.btn-submit-header:hover {
  background: #34d399;
}

/* ==========================================================================
   Hero & Metrics Cockpit
   ========================================================================== */
.hero {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border-dim);
  background-color: var(--bg-surface);
}

.hero h1 {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.hero h1 span {
  color: var(--accent-emerald);
}

.hero p.lead {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 900px;
  margin-bottom: 20px;
}

/* Dense Dashboard Stats Table */
.stats-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border-dim);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  overflow: hidden;
}

.stat-cell {
  background: var(--bg-main);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-cell .value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.stat-cell .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}

.stat-cell .value.emerald { color: var(--accent-emerald); }
.stat-cell .value.blue { color: var(--accent-blue); }
.stat-cell .value.amber { color: var(--accent-amber); }
.stat-cell .value.purple { color: var(--accent-purple); }

.stat-cell .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-top: 6px;
}

.stat-cell .ping {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  position: relative;
}

.stat-cell .ping::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  animation: pulse-ring 1.5s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* ==========================================================================
   Search & Filtering Controls
   ========================================================================== */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-dim);
  color: var(--text-bright);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 3px;
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
}

.tabs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 8px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.1s ease;
}

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

.tab-btn.active {
  background: var(--bg-active);
  border-color: var(--border-bright);
  color: var(--accent-emerald);
}

.tab-btn span.badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 2px;
  margin-inline-start: 4px;
  color: var(--text-muted);
}

.tab-btn.active span.badge {
  background: var(--accent-emerald-dim);
  color: var(--accent-emerald);
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
}

.chip-btn:hover {
  color: var(--text-bright);
  border-color: var(--border-bright);
}

.chip-btn.active {
  background: var(--accent-emerald-dim);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

/* ==========================================================================
   Project Grid & Cards
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
  position: relative;
}

.project-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-panel);
}

.project-card.dimmed {
  opacity: 0.18;
  filter: grayscale(0.8);
}

.project-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-dim);
  padding-bottom: 8px;
}

.project-card .proj-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-bright);
  line-height: 1.35;
}

.project-card h3 a {
  color: var(--text-bright);
}

.project-card h3 a:hover {
  color: var(--accent-emerald);
}

.project-card .desc {
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.project-card .benefit-box {
  background: var(--bg-main);
  border-left: 2px solid var(--accent-emerald);
  padding: 8px 12px;
  font-size: 0.78rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.project-card .benefit-box strong {
  display: block;
  font-size: 9px;
  color: var(--accent-emerald);
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.project-card .author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.78rem;
}

.project-card .author-row span.label {
  color: var(--text-disabled);
}

.project-card .author-row span.name {
  font-weight: 600;
  color: var(--text-main);
}

.project-card .caps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.project-card .cap-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  padding: 1px 6px;
  background: rgba(56, 189, 248, 0.05);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 2px;
}

/* ==========================================================================
   Modals & Forms
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform 0.15s ease;
}

.modal.open .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 10px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-bright);
}

.form-group {
  margin-bottom: 14px;
}

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

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-dim);
  color: var(--text-bright);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  border-radius: 3px;
  outline: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-emerald);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-dim);
  background: var(--bg-main);
  border-radius: 3px;
  padding: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-item input {
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.form-submit-btn {
  width: 100%;
  background: var(--accent-emerald);
  color: var(--bg-main);
  font-weight: 700;
  padding: 10px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background-color 0.1s ease;
  margin-top: 10px;
}

.form-submit-btn:hover {
  background: #34d399;
}

/* ==========================================================================
   Toasts & Informational blocks
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--accent-emerald);
  border-radius: 4px;
  padding: 12px 20px;
  color: var(--text-bright);
  font-size: 0.82rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.section-band {
  padding: 32px 0;
  border-bottom: 1px solid var(--border-dim);
}

.info-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.info-step {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 18px;
}

.info-step .step-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-emerald);
  background: var(--accent-emerald-dim);
  border: 1px solid rgba(16, 185, 129, 0.3);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  margin-bottom: 10px;
}

.info-step h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-bright);
}

.info-step p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  padding: 24px 0;
  text-align: center;
  color: var(--text-disabled);
  font-size: 0.76rem;
  border-top: 1px solid var(--border-dim);
}

footer code {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ==========================================================================
   Responsive rules
   ========================================================================== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
