* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #2d3250;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ==================== Top Header ==================== */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #252b42;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    height: 64px;
    flex-shrink: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 112px;
    height: 70px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-brand {
    font-size: 1.2em;
    font-weight: 600;
    color: #ffffff;
}

.logo-tagline {
    font-size: 0.65em;
    color: #8892a6;
    font-style: italic;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #8892a6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.header-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* User Section - in header */
.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4a5fc1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.8em;
    font-weight: 600;
    color: #fff;
}

.user-email {
    font-size: 0.7em;
    color: #8892a6;
}

.logout-btn {
    background: none;
    border: none;
    color: #8892a6;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: #ff6b6b;
}

/* Stats Section - in header */
.stats-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: flex;
    gap: 8px;
}

.stat-card {
    background: rgba(74, 95, 193, 0.1);
    border-radius: 6px;
    padding: 6px 14px;
    text-align: center;
    min-width: 100px;
}

.stat-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #5b72db;
}

.stat-label {
    font-size: 0.65em;
    color: #8892a6;
    margin-top: 2px;
    white-space: nowrap;
}

/* No Auth Banner */
.no-auth-banner {
    padding: 8px 20px;
    background: rgba(245, 158, 11, 0.15);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    display: none;
    align-items: center;
    gap: 10px;
    color: #fbbf24;
    font-size: 0.85em;
    flex-shrink: 0;
}

.no-auth-banner i {
    color: #f59e0b;
}

.no-auth-banner a, .login-link {
    color: #fbbf24;
    text-decoration: underline;
    margin-left: auto;
}

/* ==================== Body Container ==================== */
.body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar */
.sidebar {
    width: 360px;
    background: #252b42;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-title {
    padding: 16px 20px 12px 20px;
    font-size: 1.3em;
    font-weight: 600;
    color: #ffffff;
}

.sidebar-content {
    flex: 1;
    padding: 0 20px 20px 20px;
    overflow-y: auto;
}

.section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #8892a6;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-icon {
    font-size: 1.2em;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #4a5fc1;
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(74, 95, 193, 0.05);
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #5b72db;
    background: rgba(74, 95, 193, 0.1);
}

.drop-zone.dragover {
    border-color: #5b72db;
    background: rgba(74, 95, 193, 0.15);
}

.drop-zone-icon {
    font-size: 2em;
    margin-bottom: 8px;
    color: #4a5fc1;
}

.drop-zone-text {
    font-size: 0.9em;
    color: #ffffff;
    margin-bottom: 4px;
}

.drop-zone-subtext {
    color: #8892a6;
    font-size: 0.75em;
}

/* Settings Grid - two columns */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.form-field {
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    font-size: 0.8em;
    color: #8892a6;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #3a4160;
    border-radius: 6px;
    font-size: 0.85em;
    background: #1e2332;
    color: #ffffff;
    transition: border-color 0.3s;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #4a5fc1;
}

.form-field input::placeholder {
    color: #5a6278;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4a5fc1;
}

.checkbox-field label {
    cursor: pointer;
    font-size: 0.8em;
    color: #ffffff;
    margin: 0;
}

.slider-field {
    margin-bottom: 12px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #8892a6;
    margin-bottom: 6px;
    font-weight: 500;
}

.slider-value {
    color: #4a5fc1;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: #3a4160;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4a5fc1;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #4a5fc1;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* File List */
.file-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #3a4160;
    border-radius: 8px;
    padding: 10px;
    background: #1e2332;
    margin-top: 10px;
}

.file-count {
    margin-bottom: 8px;
    font-weight: 600;
    color: #ffffff;
    font-size: 0.8em;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #252b42;
    border-radius: 4px;
    transition: background 0.2s;
}

.file-item:hover {
    background: #2d3355;
}

.file-item.selected {
    background-color: rgba(74, 144, 226, 0.3);
    border-left: 3px solid #4a90e2;
}

.file-name {
    flex: 1;
    font-size: 0.78em;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.file-name:hover {
    color: #4a90e2;
}

.file-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7em;
    transition: background 0.3s;
}

.file-remove:hover {
    background: #c82333;
}

