/* lightning-gpu-dashboard.html — page-specific styles */

:root {
  --bg: #0b0e13;
  --bg-end: #141c28;
  --surface: rgba(255, 255, 255, 0.05);
  --surface2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --accent-blue: #2b8be6;
  --accent-purple: #5468f2;
  --accent-pink: #435af1;
  --yellow: #f5d020;
  --yellow2: #f5a623;
  --cyan: #2b88e5;
  --red: #f87171;
  --green: #10b981;
  --purple: #8c9bf7;
  --text: #c9d2dc;
  --text-bright: #f2f5f9;
  --muted: #8c99a8;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-end) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Header — matches prompt.html */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 15px rgba(43,139,230,0.3);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-pink));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span { -webkit-text-fill-color: initial; color: var(--accent-purple); }

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

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: var(--surface2);
  border-color: var(--accent-blue);
  color: var(--text-bright);
  transform: translateX(-2px);
}

.back-btn .material-icons {
  font-size: 18px;
}

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

.status-pill {
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 25px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
  backdrop-filter: blur(10px);
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill.live::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.time-display {
  font-size: 14px;
  color: var(--muted);
}

/* Layout — content area like prompt.html */
.main {
  padding: 32px;
  position: relative;
  z-index: 2;
  max-width: 1600px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.02);
}

/* Summary Bar — card style from prompt */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: all 0.3s ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 20px 0 0 20px;
}

.stat-card.yellow::before { background: var(--yellow); }
.stat-card.cyan::before { background: var(--cyan); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }
.stat-card.purple::before { background: var(--purple); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text-bright);
}

.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.cyan .stat-value { color: var(--cyan); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.purple .stat-value { color: var(--purple); }

.stat-sub {
  font-size: 14px;
  color: var(--muted);
}

/* Section Labels — accent from prompt */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  margin-top: 32px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-badge {
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

/* GPU Grid — card style from prompt */
.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.gpu-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  animation: fadeSlideIn 0.4s ease both;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.gpu-card:nth-child(1) { animation-delay: 0.05s; }
.gpu-card:nth-child(2) { animation-delay: 0.1s; }
.gpu-card:nth-child(3) { animation-delay: 0.15s; }
.gpu-card:nth-child(4) { animation-delay: 0.2s; }
.gpu-card:nth-child(5) { animation-delay: 0.25s; }
.gpu-card:nth-child(6) { animation-delay: 0.3s; }
.gpu-card:nth-child(7) { animation-delay: 0.35s; }
.gpu-card:nth-child(8) { animation-delay: 0.4s; }

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

.gpu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  border-color: rgba(43,139,230,0.3);
}

.gpu-card.active { border-color: rgba(16, 185, 129, 0.4); }
.gpu-card.idle { border-color: var(--border); }
.gpu-card.error { border-color: rgba(248, 113, 113, 0.4); }
.gpu-card.reserved { border-color: rgba(140,155,247,0.4); }

.gpu-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.gpu-id {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.gpu-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 4px;
}

.gpu-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active { background: rgba(16,185,129,0.2); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-idle { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--border); }
.badge-error { background: rgba(248,113,113,0.2); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }
.badge-reserved { background: rgba(140,155,247,0.2); color: var(--purple); border: 1px solid rgba(140,155,247,0.3); }

/* Metric Rows */
.metrics {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  width: 42px;
  flex-shrink: 0;
}

.metric-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.metric-bar {
  height: 100%;
  border-radius: 4px;
  position: relative;
  transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.metric-bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 4px; height: 100%;
  background: rgba(255,255,255,0.5);
  border-radius: 0 4px 4px 0;
}

.bar-gpu { background: linear-gradient(90deg, var(--cyan), #186dc2); }
.bar-mem { background: linear-gradient(90deg, var(--yellow), var(--yellow2)); }
.bar-temp { background: linear-gradient(90deg, var(--green), #059669); }
.bar-temp.hot { background: linear-gradient(90deg, var(--yellow2), var(--red)); }
.bar-temp.critical { background: linear-gradient(90deg, var(--red), #dc2626); }
.bar-pwr { background: linear-gradient(90deg, var(--purple), var(--accent-purple)); }

.metric-val {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-bright);
  width: 40px;
  text-align: right;
}

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

.gpu-task {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.gpu-task span { color: var(--cyan); }

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

.btn-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-icon:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(43,139,230,0.1); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); background: rgba(248, 113, 113, 0.1); }

/* Bottom panels — card style from prompt */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.panel:hover {
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Job Queue */
.job-list { display: flex; flex-direction: column; gap: 10px; }

.job-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.job-item:hover { border-color: rgba(43,139,230,0.3); background: rgba(43,139,230,0.05); }

.job-priority {
  width: 4px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}

.job-info { flex: 1; }

.job-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.job-meta {
  font-size: 12px;
  color: var(--muted);
}

.job-status {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.job-running { color: var(--cyan); border-color: rgba(43,136,229,0.3); background: rgba(43,136,229,0.1); }
.job-queued { color: var(--yellow); border-color: rgba(245,208,32,0.3); background: rgba(245,208,32,0.1); }
.job-done { color: var(--green); border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.1); }

/* Activity Log */
.log-list {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.log-list::-webkit-scrollbar { width: 6px; }
.log-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.log-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.log-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  animation: logFade 0.3s ease;
}

@keyframes logFade {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.log-time { color: var(--muted); flex-shrink: 0; width: 55px; font-size: 11px; }
.log-level { width: 52px; flex-shrink: 0; font-weight: 500; }
.log-level.info { color: var(--cyan); }
.log-level.warn { color: var(--yellow); }
.log-level.error { color: var(--red); }
.log-level.ok { color: var(--green); }
.log-msg { color: var(--text); opacity: 0.9; }

/* Utilization chart */
.chart-container {
  position: relative;
  height: 80px;
  margin-bottom: 12px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  position: relative;
}

.chart-bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 500;
  color: var(--cyan);
  white-space: nowrap;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* Allocation map */
.alloc-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.alloc-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.alloc-cell.used { background: rgba(43,136,229,0.15); border-color: rgba(43,136,229,0.4); color: var(--cyan); }
.alloc-cell.free { background: rgba(255,255,255,0.03); border-color: var(--border); color: var(--muted); }
.alloc-cell.error-cell { background: rgba(248,113,113,0.15); border-color: rgba(248,113,113,0.4); color: var(--red); }
.alloc-cell.reserved-cell { background: rgba(140,155,247,0.15); border-color: rgba(140,155,247,0.4); color: var(--purple); }

.alloc-cell:hover { transform: scale(1.08); z-index: 2; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

/* Controls Bar — prompt button style */
.controls-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-bright);
}

.filter-btn.active {
  background: linear-gradient(135deg, rgba(43,139,230,0.2), rgba(84,104,242,0.2));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 4px 15px rgba(43,139,230,0.2);
}

.spacer { flex: 1; }

.search-box {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-bright);
  width: 220px;
  outline: none;
  transition: all 0.3s ease;
}

.search-box:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(43,139,230,0.1);
}
.search-box::placeholder { color: var(--muted); }

.btn-primary {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  box-shadow: 0 4px 15px rgba(43,139,230,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(43,139,230,0.4);
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  display: none;
  color: var(--text-bright);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 900px) {
  .summary-bar { grid-template-columns: repeat(3, 1fr); }
  .bottom-grid { grid-template-columns: 1fr; }
}
