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

:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface2: #1e2435;
  --border: #2a3045;
  --text: #e8eaf0;
  --text-muted: #6b7394;
  --text-dim: #8e96b8;
  --accent: #4ade80;
  --accent-glow: rgba(74, 222, 128, 0.15);
  --red: #f87171;
  --red-glow: rgba(248, 113, 113, 0.15);
  --amber: #fbbf24;
  --amber-glow: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --revit-purple: #9b8afa;
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  padding: 0;
}

/* HEADER */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #4ade80 0%, #22d3ee 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 13px;
  color: #0f1117;
  letter-spacing: -0.5px;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

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

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.live-label {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.5px;
}

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

/* STATS BAR */
.stats-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
  display: flex;
  gap: 0;
  justify-content: center;
}

.stat-item {
  padding: 16px 28px;
  border-left: 1px solid var(--border);
  margin-left: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.stat-item:last-child { border-left: none; margin-left: 0; padding-right: 0; }
.stat-item:first-child { padding-right: 28px; margin-left: 0; border-left: none; }

.stat-val {
  font-size: 26px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
}

.stat-val.green { color: var(--accent); }
.stat-val.red { color: var(--red); }
.stat-val.amber { color: var(--amber); }
.stat-val.blue { color: var(--blue); }

/* MAIN */
main {
  padding: 28px 36px;
  max-width: 1400px;
  margin: 0 auto;
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 4px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}

.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.filter-btn.red-active { background: var(--red-glow); border-color: var(--red); color: var(--red); }

.search-input {
  margin-right: auto;
  padding: 7px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* TABLE */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 11px 16px;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--text); }

th .sort-icon {
  display: inline-block;
  margin-right: 4px;
  opacity: 0.4;
  font-size: 14px;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody tr.expanded { background: var(--surface2); }

td {
  padding: 13px 16px;
  font-size: 13px;
  vertical-align: middle;
}

.project-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: var(--text-muted);
  font-weight: 500;
}

.project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.cloud-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--blue);
  font-weight: 500;
}

.hub-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 20px;
  font-size: 14px;
  color: var(--blue);
  font-weight: 500;
}

.version-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(155, 138, 250, 0.1);
  border: 1px solid rgba(155, 138, 250, 0.2);
  border-radius: 20px;
  font-size: 14px;
  color: var(--revit-purple);
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

/* URGENCY */
.urgency-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.urgency-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.urgency-text {
  font-size: 12px;
  font-weight: 500;
}

.urgency-maintenance .urgency-dot { background: var(--text-muted); }
.urgency-maintenance .urgency-text { color: var(--text-muted); }

.urgency-normal .urgency-dot { background: var(--accent); }
.urgency-normal .urgency-text { color: var(--accent); }

.urgency-high .urgency-dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.urgency-high .urgency-text { color: var(--amber); }

.urgency-critical .urgency-dot { background: var(--red); box-shadow: 0 0 6px var(--red); animation: pulse 1.5s infinite; }
.urgency-critical .urgency-text { color: var(--red); }

/* STATUS BADGE */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.status-yes {
  background: var(--red-glow);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--red);
}

.status-no {
  background: var(--accent-glow);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--accent);
}

.status-unknown {
  background: rgba(107, 115, 148, 0.1);
  border: 1px solid rgba(107, 115, 148, 0.2);
  color: var(--text-muted);
}

.expand-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  line-height: 16px;
  font-size: 10px;
  color: var(--text-muted);
  transition: all 0.2s;
  float: left;
  margin-top: 1px;
}

tr.expanded .expand-icon {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(90deg);
}

/* DETAIL ROW */
.detail-row {
  display: none;
  background: var(--bg);
}

.detail-row.open {
  display: table-row;
}

.detail-cell {
  padding: 0 !important;
  border-bottom: 2px solid var(--accent) !important;
}

.detail-inner {
  padding: 20px 24px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.detail-card-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.detail-card-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.missions-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.missions-header {
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.missions-header .open-count {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
}

.mission-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

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

.mission-dot {
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  margin-top: 10px;
  flex-shrink: 0;
}

.mission-text {
  font-size: 16px;
  color: var(--text);
  line-height: 1.5;
}

.no-missions {
  padding: 16px;
  font-size: 13px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.packages-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--amber);
}

.packages-icon { font-size: 15px; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  header { padding: 14px 16px; }
  main { padding: 16px; }
  .stats-bar { padding: 0 16px; overflow-x: auto; }
  th, td { padding: 10px 10px; }
  .filter-bar { gap: 8px; }

  /* Hide non-essential columns on mobile */
  th:nth-child(3), td:nth-child(3), /* שם בענן */
  th:nth-child(4), td:nth-child(4), /* HUB */
  th:nth-child(5), td:nth-child(5), /* גרסה */
  th:nth-child(6), td:nth-child(6), /* מתכנן */
  th:nth-child(7), td:nth-child(7)  /* דחיפות */
  { display: none; }

  .project-num { font-size: 14px; }
  .project-name { font-size: 13px; }
  .status-badge { font-size: 12px; padding: 4px 8px; }
  .search-input { width: 100%; margin-right: 0; }
}
