/* ============================================================
   SpawnScene — Design System
   ============================================================ */

/* --- Design Tokens --- */
:root {
    /* Colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-surface: #1a1a3e;
    --bg-surface-hover: #222255;
    --bg-glass: rgba(26, 26, 62, 0.75);

    --text-primary: #e8e8f0;
    --text-secondary: #9898b8;
    --text-muted: #6868a0;

    --accent-primary: #6c5ce7;
    --accent-primary-hover: #7c6cf7;
    --accent-secondary: #00cec9;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --accent-success: #00b894;
    --accent-warning: #fdcb6e;
    --accent-danger: #e17055;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(108, 92, 231, 0.3);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.85rem;
    --font-size-base: 0.95rem;
    --font-size-lg: 1.1rem;
    --font-size-xl: 1.4rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.8rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 56px;

    /* Surface aliases (used by scoped page CSS) */
    --surface-card: var(--bg-surface);
    --surface-border: var(--border-subtle);
    --surface-hover: var(--bg-surface-hover);
    --surface-overlay: var(--bg-glass);
    --font-size-md: var(--font-size-base);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
}

/* --- Loading Screen --- */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: var(--space-lg);
    background: var(--bg-primary);
}

.loading-orb {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
            var(--accent-secondary), var(--accent-primary));
    animation: pulse-glow 2s ease-in-out infinite;
    box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(0, 206, 201, 0.15);
}

@keyframes pulse-glow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.loading-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- App Layout --- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Navigation --- */
.nav-section {
    padding: var(--space-md) var(--space-sm);
}

.nav-section-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 450;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin: 1px 0;
}

.nav-item:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary-hover);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* --- Sidebar Footer (GPU Info) --- */
.sidebar-footer {
    margin-top: auto;
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.gpu-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.gpu-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-success);
    flex-shrink: 0;
}

.gpu-status-dot.inactive {
    background: var(--text-muted);
}

.github-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.github-link:hover {
    color: var(--text-primary);
}

.github-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.page-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

/* --- Cards & Surfaces --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #5a4bd6);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover), #6a5be6);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* --- Utility Classes --- */
.text-accent {
    color: var(--accent-primary);
}

.text-secondary-color {
    color: var(--accent-secondary);
}

.text-muted-color {
    color: var(--text-muted);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}

.text-mono {
    font-family: var(--font-mono);
}

.font-semibold {
    font-weight: 600;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

/* --- Hero Section (Home page) --- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-2xl) 0;
}

.hero-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: var(--space-md);
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
}

/* --- Feature Grid --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-2xl);
    max-width: 900px;
    width: 100%;
}

.feature-card {
    text-align: left;
}

.feature-icon {
    font-size: 28px;
    margin-bottom: var(--space-sm);
}

.feature-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.feature-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Canvas / Viewer --- */
.viewer-container {
    position: relative;
    flex: 1;
    background: var(--bg-primary);
    overflow: hidden;
}

.viewer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.viewer-overlay {
    position: absolute;
    bottom: var(--space-md);
    left: var(--space-md);
    display: flex;
    gap: var(--space-sm);
}

.viewer-badge {
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* --- Viewer Settings Panel --- */
.viewer-settings-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 32px;
    height: 32px;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    z-index: 10;
}

.viewer-settings-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.viewer-settings-panel {
    position: absolute;
    top: calc(var(--space-md) + 40px);
    right: var(--space-md);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    min-width: 220px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.vsp-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
}

.vsp-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.vsp-label {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-muted);
    min-width: 56px;
}

.vsp-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.vsp-opt {
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.vsp-opt-active {
    background: var(--accent-primary);
    color: #fff;
}

.vsp-slider {
    flex: 1;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.vsp-value {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

.vsp-select {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    padding: 3px 6px;
    cursor: pointer;
}

.vsp-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* --- Drag & Drop Zone --- */
.drop-zone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.05);
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.6;
}

.drop-zone-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Blazor Error UI --- */
#blazor-error-ui {
    background: var(--accent-danger);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    font-size: var(--font-size-sm);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

/* --- Animations --- */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fade-in 0.5s ease forwards;
}

.animate-in-delay-1 {
    animation-delay: 100ms;
    opacity: 0;
}

.animate-in-delay-2 {
    animation-delay: 200ms;
    opacity: 0;
}

.animate-in-delay-3 {
    animation-delay: 300ms;
    opacity: 0;
}

.animate-in-delay-4 {
    animation-delay: 400ms;
    opacity: 0;
}

.animate-in-delay-5 {
    animation-delay: 500ms;
    opacity: 0;
}

.animate-in-delay-6 {
    animation-delay: 600ms;
    opacity: 0;
}

/* --- Pipeline Status (Home page) --- */
.pipeline-section {
    max-width: 900px;
    margin: var(--space-2xl) auto 0;
    width: 100%;
}

.pipeline-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    text-align: center;
}

.pipeline-steps {
    display: flex;
    gap: 0;
}

.pipeline-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
}

.pipeline-step:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.pipeline-step:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.pipeline-step:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-accent);
    z-index: 1;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

.step-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-arrow {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* Pipeline step states */
.step-complete .step-number {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: var(--bg-primary);
}

.step-complete .step-name {
    color: var(--accent-secondary);
}

.step-ready .step-number {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.step-ready .step-name {
    color: var(--text-primary);
}

.step-locked {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Tech Badges (Home page) --- */
.tech-section {
    max-width: 900px;
    margin: var(--space-2xl) auto 0;
    text-align: center;
}

.tech-title {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.tech-badges {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.tech-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* --- Surface Variables (used by scoped CSS) --- */
.surface-card {
    background: var(--bg-surface);
}

.surface-border {
    border-color: var(--border-subtle);
}

.surface-hover {
    background: var(--bg-surface-hover);
}

.surface-overlay {
    background: var(--bg-glass);
}