/* ===== PIXELUI GENERATOR STYLES ===== */

/* WIP Notice */
.wip-notice {
    background-color: var(--warning);
    color: #000;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.wip-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.wip-content i {
    width: 24px;
    height: 24px;
    color: #d97706;
}

.wip-text {
    flex: 1;
}

.wip-text h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #92400e;
}

.wip-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #451a03;
    line-height: 1.4;
}

.wip-dismiss {
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.wip-dismiss:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Generator Layout */
.generator-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
    padding-top: var(--nav-height);
}

.generator-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-left {
    flex: 0 0 auto;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
}

.toolbar-right {
    flex: 0 0 auto;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 0.5rem;
}

.zoom-level {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 3rem;
    text-align: center;
    margin: 0 0.25rem;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    min-width: 36px;
    height: 36px;
    justify-content: center;
}

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

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tool-btn:disabled:hover {
    background: none;
    color: var(--text-secondary);
    border-color: transparent;
}

.tool-btn.active {
    background-color: var(--primary-color-10);
    color: var(--primary-color);
    border-color: var(--primary-color-20);
}

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

.tool-btn.btn-primary:hover {
    background-color: var(--primary-color-hover);
    border-color: var(--primary-color-hover);
}

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

.tool-btn.btn-success:hover {
    background-color: var(--success-color-hover);
    border-color: var(--success-color-hover);
}

