/**
 * Sci-Fi Installation Generator & Editor Stylesheet
 */

:root {
    --bg-dark: #090d16;
    --bg-surface: #0f172a;
    --bg-surface-elevated: #1e293b;
    --bg-card: #161e2e;
    --border-color: #334155;
    --border-glow: #00e5ff;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-cyan: #00e5ff;
    --accent-orange: #ff9100;
    --accent-green: #00e676;
    --accent-red: #ef4444;
    --accent-purple: #c084fc;
    --accent-amber: #f59e0b;

    --font-heading: 'Chakra Petch', 'Russo One', sans-serif;
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header & Top Toolbar */
header {
    background: linear-gradient(180deg, #131b2e 0%, #0c1220 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    z-index: 100;
}

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

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent-cyan);
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.brand .sub-tag {
    font-size: 0.75rem;
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.top-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctrl-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.7);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.ctrl-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

select, input[type="text"], input[type="number"], textarea {
    background: #090d16;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 5px 8px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
}

select:focus, input:focus, textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #00e5ff 0%, #0284c7 100%);
    color: #000;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.6);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    font-weight: 700;
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
    color: #fca5a5;
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
}

.btn-xs {
    font-size: 0.75rem;
    padding: 3px 8px;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 4px 10px;
}

/* Main Layout Grid */
.workspace {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 12px 16px;
    background: #111a2e;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Block Catalog List */
.catalog-search-box {
    width: 100%;
    margin-bottom: 8px;
}

.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.catalog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-cyan);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.15s, border-color 0.15s, opacity 0.2s;
}

.catalog-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.catalog-card.card-forced {
    border-color: var(--accent-amber);
    border-left-color: var(--accent-amber);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
    background: #231b0c;
}

.catalog-card.card-excluded {
    opacity: 0.45;
    border-left-color: var(--accent-red);
    background: #180d11;
}

.catalog-card.custom-card {
    border-left-color: var(--accent-purple);
    background: #191629;
}

.rule-pill-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    margin-bottom: 6px;
}

.rule-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

.rule-btn:hover {
    color: #fff;
    border-color: #94a3b8;
}

.rule-btn.active-force {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    font-weight: bold;
}

.rule-btn.active-exclude {
    background: rgba(239, 68, 68, 0.25);
    border-color: var(--accent-red);
    color: #fca5a5;
    font-weight: bold;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

/* Central Viewport & Canvas */
.viewport {
    position: relative;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tool-bar {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    gap: 6px;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tool-btn.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 700;
}

.canvas-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: crosshair;
}

#map-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Facility Stats HUD Bar */
.stats-bar {
    position: absolute;
    bottom: 14px;
    left: 14px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 14px;
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    z-index: 50;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-val {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--accent-cyan);
}

/* Inspector Cards & Controls */
.inspector-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inspector-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.title-input {
    width: 100%;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-cyan);
}

.inspector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    align-items: center;
    font-size: 0.8rem;
}

.inspector-grid label {
    color: var(--text-secondary);
}

.value-text {
    color: var(--text-primary);
    font-weight: 500;
}

.inspector-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.inspector-notes {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inspector-notes label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.inspector-textarea {
    min-height: 60px;
    resize: vertical;
    font-size: 0.8rem;
}

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

.empty-inspector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    padding: 30px 10px;
    gap: 10px;
}

.empty-icon {
    font-size: 2rem;
    opacity: 0.5;
}

/* Badges */
.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.size-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.category-badge {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Export Hub Accordion */
.export-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Modal for Block Editor */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 7, 13, 0.85);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--accent-cyan);
    border-radius: 8px;
    width: 90vw;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
    overflow: hidden;
}

.modal-header {
    padding: 14px 20px;
    background: #111a2e;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
}

.modal-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    padding: 16px;
    gap: 16px;
    overflow-y: auto;
    max-height: calc(90vh - 130px);
}

.be-controls-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.be-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.be-tool-btn {
    padding: 8px;
    font-size: 0.8rem;
}

.be-canvas-wrapper {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
}

.modal-footer {
    padding: 12px 20px;
    background: #111a2e;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* AI ControlNet Studio Modal Styles */
.ai-studio-dialog {
    max-width: 1180px;
    width: 95vw;
}

.ai-studio-body {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 20px;
    padding: 16px 20px;
}

.ai-controls-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-viewports-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.ai-viewport-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-viewport-header {
    background: #111a2e;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-canvas-box {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #06090e;
    min-height: 380px;
    position: relative;
}

.ai-canvas-box canvas,
.ai-canvas-box img {
    max-width: 100%;
    max-height: 380px;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

