/* ===== NANO-FORGE INTERFACE ===== */

/* Use global font scale from index.html */

.nano-forge-interface {
    background: radial-gradient(ellipse at center, #0d1421 0%, #050a12 70%, #000 100%);
    color: #e8f4ff;
    font-family: 'Courier New', 'Consolas', monospace;
    height: 100%;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    letter-spacing: 0.5px;
    box-sizing: border-box; /* Include padding/border in width */
}

/* Forge Header */
.forge-header {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 212, 255, 0.1) 100%);
    border-bottom: 2px solid #00ff88;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.matrix-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(0, 255, 136, 0.05) 11px,
        rgba(0, 255, 136, 0.05) 12px
    );
    pointer-events: none;
    animation: matrix-scroll 3s linear infinite;
}

@keyframes matrix-scroll {
    0% { transform: translateX(-12px); }
    100% { transform: translateX(0); }
}

.station-designation {
    font-size: calc(18px * var(--global-font-scale));
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    z-index: 1;
    position: relative;
}

.power-grid {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
    position: relative;
}

.power-cell {
    width: 8px;
    height: 16px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 2px;
    transition: all 0.3s;
}

.power-cell.active {
    background: linear-gradient(to top, #00ff88 0%, #44ffaa 100%);
    border-color: #00ff88;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
    animation: power-pulse 2s infinite;
}

@keyframes power-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.grid-status {
    color: #00ff88;
    font-size: calc(11px * var(--global-font-scale));
    font-weight: bold;
    margin-left: 10px;
    text-transform: uppercase;
}

/* Forge Workspace */
.forge-workspace {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Blueprint Vault */
.blueprint-vault {
    width: 350px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vault-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 255, 136, 0.1);
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
}

.vault-title {
    color: #00ff88;
    font-size: calc(12px * var(--global-font-scale));
    font-weight: bold;
    margin: 0 15px;
    text-transform: uppercase;
}

.filter-array {
    display: flex;
    padding: 15px;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.3) rgba(0, 0, 0, 0.2);
}

.filter-array::-webkit-scrollbar {
    height: 6px;
}

.filter-array::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.filter-array::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}

.filter-array::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

.filter-node {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    color: #888;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: calc(10px * var(--global-font-scale));
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-node:hover {
    border-color: #00ff88;
    color: #aaa;
}

.filter-node.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    color: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.blueprint-matrix {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    max-height: 400px;
}

.blueprint-node {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.blueprint-node:hover {
    border-color: #00d4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.blueprint-node.selected {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.blueprint-node.ready .node-status::after {
    content: '●';
    color: #00ff88;
    font-size: calc(8px * var(--global-font-scale));
    position: absolute;
    top: 5px;
    right: 5px;
}

.node-core {
    text-align: center;
}

.node-icon {
    font-size: calc(24px * var(--global-font-scale));
    margin-bottom: 8px;
    display: block;
    filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.3));
    transition: all 0.3s;
}

.blueprint-node.ready .node-icon {
    filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.6));
    transform: scale(1.1);
}

.blueprint-node.selected .node-icon {
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.8));
    transform: scale(1.15);
}

.tier-indicator {
    width: 20px;
    height: 4px;
    margin: 0 auto 8px;
    border-radius: 2px;
}

