/* ==========================================================================
   TITAN PLATINUM - DASHBOARD THEME
   Modern Cyber Glassmorphism Studio Design System
   ========================================================================== */

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(2, 6, 23, 0.7);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #38bdf8;
  --accent-glow: rgba(99, 102, 241, 0.35);

  --ink-primary: #f8fafc;
  --ink-secondary: #94a3b8;
  --ink-muted: #64748b;

  --border-line: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);

  --status-pass: #10b981;
  --status-pass-bg: rgba(16, 185, 129, 0.15);
  --status-warn: #f59e0b;
  --status-warn-bg: rgba(245, 158, 11, 0.15);
  --status-fail: #f43f5e;
  --status-fail-bg: rgba(244, 63, 94, 0.15);
  --status-neutral: #64748b;
  --status-neutral-bg: rgba(100, 116, 139, 0.15);

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-main: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-dark);
  color: var(--ink-primary);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow orbs */
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}
.bg-glow-1 {
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}
.bg-glow-2 {
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, #38bdf8 0%, transparent 70%);
}

/* TOPBAR HEADER */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-line);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, var(--ink-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  -webkit-text-fill-color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.runtime-status {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-pass);
  box-shadow: 0 0 8px var(--status-pass);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

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

/* LAYOUT GRID */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 420px 1fr 380px;
  grid-template-areas:
    "project preview status"
    "logs preview jobs"
    "logs preview artifacts"
    "plan plan plan"
    "ai ai code";
  gap: 1.25rem;
  max-width: 1920px;
  margin: 1.25rem auto;
  padding: 0 1.5rem 2rem 1.5rem;
}

/* PANEL CARDS */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.panel:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-line);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-icon {
  color: var(--accent-cyan);
}

.panel-head h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
}

/* GRID AREAS */
.project-panel { grid-area: project; }
.status-panel { grid-area: status; }
.jobs-panel { grid-area: jobs; }
.logs-panel { grid-area: logs; min-height: 480px; }
.artifacts-panel { grid-area: artifacts; }
.preview-panel { grid-area: preview; min-height: 650px; }
.plan-panel { grid-area: plan; }
.ai-panel { grid-area: ai; }
.code-panel { grid-area: code; }

/* FIELD & FORM INPUTS */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0.9rem;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"], select, textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

input[type="text"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
  appearance: none;
}

.path-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.path-row input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

/* TOGGLES */
.toggles-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}

.toggles-title {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink-secondary);
  user-select: none;
}

.toggle-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* BUTTONS */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-line);
  background: var(--bg-card-hover);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(51, 65, 85, 0.8);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

button.primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.btn-primary-soft {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-cyan);
}

.btn-primary-soft:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-line);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--status-fail);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.25);
}

.btn-icon-only {
  padding: 0.6rem;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-row.compact {
  gap: 4px;
}

.primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0.5rem;
}

.align-end {
  justify-content: flex-end;
}

/* BADGES & DOTS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.pass { background: var(--status-pass-bg); color: var(--status-pass); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.warn { background: var(--status-warn-bg); color: var(--status-warn); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.fail { background: var(--status-fail-bg); color: var(--status-fail); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge.neutral { background: var(--status-neutral-bg); color: var(--ink-secondary); border: 1px solid var(--border-line); }
.badge-ai { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot.pass { background: var(--status-pass); box-shadow: 0 0 6px var(--status-pass); }
.dot.fail { background: var(--status-fail); box-shadow: 0 0 6px var(--status-fail); }
.dot.warn { background: var(--status-warn); box-shadow: 0 0 6px var(--status-warn); }

/* DEVICE VIEWPORT PREVIEW */
.device-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-line);
  padding: 1.5rem;
  min-height: 520px;
}

.device-frame {
  width: 320px;
  height: 580px;
  background: #000000;
  border-radius: 36px;
  border: 10px solid #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.device-notch {
  width: 100px;
  height: 18px;
  background: #1e293b;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.device-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.preview-controls {
  justify-content: center;
  margin-top: 1rem;
}

/* CHECKS & LISTS */
.checks-list, .jobs-list, .artifacts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.check, .artifact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.check:hover, .artifact:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.job {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  color: var(--ink-primary);
  text-align: left;
}

.job:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glow);
}

/* TERMINAL CONSOLE */
.terminal-window {
  background: #030712;
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 360px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.85rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border-line);
}

.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.term-dot.red { background: #ef4444; }
.term-dot.yellow { background: #f59e0b; }
.term-dot.green { background: #10b981; }

.term-title {
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.terminal-logs {
  flex: 1;
  padding: 1rem;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* AI ANSWER & OUTPUT */
.ai-answer {
  background: rgba(30, 41, 59, 0.6);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--ink-primary);
}

.plan-output {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  min-height: 80px;
}

.empty {
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.hidden {
  display: none !important;
}

/* SCROLLBARS */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
