/* Atomic Factories - Metal 3D Printing Service
   CSS Stylesheet - 2026
*/

:root {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-tertiary: #0a0a0a;
    --bg-panel: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-primary: #00d4ff;
    --accent-secondary: #0099cc;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    --success: #00cc88;
    --warning: #ffaa00;
    --error: #ff4466;
    --travel-color: #33cc66;
    --extrusion-color: #ffffff;
    --debind-color: #ff8800;
    --sinter-color: #ff3366;
    --laser-color: #ff0044;
    --border-color: #1a1a1a;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-image {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.1);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    padding: 16px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* Panel */
.panel {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible .panel-title {
    cursor: pointer;
}

.collapsible .panel-title:hover {
    color: var(--text-primary);
}

.chevron {
    transition: transform 0.3s;
}

.panel.collapsed .chevron {
    transform: rotate(-90deg);
}

.panel.collapsed .panel-content {
    display: none;
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-text {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 12px;
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.file-info.hidden {
    display: none;
}

.file-name {
    font-weight: 500;
    color: var(--accent-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.btn-clear:hover {
    color: var(--error);
    background: rgba(255, 68, 102, 0.1);
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-secondary);
}

.input-field {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.select-input {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.select-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-loading.hidden {
    display: none;
}

.btn-text.hidden {
    display: none;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Processing Log */
.log-container {
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    line-height: 1.6;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.log-entry {
    padding: 2px 0;
    color: var(--text-secondary);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.warning {
    color: var(--warning);
}

/* Viewer Container */
.viewer-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

.viewer-canvas {
    width: 100%;
    height: 100%;
}

/* Viewer Controls */
.viewer-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    min-width: 500px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-group label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Playback Controls */
.playback-controls {
    justify-content: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.playback-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.playback-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.1);
}

.playback-btn:active {
    transform: scale(0.95);
}

.speed-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.speed-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.speed-select:hover {
    border-color: var(--accent-primary);
}

.visibility-toggles {
    flex-wrap: wrap;
    gap: 16px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.toggle-label:hover {
    color: var(--text-primary);
}

.toggle-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.toggle-color.travel { background: var(--travel-color); }
.toggle-color.extrusion { background: var(--extrusion-color); }
.toggle-color.debind { background: var(--debind-color); }
.toggle-color.sinter { background: var(--sinter-color); }

/* View Presets */
.view-presets {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
}

.view-btn {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Laser Tooltip */
.laser-tooltip {
    position: absolute;
    display: none;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1000;
    min-width: 180px;
    font-size: 12px;
}

.tooltip-header {
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0;
}

.tooltip-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.tooltip-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Energy Legend */
.energy-legend {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.legend-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}

.legend-gradient {
    width: 120px;
    height: 12px;
    background: linear-gradient(to right, #0078ff, #ffff00, #ff0000);
    border-radius: 2px;
}

.legend-values {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Bounds */
.bounds-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bounds-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.bounds-row span:first-child {
    color: var(--text-muted);
}

/* Moves Breakdown */
.moves-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.move-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.move-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.move-color.travel { background: var(--travel-color); }
.move-color.extrusion { background: var(--extrusion-color); }
.move-color.laser { background: var(--laser-color); }

/* Footer */
.footer {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Warning Panel */
.warning-panel {
    background: rgba(255, 170, 0, 0.1);
    border-color: var(--warning);
}

.warning-panel p {
    color: var(--warning);
    font-size: 13px;
    margin: 0;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }

    .viewer-controls {
        min-width: 400px;
    }
}

@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }

    .right-sidebar {
        order: 3;
    }

    .panel {
        min-width: 280px;
    }
}