.tier-indicator.t1 { background: linear-gradient(90deg, #666, #999); }
.tier-indicator.t2 { background: linear-gradient(90deg, #0066ff, #00aaff); }
.tier-indicator.t3 { background: linear-gradient(90deg, #ff6600, #ffaa00); }

.node-label {
    color: #e8f4ff;
    font-size: calc(10px * var(--global-font-scale));
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.node-time {
    color: #888;
    font-size: calc(11px * var(--global-font-scale)); /* Increased from 8px for better readability */
}

.node-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
}

.node-status.ready {
    background: #00ff88;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.8);
}

/* Forge Control */
.forge-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Reduced from 20px */
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden; /* Prevent children from expanding */
}

.hologram-display {
    height: 350px; /* Increased from 250px for better item details visibility */
    background: radial-gradient(circle at center, rgba(0, 212, 255, 0.1) 0%, rgba(0, 0, 0, 0.8) 70%);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hologram-empty {
    text-align: center;
    color: #666;
}

.hologram-grid {
    width: 100px;
    height: 100px;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(0, 212, 255, 0.1) 9px),
        repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(0, 212, 255, 0.1) 9px);
    margin: 0 auto 15px;
    opacity: 0.3;
}

.hologram-text {
    font-size: calc(12px * var(--global-font-scale));
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hologram-active {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.hologram-wireframe {
    position: relative;
}

.wireframe-model {
    font-size: calc(64px * var(--global-font-scale));
    color: #00d4ff;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.8));
    animation: hologram-flicker 3s infinite;
}

@keyframes hologram-flicker {
    0%, 98% { opacity: 1; }
    99% { opacity: 0.7; }
    100% { opacity: 1; }
}

.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 212, 255, 0.1) 3px
    );
    animation: scan-sweep 2s infinite;
}

@keyframes scan-sweep {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.hologram-data {
    flex: 1;
}

.item-name {
    color: #00d4ff;
    font-size: calc(16px * var(--global-font-scale));
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.item-specs {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.spec {
    color: #aaa;
    font-size: calc(14px * var(--global-font-scale)); /* Increased from 11px for better readability */
}

/* Forge Console */
.forge-console {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    padding: 12px; /* Reduced from 20px */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reduced from 15px */
}

.console-panel {
    flex: 1;
}

.status-strip {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    padding: 6px 10px; /* Reduced from 8px 12px */
    font-size: calc(11px * var(--global-font-scale)); /* Increased from 9px for better readability */
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 8px; /* Reduced from 15px */
    border-left: 3px solid #00ff88;
}

.material-grid {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduced from 8px */
    max-height: 120px; /* Reduced from 150px */
    overflow-y: auto;
}

.material-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px; /* Sharp corners instead of 5px */
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.material-cell.sufficient {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 255, 136, 0.2);
}

.material-cell.insufficient {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    box-shadow: inset 0 0 10px rgba(255, 68, 68, 0.2);
}

.material-icon {
    font-size: calc(16px * var(--global-font-scale));
    width: 20px;
    text-align: center;
}

.material-info {
    flex: 1;
}

.material-name {
    color: #e8f4ff;
    font-size: calc(11px * var(--global-font-scale));
    font-weight: bold;
    text-transform: uppercase;
}

.material-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: calc(10px * var(--global-font-scale));
    margin-top: 2px;
}

.available {
    color: #e8f4ff;
    font-weight: bold;
}

.separator {
    color: #666;
}

.required {
    color: #aaa;
}

.material-status {
    width: 8px;
    height: 8px;
    border-radius: 1px; /* Sharp corners instead of circle */
}

.material-status.ready {
    background: #00ff88;
}

.material-status.missing {
    background: #ff4444;
}

.forge-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px; /* Reduced from 20px */
    padding-top: 10px; /* Reduced from 15px */
    border-top: 1px solid rgba(0, 255, 136, 0.2);
}

.quantity-compact {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-label {
    color: #00ff88;
    font-size: calc(10px * var(--global-font-scale));
    font-weight: bold;
}

.quantity-value {
    color: #00ff88;
    font-size: calc(12px * var(--global-font-scale));
    font-weight: bold;
    min-width: 20px;
}

.dial-slider {
    width: 100px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.dial-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00ff88;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.dial-display {
    text-align: center;
}

.dial-display span {
    display: block;
    color: #00ff88;
    font-weight: bold;
}

.dial-unit {
    font-size: calc(8px * var(--global-font-scale));
    color: #888;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.forge-button, .find-resources-button {
    border: none;
    padding: 10px 20px; /* Reduced from 15px 30px */
    border-radius: 6px;
    font-weight: bold;
    font-size: calc(11px * var(--global-font-scale)); /* Reduced from 12px */
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 6px; /* Reduced from 8px */
}

.forge-button {
    background: linear-gradient(135deg, #00ff88 0%, #00cc66 100%);
    color: #000;
}

.find-resources-button {
    background: linear-gradient(135deg, #00d4ff 0%, #0088cc 100%);
    color: #000;
}

.find-resources-button .button-icon {
    font-size: calc(14px * var(--global-font-scale));
}

.forge-button:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

.find-resources-button:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.forge-button.disabled, .find-resources-button.disabled {
    background: linear-gradient(135deg, #444 0%, #333 100%);
    color: #aaa;
    cursor: not-allowed;
    border: 1px solid #666;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.1);
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.5s;
}

.forge-button:hover:not(.disabled) .button-glow,
.find-resources-button:hover:not(.disabled) .button-glow {
    left: 100%;
}

/* Production Bay */
.production-bay {
    background: rgba(0, 0, 0, 0.3);
    border-top: 2px solid rgba(0, 255, 136, 0.3);
    padding: 8px 25px; /* Reduced from 15px to 8px */
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent children from expanding beyond */
}

.bay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px; /* Reduced from 15px */
}

.bay-title {
    color: #00ff88;
    font-size: calc(12px * var(--global-font-scale));
    font-weight: bold;
    text-transform: uppercase;
}

.bay-counter {
    color: #aaa;
    font-size: calc(10px * var(--global-font-scale));
}

.bay-counter span {
    color: #00ff88;
    font-weight: bold;
}

.production-grid {
    display: flex;
    gap: 8px;
    overflow-x: scroll !important; /* Force scrolling */
    overflow-y: hidden;
    padding-bottom: 5px;
    width: 100%;
    max-width: 900px; /* Hard limit - never wider than this */

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.5) rgba(0, 0, 0, 0.3);
}

.production-grid::-webkit-scrollbar {
    height: 6px;
}

.production-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.production-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.5);
    border-radius: 3px;
}

.production-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.7);
}

.empty-bay {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 8px; /* Reduced from 20px */
    width: 100%;
}

.fabricator-unit {
    width: auto; /* Auto width - fit content */
    flex-shrink: 0; /* Don't allow shrinking */
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 3px;
    padding: 4px 8px; /* Minimal vertical padding */
    position: relative;
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center; /* Center items vertically */
    gap: 8px;
}

.fabricator-status {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
    flex-shrink: 0; /* Don't shrink */
}

.status-light {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
}

.status-light.active {
    background: #00ff88;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.8);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 70% { opacity: 1; }
    85% { opacity: 0.3; }
    100% { opacity: 1; }
}

.unit-id {
    color: #00d4ff;
    font-size: calc(9px * var(--global-font-scale));
    font-weight: bold;
}

.fabricator-display {
    margin-bottom: 0;
    display: flex;
    flex-direction: row; /* Horizontal layout for item name and quantity */
    align-items: center;
    gap: 6px;
    flex: 1; /* Take available space */
    min-width: 0; /* Allow text to truncate */
}

.fab-item {
    color: #e8f4ff;
    font-size: calc(9px * var(--global-font-scale));
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 0;
    line-height: 1;
    white-space: nowrap; /* Keep on one line */
    overflow: hidden;
    text-overflow: ellipsis; /* Truncate long names */
}

.fab-quantity {
    color: #00d4ff;
    font-size: calc(9px * var(--global-font-scale));
    margin-bottom: 0;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0; /* Don't shrink */
}

.fab-progress {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 1; /* Allow some shrinking */
    min-width: 60px; /* Reduced min-width */
}

.progress-track {
    height: 2px;
    background: #333;
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 0;
    flex: 1; /* Take remaining space in fab-progress */
    min-width: 40px;
}

.progress-beam {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #00ff88);
    border-radius: 2px;
    transition: width 0.3s;
    position: relative;
}

.progress-beam::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 10px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), transparent);
    animation: beam-sweep 1.5s infinite;
}