/* File Tree Styles */
.tree-folder {
    margin-bottom: 2px;
}

.tree-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    color: #fff;
    font-size: 0.8em;
}

.tree-folder-header:hover {
    background: rgba(74, 95, 193, 0.15);
}

.tree-arrow {
    font-size: 0.7em;
    color: #8892a6;
    width: 12px;
    text-align: center;
    transition: transform 0.2s;
}

.tree-folder-icon {
    font-size: 1em;
}

.tree-folder-name {
    font-weight: 500;
    color: #b0bec5;
}

.tree-children {
    display: block;
}

.tree-file {
    gap: 6px;
}

.tree-file-icon {
    font-size: 0.9em;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-clear {
    background: #3a4160;
    color: #ffffff;
}

.btn-clear:hover {
    background: #4a5170;
}

.btn-convert {
    background: #4a5fc1;
    color: white;
}

.btn-convert:hover:not(:disabled) {
    background: #5b72db;
}

.btn-download {
    background: #28a745;
    color: white;
}

.btn-download:hover {
    background: #218838;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Main Content (Center) ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #2d3250;
    min-width: 0;
}

.preview-header {
    padding: 12px 20px;
    background: #252b42;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-tab {
    color: #ffffff;
    font-size: 0.9em;
    font-weight: 500;
}

.preview-icon {
    color: #4a5fc1;
    font-size: 1.1em;
}

.preview-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e2332;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    color: #5a6278;
}

.preview-placeholder-icon {
    font-size: 3.5em;
    margin-bottom: 12px;
    opacity: 0.3;
}

.preview-placeholder-text {
    font-size: 1em;
    margin-bottom: 6px;
}

.preview-placeholder-subtext {
    font-size: 0.85em;
    opacity: 0.7;
}

/* ==================== Right Details Panel ==================== */
.details-panel {
    width: 260px;
    background: #252b42;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* Panel Tabs */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: #8892a6;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #5b72db;
    border-bottom-color: #5b72db;
}

.tab-content {
    display: none;
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.prop-group {
    margin-bottom: 16px;
}

.prop-group h4 {
    font-size: 0.8em;
    color: #5b72db;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prop-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.prop-label {
    font-size: 0.75em;
    color: #8892a6;
}

.prop-value {
    font-size: 0.78em;
    color: #fff;
    font-weight: 500;
    text-align: right;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.toggle-label {
    font-size: 0.8em;
    color: #ffffff;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a4160;
    transition: 0.3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4a5fc1;
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* ==================== Progress & Status ==================== */
.progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(37, 43, 66, 0.95);
    padding: 16px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #3a4160;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #4a5fc1;
    transition: width 0.3s;
}

.progress-message {
    text-align: center;
    color: #ffffff;
    font-size: 0.85em;
    line-height: 1.6;
}

.progress-message .highlight-failed {
    color: #ff6b7a;
    font-weight: 600;
}

.progress-message .highlight-skipped {
    color: #ffc107;
    font-weight: 600;
}

.progress-message .highlight-success {
    color: #28a745;
    font-weight: 600;
}

/* ==================== Misc ==================== */
input[type="file"] {
    display: none;
}

.hidden {
    display: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #1e2332;
}

::-webkit-scrollbar-thumb {
    background: #3a4160;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a5170;
}

/* NC1 3D Preview */
#nc1PreviewCanvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#nc1PreviewCanvas canvas {
    width: 100% !important;
    height: 100% !important;
}

.preview-controls-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #aaa;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75em;
    pointer-events: none;
    z-index: 10;
    transition: bottom 0.3s ease;
}

/* When progress container is visible, move hint above it */
.preview-controls-hint.with-progress {
    bottom: 90px;
}

/* ==================== Preview Loading Overlay ==================== */
.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 23, 38, 0.88);
    z-index: 20;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(74, 95, 193, 0.25);
    border-top-color: #4a5fc1;
    border-radius: 50%;
    animation: nc1-spin 0.75s linear infinite;
}

@keyframes nc1-spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #8899bb;
    margin-top: 16px;
    font-size: 0.85em;
    letter-spacing: 0.04em;
}
