/* === DESIGNER MAIN LAYOUT === */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-card: #0f3460;
    --bg-input: #1e2a4a;
    --text: #e0e0e0;
    --text-muted: #a0a0b0;
    --text-bright: #ffffff;
    --border: #2a3a5e;
    --sidebar-width: 280px;
    --toolbar-height: 52px;
    --radius: 8px;
    --transition: 0.2s ease;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--bg-dark);
    color: var(--text);
}

.main-content {
    display: flex;
    height: calc(100vh - var(--toolbar-height));
    margin-top: var(--toolbar-height);
}

/* Viewport */
.viewport {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1a1a2e 100%);
    overflow: hidden;
}

.three-container {
    width: 100%;
    height: 100%;
}

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

/* Viewport Controls */
.viewport-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: rgba(22, 33, 62, 0.9);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.view-btn:hover {
    background: var(--primary);
    color: var(--text-bright);
    border-color: var(--primary);
}

.view-btn.active {
    background: var(--primary);
    color: var(--text-bright);
    border-color: var(--primary);
}

.view-btn .material-icons-outlined {
    font-size: 18px;
}

/* Canvas Overlay */
.canvas-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: rgba(15, 52, 96, 0.95);
    border-left: 2px solid var(--primary);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    color: var(--text-bright);
}

.close-canvas-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.close-canvas-btn:hover {
    background: var(--danger);
    color: white;
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.canvas-wrapper canvas {
    border: 1px solid var(--border);
    background: #ffffff;
    max-width: 100%;
    max-height: 100%;
}

/* Toggle Canvas Button */
.toggle-canvas-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transition: var(--transition);
    z-index: 10;
}

.toggle-canvas-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-bright);
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Export Options */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    text-align: left;
    transition: var(--transition);
}

.export-option:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.export-option .material-icons-outlined {
    font-size: 32px;
    color: var(--primary-light);
}

.export-title {
    font-weight: 600;
    color: var(--text-bright);
    display: block;
}

.export-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.export-progress {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Kit Builder */
.kit-builder {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.kit-item {
    text-align: center;
}

.kit-item h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--text-bright);
}

.kit-preview {
    height: 200px;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.kit-preview:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

/* Designs Grid (Load Modal) */
.designs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.design-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.design-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.design-card-preview {
    height: 140px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
}

.design-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.design-card-info {
    padding: 10px;
}

.design-card-name {
    font-weight: 500;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.design-card-date {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

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