@keyframes beam-sweep {
    0%, 50% { opacity: 0; }
    70%, 100% { opacity: 1; }
}

.progress-data {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: calc(8px * var(--global-font-scale)); /* Smaller */
    flex-shrink: 1; /* Allow shrinking */
    white-space: nowrap;
}

.percent {
    color: #00d4ff;
    font-weight: bold;
}

.eta {
    color: #888;
}

.fabricator-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.terminate-btn {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    color: #ff6666;
    padding: 2px 6px; /* Reduced from 4px 8px */
    border-radius: 2px; /* Reduced from 3px */
    font-size: calc(8px * var(--global-font-scale)); /* Slightly smaller */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    text-transform: uppercase;
    line-height: 1.2; /* Tighter line height */
}

.terminate-btn:hover {
    background: rgba(255, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* Loading States */
.loading-matrix {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 30px;
}

.matrix-dot {
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    animation: matrix-pulse 1.5s infinite;
}

.matrix-dot:nth-child(2) { animation-delay: 0.2s; }
.matrix-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes matrix-pulse {
    0%, 70%, 100% { opacity: 0.3; transform: scale(1); }
    35% { opacity: 1; transform: scale(1.2); }
}

.matrix-error, .matrix-empty {
    text-align: center;
    color: #666;
    padding: 30px;
    font-style: italic;
}