.tool-btn:active,
.tool-btn.active {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tool-btn.primary {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

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

.tool-btn.success {
    background-color: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

.tool-btn.success:hover {
    opacity: 0.9;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 0.5rem;
}

.zoom-level {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

/* Main Content Layout */
.generator-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Widget Library */
.widget-library {
    width: 300px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.library-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.library-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.library-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.library-search::placeholder {
    color: var(--text-muted);
}

.library-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.widget-category {
    margin-bottom: 1.5rem;
}

.widget-category h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem;
}

.widget-category h4 i {
    width: 16px;
    height: 16px;
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.widget-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.widget-item:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.widget-item:active {
    cursor: grabbing;
    transform: translateY(0);
}

.widget-item span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

/* Widget Previews */
.widget-preview {
    width: 40px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-button {
    width: 32px;
    height: 12px;
    background-color: var(--primary);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: white;
    font-weight: 500;
}

.preview-input {
    width: 36px;
    height: 10px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
}

.preview-input.password::after {
    content: '•••';
    font-size: 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.preview-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    color: var(--text-secondary);
}

.preview-checkbox .check {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 1px;
    position: relative;
}

.preview-checkbox .check::after {
    content: '✓';
    color: white;
    font-size: 6px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.preview-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    color: var(--text-secondary);
}

.preview-radio .radio {
    width: 8px;
    height: 8px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    position: relative;
}

.preview-radio .radio::after {
    content: '';
    width: 4px;
    height: 4px;
    background-color: var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.preview-toggle {
    width: 20px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 4px;
    position: relative;
}

.preview-toggle::after {
    content: '';
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    right: 1px;
}

.preview-slider {
    width: 32px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-track {
    width: 100%;
    height: 2px;
    background-color: var(--border-color);
    border-radius: 1px;
    position: relative;
}

.slider-thumb {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.slider-thumb.left {
    left: 25%;
}

.slider-thumb.right {
    right: 25%;
}

.slider-thumb:not(.left):not(.right) {
    left: 60%;
}

.preview-numeric {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 8px;
    color: var(--text-secondary);
}

.numeric-buttons {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.btn-up, .btn-down {
    width: 6px;
    height: 4px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4px;
    color: var(--text-muted);
}

.preview-combo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 32px;
    height: 10px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 0 2px;
    font-size: 6px;
    color: var(--text-muted);
}

.combo-arrow {
    font-size: 4px;
}

.preview-color-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 20px;
    height: 20px;
}

.color-swatch {
    border-radius: 1px;
}

.color-swatch.red { background-color: #ef4444; }
.color-swatch.green { background-color: #10b981; }
.color-swatch.blue { background-color: #3b82f6; }
.color-swatch.yellow { background-color: #f59e0b; }

.preview-label {
    font-size: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.preview-progress {
    width: 32px;
    height: 4px;
    background-color: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    width: 60%;
    height: 100%;
    background-color: var(--primary);
}

.preview-ring, .preview-circular {
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
    position: relative;
}

.ring-fill, .circular-fill {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
    border-radius: 50%;
    transform: rotate(45deg);
}

.preview-loading {
    width: 24px;
    height: 4px;
    background-color: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    width: 8px;
    height: 100%;
    background-color: var(--primary);
    animation: loading-slide 1s ease-in-out infinite;
}

@keyframes loading-slide {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(200%); }
    100% { transform: translateX(200%); }
}

.preview-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--bg-secondary);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.preview-chart {
    width: 32px;
    height: 16px;
    position: relative;
    background-color: var(--bg-secondary);
    border-radius: 2px;
}

.chart-line {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 28px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    clip-path: polygon(0% 100%, 25% 60%, 50% 80%, 75% 40%, 100% 20%, 100% 100%);
}

.preview-canvas {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 18px;
    height: 12px;
}

.canvas-pixel {
    background-color: var(--primary);
    border-radius: 1px;
}

.canvas-pixel:nth-child(2) {
    background-color: var(--accent);
}

.canvas-pixel:nth-child(3) {
    background-color: var(--warning);
}

.preview-container {
    width: 36px;
    height: 20px;
    position: relative;
}

.container-border {
    width: 100%;
    height: 100%;
    border: 1px dashed var(--border-color);
    border-radius: 2px;
}

.preview-group {
    width: 36px;
    height: 20px;
    position: relative;
}

.group-title {
    position: absolute;
    top: -2px;
    left: 4px;
    font-size: 6px;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    padding: 0 2px;
}

.group-border {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    margin-top: 2px;
}

.preview-tabs {
    display: flex;
    width: 32px;
    height: 16px;
    flex-direction: column;
}

.tab {
    flex: 1;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 2px 2px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6px;
    color: var(--text-muted);
}

.tab.active {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
}

.preview-list {
    width: 32px;
    height: 18px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    padding: 1px;
}

.list-item {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 2px;
    font-size: 6px;
    color: var(--text-muted);
}

.list-item.selected {
    background-color: var(--primary);
    color: white;
}

.preview-tree {
    width: 32px;
    height: 16px;
    display: flex;
    align-items: center;
    padding: 0 2px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 6px;
    color: var(--text-secondary);
}

.tree-icon {
    font-size: 4px;
}

.preview-scrollbar {
    width: 6px;
    height: 20px;
}

.scrollbar-track {
    width: 100%;
    height: 100%;
    background-color: var(--bg-secondary);
    border-radius: 3px;
    position: relative;
}

.scrollbar-thumb {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 3px;
    position: absolute;
    top: 4px;
}

.preview-spacer {
    width: 24px;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--border-color) 0px,
        var(--border-color) 2px,
        transparent 2px,
        transparent 4px
    );
}

.preview-modal {
    width: 32px;
    height: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    height: 6px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modal-content {
    flex: 1;
    background-color: var(--bg-primary);
}

.preview-window {
    width: 32px;
    height: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
}

.window-title {
    height: 6px;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    padding: 0 2px;
    font-size: 6px;
    color: white;
}

.window-content {
    flex: 1;
    background-color: var(--bg-primary);
}

.preview-msgbox {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 24px;
    height: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 0 2px;
}

.msgbox-icon {
    width: 6px;
    height: 6px;
    background-color: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4px;
    color: white;
    font-weight: bold;
}

.msgbox-text {
    font-size: 6px;
    color: var(--text-secondary);
}

.preview-color-dialog {
    width: 24px;
    height: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 2px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    height: 100%;
}

.color-cell {
    background-color: var(--primary);
    border-radius: 1px;
}

.color-cell:nth-child(2) { background-color: var(--accent); }
.color-cell:nth-child(3) { background-color: var(--warning); }
.color-cell:nth-child(4) { background-color: #ef4444; }

.preview-breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 6px;
    color: var(--text-secondary);
}

.separator {
    color: var(--text-muted);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.canvas-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.canvas-title {
    font-weight: 600;
    color: var(--text-primary);
}

.canvas-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.canvas-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: auto;
    background-color: var(--bg-secondary);
}

.canvas-rulers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.ruler-horizontal {
    position: absolute;
    top: 0;
    left: 20px;
    right: 0;
    height: 20px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    background-image: linear-gradient(90deg, var(--border-color) 0px, transparent 1px);
    background-size: 10px 100%;
}

.ruler-vertical {
    position: absolute;
    top: 20px;
    left: 0;
    bottom: 0;
    width: 20px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    background-image: linear-gradient(0deg, var(--border-color) 0px, transparent 1px);
    background-size: 100% 10px;
}

.ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.canvas-viewport {
    padding: 40px;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas {
    position: relative;
    width: 612px; /* 51 * 12px */
    height: 228px; /* 19 * 12px */
    background-color: #000000;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: crosshair;
}

.canvas-background {
    position: absolute;
    inset: 0;
    background-color: #000000;
}

.canvas-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.canvas-grid.visible {
    opacity: 1;
}

.canvas-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.selection-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Canvas Elements */
.canvas-element {
    position: absolute;
    user-select: none;
    cursor: move;
    border: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.canvas-element:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

.canvas-element.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.canvas-element.dragging {
    z-index: 1000;
    opacity: 0.8;
}

/* Resize Handles */
.resize-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border: 1px solid white;
    border-radius: 1px;
    pointer-events: all;
    z-index: 10;
}

.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.n { top: -4px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.e { top: 50%; right: -4px; transform: translateY(-50%); cursor: e-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.resize-handle.s { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.w { top: 50%; left: -4px; transform: translateY(-50%); cursor: w-resize; }

/* Properties Panel */
.properties-panel {
    width: 320px;
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.panel-toggle:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    height: 200px;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.no-selection i {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

.no-selection p {
    margin: 0;
    font-size: 0.9rem;
}

/* Properties Header */
.properties-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.properties-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.element-type {
    font-size: 0.8rem;
    color: var(--text-muted);
    background-color: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

/* Property Sections */
.property-section {
    border-bottom: 1px solid var(--border-color);
}

.property-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding: 0.75rem 1.25rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.section-content {
    padding: 1rem 1.25rem;
}

/* Property Groups */
.property-group {
    margin-bottom: 1.5rem;
}

.property-group:last-child {
    margin-bottom: 0;
}

.property-group-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.property-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.property-row:last-child {
    margin-bottom: 0;
}

.property-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.property-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color var(--transition-fast);
}

.property-input:focus {
    outline: none;
    border-color: var(--primary);
}

.property-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.property-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.property-color {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-preview {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.color-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, #ccc 25%, transparent 25%),
                linear-gradient(-45deg, #ccc 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #ccc 75%),
                linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.color-value {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.property-select {
    position: relative;
}

.property-select select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.property-range {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.property-range input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.property-range-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
    font-family: var(--font-mono);
}

/* Layers Panel */
.layers-panel {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 300px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.panel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.panel-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.panel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.layers-list {
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.layer-item:hover {
    background-color: var(--bg-secondary);
}

.layer-item.selected {
    background-color: var(--primary-color-10);
    color: var(--text-primary);
    border-color: var(--primary-color-20);
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: auto;
}

.layer-visibility,
.layer-lock {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.8rem;
}

.layer-visibility:hover,
.layer-lock:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.layer-info {
    flex: 1;
    min-width: 0;
}

.layer-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.layer-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: lowercase;
}

.layer-item.selected .layer-icon {
    color: var(--text-inverse);
}

.layer-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.layer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    opacity: 0.7;
}

.layer-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.visible .modal-dialog {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Export Modal */
.export-dialog {
    max-width: 900px;
}

.export-options {
    margin-bottom: 1.5rem;
}

.export-format {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.export-format label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}

.export-format input[type="radio"] {
    accent-color: var(--primary);
}

.export-settings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
}

.code-output {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.filename {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.copy-code-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-code-btn:hover {
    background-color: var(--primary-hover);
}

.code-output pre {
    margin: 0;
    padding: 1rem;
    background: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
}

/* Preview Modal */
.preview-dialog {
    max-width: 700px;
}

.preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.computercraft-screen {
    background-color: #000000;
    border: 4px solid #333333;
    border-radius: 8px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 1px;
}

.screen-content {
    width: 612px; /* 51 characters * 12px */
    height: 228px; /* 19 lines * 12px */
    background-color: #000000;
    color: #ffffff;
    overflow: hidden;
    position: relative;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all var(--transition-fast);
}

.context-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.context-item:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.context-item.danger {
    color: var(--error);
}

.context-item.danger:hover {
    background-color: var(--error);
    color: var(--text-inverse);
}

.context-item i {
    width: 16px;
    height: 16px;
}

.shortcut {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.context-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .widget-library {
        width: 240px;
    }
    
    .properties-panel {
        width: 260px;
    }
}

@media (max-width: 1200px) {
    .toolbar-section span {
        display: none;
    }
    
    .widget-grid {
        grid-template-columns: 1fr;
    }
    
    .layers-panel {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .generator-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .widget-library {
        position: fixed;
        left: -280px;
        top: var(--nav-height);
        bottom: 0;
        z-index: 300;
        transition: left var(--transition-normal);
    }
    
    .widget-library.open {
        left: 0;
    }
    
    .properties-panel {
        position: fixed;
        right: -300px;
        top: var(--nav-height);
        bottom: 0;
        z-index: 300;
        transition: right var(--transition-normal);
    }
    
    .properties-panel.open {
        right: 0;
    }
    
    .layers-panel {
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        bottom: 0.5rem;
    }
    
    .canvas {
        transform: scale(0.8);
        transform-origin: center;
    }
    
    .modal-dialog {
        width: 95vw;
        margin: 1rem;
    }
}

/* Syntax Highlighting */
.keyword { color: #569cd6; font-weight: bold; }
.string { color: #ce9178; }
.comment { color: #6a9955; font-style: italic; }
.number { color: #b5cea8; }

/* Copy Button States */
.copy-btn.success {
    background: var(--success-color) !important;
    color: white !important;
}

.copy-btn.error {
    background: var(--danger-color) !important;
    color: white !important;
}

/* Layer Visibility and Lock States */
.layer-visibility.hidden,
.layer-lock.locked {
    opacity: 0.6;
    background: var(--gray-600);
}

.layer-visibility.hidden i::before { content: "👁"; }
.layer-visibility.visible i::before { content: "👁"; }
.layer-lock.locked i::before { content: "🔒"; }
.layer-lock.unlocked i::before { content: "🔓"; }

/* Property Field Improvements */
.property-field {
    margin-bottom: 0.75rem;
}

.property-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-300);
    margin-bottom: 0.25rem;
}

.property-input,
.property-select,
.property-checkbox {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--gray-600);
    border-radius: 0.25rem;
    background: var(--gray-700);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.property-checkbox {
    width: auto;
    margin-right: 0.5rem;
}

.property-input:focus,
.property-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Color Picker Field */
.color-picker-field {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-picker-field .property-select {
    flex: 1;
}

.color-preview {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    border: 1px solid var(--gray-600);
    flex-shrink: 0;
}

/* Canvas Element Improvements */
.canvas-element {
    box-sizing: border-box;
    transition: all 0.1s ease;
}

.canvas-element.selected {
    outline: 2px solid var(--primary-color);
    outline-offset: -1px;
}

.canvas-element:hover:not(.selected) {
    outline: 1px solid var(--primary-color-50);
}

/* Resize Handles */
.resize-handles {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border: 1px solid white;
    border-radius: 50%;
    pointer-events: all;
    cursor: pointer;
}

.resize-handle.nw { top: 0; left: 0; cursor: nw-resize; }
.resize-handle.n { top: 0; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle.ne { top: 0; right: 0; cursor: ne-resize; }
.resize-handle.e { top: 50%; right: 0; transform: translateY(-50%); cursor: e-resize; }
.resize-handle.se { bottom: 0; right: 0; cursor: se-resize; }
.resize-handle.s { bottom: 0; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle.sw { bottom: 0; left: 0; cursor: sw-resize; }
.resize-handle.w { top: 50%; left: 0; transform: translateY(-50%); cursor: w-resize; }

/* No Selection/Preview States */
.no-selection,
.no-layers,
.no-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-400);
    text-align: center;
    height: 100%;
    min-height: 200px;
}

.no-selection i,
.no-layers i,
.no-preview i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Layer Item Improvements */
.layer-item {
    transition: all 0.15s ease;
}

.layer-item:hover {
    background: var(--gray-700);
}

.layer-item.selected {
    background: var(--primary-color-10);
    border-color: var(--primary-color);
}

.layer-thumbnail {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--gray-600);
}

.thumbnail-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Widget Item Improvements */
.widget-item {
    transition: all 0.15s ease;
    cursor: pointer;
}

.widget-item:hover {
    background: var(--gray-700);
    transform: translateY(-1px);
}

.widget-item:active {
    transform: translateY(0);
}

/* Modal Improvements */
.modal {
    backdrop-filter: blur(8px);
}

.modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gray-600);
}

/* Export Format Buttons */
.export-formats {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.export-format {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-600);
    background: var(--gray-700);
    color: var(--text-primary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.export-format:hover {
    background: var(--gray-600);
}

.export-format.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Code Block */
#export-code {
    background: var(--gray-900);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 400px;
    overflow: auto;
    white-space: pre;
    border: 1px solid var(--gray-600);
}

/* Preview Canvas */
.preview-canvas {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    overflow: hidden;
}
