/* =====================================================
   AI WEBSITE BUILDER - EDITOR STYLES
   ===================================================== */

/* Editor Container */
.editor-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* File Tabs */
.file-tabs {
    display: flex;
    gap: 0.25rem;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
}

.file-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.file-tab svg {
    flex-shrink: 0;
}

/* Toolbar Buttons */
.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.toolbar-btn.primary {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
}

.toolbar-btn.primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

/* Editor Main */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Code Editor */
.code-editor {
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
}

.code-area {
    height: 100%;
    display: flex;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Line Numbers */
.line-numbers {
    padding: 1rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    min-width: 50px;
    overflow-y: hidden;
    flex-shrink: 0;
}

.line-numbers span {
    display: block;
    line-height: 1.6;
}

/* Code Textarea */
#codeTextarea {
    flex: 1;
    padding: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    resize: none;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
    border: none;
    outline: none;
    caret-color: var(--accent-primary);
}

/* Editor Sidebar */

/* Editor Sidebar */
.editor-sidebar {
    width: 600px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Fix for infinite growth */
    min-height: 0; /* Fix for flex scrolling */
}

/* AI Chat */
.ai-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Fix for flex scrolling */
    overflow: hidden;
}

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

.chat-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-height: 0;
}

.chat-message {
    display: flex;
    gap: 0.85rem;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    background: var(--bg-tertiary);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    border-top-left-radius: 4px;
}

.message-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.message-content ul {
    margin: 0.5rem 0 0.5rem 1.2rem !important;
    padding: 0 !important;
}

.message-content li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.message-content li::marker {
    font-size: 0.7em; /* Smaller bullets */
    color: var(--text-muted);
}

.chat-message.user .message-content {
    background: var(--accent-primary);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: 4px;
}

.chat-message.user .message-content p {
    color: white;
}

.chat-message.user {
    flex-direction: row-reverse;
}

/* Chat Input */
.chat-input {
    padding: 1.15rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.6rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chat-input input {
    flex: 1;
    padding: 0.85rem 1.15rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

.chat-input button {
    width: 46px;
    height: 46px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-fast);
}

.chat-input button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.chat-input button svg {
    width: 21px;
    height: 21px;
}

/* =====================================================
   PREVIEW VIEW
   ===================================================== */
.preview-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

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

/* Device Switcher */
.device-switcher {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.device-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.device-btn:hover {
    color: var(--text-primary);
}

.device-btn.active {
    background: var(--accent-gradient);
    color: white;
}

.device-btn svg {
    width: 18px;
    height: 18px;
}

/* Preview URL */
.preview-url {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.url-icon {
    font-size: 0.875rem;
}

.preview-url input {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* Preview Actions */
.preview-actions {
    display: flex;
    gap: 0.5rem;
}

.preview-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.preview-btn svg {
    width: 18px;
    height: 18px;
}

/* Preview Frame Container */
.preview-frame-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-normal);
}

/* Device specific sizes */
.preview-frame-container[data-device="tablet"] .preview-frame {
    width: 768px;
    height: 1024px;
    max-height: calc(100vh - 200px);
}

.preview-frame-container[data-device="mobile"] .preview-frame {
    width: 375px;
    height: 812px;
    max-height: calc(100vh - 200px);
    border-radius: 40px;
}

/* =====================================================
   SYNTAX HIGHLIGHTING (Basic)
   ===================================================== */
.hljs-tag { color: #E06C75; }
.hljs-name { color: #E06C75; }
.hljs-attr { color: #D19A66; }
.hljs-string { color: #98C379; }
.hljs-number { color: #D19A66; }
.hljs-keyword { color: #C678DD; }
.hljs-comment { color: #5C6370; font-style: italic; }
.hljs-function { color: #61AFEF; }
.hljs-class { color: #E5C07B; }
.hljs-selector { color: #E06C75; }
.hljs-property { color: #ABB2BF; }
.hljs-value { color: #98C379; }
.hljs-variable { color: #E06C75; }
.hljs-built_in { color: #E5C07B; }

/* =====================================================
   BUILDER WYSIWYG
   ===================================================== */
.builder-container {
    height: 100%;
    display: flex;
    overflow: hidden;
}

/* Components Panel */
.builder-components {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.components-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.components-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.components-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.component-group {
    margin-bottom: 1rem;
}

.component-group h4 {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.component-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
}

.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: linear-gradient(145deg, #2d2d3a, #252530);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    color: #e0e0e0;
    cursor: grab;
    transition: all var(--transition-fast);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.component-item:hover {
    background: linear-gradient(145deg, #3d3d4a, #353540);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.component-item:active {
    cursor: grabbing;
}

.component-item svg {
    width: 18px;
    height: 18px;
}

.component-item span {
    font-size: 0.625rem;
    font-weight: 500;
}

/* Canvas Wrapper */
.builder-canvas-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-height: 0;
}

/* Custom Scrollbar for Builder Canvas */
.builder-canvas::-webkit-scrollbar {
    width: 8px;
}

.builder-canvas::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.builder-canvas::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.builder-canvas::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

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

.canvas-device-switcher {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.canvas-device {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.canvas-device:hover {
    color: var(--text-primary);
}

.canvas-device.active {
    background: var(--accent-gradient);
    color: white;
}

.canvas-device svg {
    width: 16px;
    height: 16px;
}

.canvas-actions {
    display: flex;
    gap: 0.5rem;
}

.canvas-action {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.canvas-action.primary {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
}

.canvas-action.primary:hover {
    box-shadow: var(--shadow-glow);
}

.canvas-action svg {
    width: 14px;
    height: 14px;
}

/* Builder Canvas */
.builder-canvas {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16161a 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    text-align: center;
    padding: 3rem;
}

.canvas-empty svg {
    width: 64px;
    height: 64px;
    opacity: 0.3;
}

.canvas-empty h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.canvas-empty p {
    font-size: 0.875rem;
}

.canvas-content {
    width: 100%;
    max-width: 1200px;
    min-height: 500px;
    height: auto;
    background: white;
    color: #333;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    overflow: visible;
    margin-bottom: 2rem;
}

/* Ensure all text in canvas is dark by default */
.canvas-content * {
    color: inherit;
}

.canvas-content h1, 
.canvas-content h2, 
.canvas-content h3, 
.canvas-content h4, 
.canvas-content h5, 
.canvas-content h6 {
    color: #1a1a2e;
}

.canvas-content p,
.canvas-content span,
.canvas-content li,
.canvas-content div:not(.element-actions) {
    color: #333;
}

.canvas-content a {
    color: #8B5CF6;
}

.canvas-content button {
    color: white;
}

/* Element actions should stay light */
.canvas-content .element-actions,
.canvas-content .element-actions * {
    color: var(--text-secondary);
}

/* Droppable Elements */
.canvas-element {
    position: relative;
    min-height: 40px;
    border: 2px dashed transparent;
    transition: all var(--transition-fast);
}

.canvas-element:hover {
    border-color: var(--accent-secondary);
}

.canvas-element.selected {
    border-color: var(--accent-primary);
    border-style: solid;
}

.canvas-element.drag-over {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-primary);
}

.element-actions {
    position: absolute;
    top: -28px;
    right: 0;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.canvas-element:hover .element-actions,
.canvas-element.selected .element-actions {
    opacity: 1;
}

.element-action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.element-action-btn:hover {
    background: var(--accent-primary);
    color: white;
}

/* Properties Panel */
.builder-properties {
    width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.properties-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.properties-header h3 {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

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

.no-selection p {
    font-size: 0.8125rem;
}

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

.property-group-header {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.property-item {
    margin-bottom: 0.75rem;
}

.property-label {
    display: block;
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.property-input {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.8125rem;
}

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

.property-textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.4;
}

.property-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.property-btn:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.edit-text-btn {
    background: linear-gradient(135deg, #10B981, #059669);
}

/* Typography Button Group */
.property-btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.property-toggle-btn {
    flex: 1;
    min-width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.property-toggle-btn.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.property-row {
    display: flex;
    gap: 0.5rem;
}

.property-row .property-input {
    flex: 1;
}

/* Text Editing Mode */
.text-editing {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px;
}

.canvas-element.editing-mode {
    border-color: #10B981 !important;
    border-style: solid !important;
}

/* =====================================================
   RESPONSIVE EDITOR
   ===================================================== */
@media (max-width: 1200px) {
    .editor-sidebar {
        width: 300px;
    }
    
    .builder-properties {
        width: 220px;
    }
}

@media (max-width: 992px) {
    .editor-main {
        flex-direction: column;
    }
    
    .editor-sidebar {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .builder-container {
        flex-direction: column;
    }
    
    .builder-components {
        width: 100%;
        height: auto;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .components-list {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
    }
    
    .component-group {
        flex-shrink: 0;
        margin-right: 1rem;
        margin-bottom: 0;
    }
    
    .component-items {
        display: flex;
        gap: 0.375rem;
    }
    
    .builder-properties {
        width: 100%;
        height: 200px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .file-tabs {
        overflow-x: auto;
        max-width: 60vw; /* Limit width to allow space for buttons */
    }
    
    .editor-toolbar {
        display: flex !important;
        position: relative;
        z-index: 50;
        padding: 0.5rem; /* Reduce padding */
        gap: 0.5rem;
    }

    .toolbar-left {
        flex: 1;
        overflow: hidden;
    }

    .toolbar-right {
        flex-shrink: 0;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .preview-url {
        display: none;
    }
    
    .builder-components {
        display: none;
    }
}

/* =====================================================
   NEW MODAL STYLES (Image & Spacer)
   ===================================================== */

.image-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.option-card.active {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.1);
}

.option-icon {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
}

.option-card.active .option-icon {
    color: var(--primary-color);
}

.input-section {
    animation: fadeIn 0.3s ease;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 0.5rem;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.range-control {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.range-control input[type='range'] {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.range-control input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.range-control input[type='range']::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.full-width {
    width: 100%;
}

.modal-content.small {
    max-width: 400px;
}

/* =====================================================
   ASSETS PANEL - DRAG & DROP COMPONENTS
   ===================================================== */

/* Preview container needs relative positioning for the assets panel */
.preview-container {
    position: relative;
}

.assets-panel {
    position: absolute;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.assets-panel.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

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

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

.assets-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

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

.assets-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

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

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

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

.assets-categories {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.assets-category {
    margin-bottom: 0.5rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-header span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.category-header svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.category-header.expanded svg {
    transform: rotate(180deg);
}

.category-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
}

.category-items.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.asset-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all 0.2s;
}

.asset-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.asset-item:active {
    cursor: grabbing;
}

.asset-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

/* Drag active state for whole panel */
.assets-panel.drag-active .asset-item:not(.dragging) {
    opacity: 0.3;
}

.assets-panel.drag-active {
    border-color: var(--accent-primary);
}

.asset-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.375rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.asset-item span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Mini Preview Representations */
.mini-hero {
    width: 100%;
    height: 100%;
    position: relative;
}

.mini-hero.centered::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 30%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
}

.mini-hero.centered::after {
    content: '';
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 12%;
    background: var(--accent-primary);
    border-radius: 3px;
}

.mini-hero.split {
    display: flex;
}

.mini-hero.split::before {
    content: '';
    width: 50%;
    height: 100%;
    background: linear-gradient(180deg, transparent 20%, var(--accent-primary) 20%, var(--accent-primary) 40%, transparent 40%, transparent 50%, var(--accent-secondary) 50%, var(--accent-secondary) 60%, transparent 60%);
}

.mini-hero.split::after {
    content: '';
    width: 50%;
    height: 100%;
    background: var(--bg-hover);
}

.mini-hero.video::before {
    content: '';
    position: absolute;
    inset: 10%;
    background: var(--bg-hover);
    border-radius: 4px;
}

.mini-hero.video::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-primary);
    font-size: 1rem;
}

.mini-nav {
    width: 100%;
    height: 20%;
    background: var(--bg-hover);
    position: absolute;
    top: 0;
    display: flex;
    align-items: center;
    padding: 0 8%;
    gap: 5%;
}

.mini-nav.simple::before {
    content: '';
    width: 15%;
    height: 50%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.mini-nav.simple::after {
    content: '';
    width: 40%;
    height: 30%;
    background: var(--text-muted);
    border-radius: 2px;
    margin-left: auto;
}

.mini-nav.mega::before {
    content: '';
    width: 15%;
    height: 50%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.mini-nav.sidebar {
    width: 20%;
    height: 100%;
    flex-direction: column;
    padding: 10% 5%;
    gap: 8%;
}

.mini-nav.sidebar::before {
    content: '';
    width: 100%;
    height: 15%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6%;
    padding: 10%;
    width: 100%;
    height: 100%;
}

.mini-grid.features > * {
    background: var(--accent-primary);
    border-radius: 2px;
}

.mini-grid::before,
.mini-grid::after {
    content: '';
    background: var(--accent-primary);
    border-radius: 2px;
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: 8%;
    padding: 12%;
    width: 100%;
    height: 100%;
}

.mini-list::before,
.mini-list::after {
    content: '';
    width: 100%;
    height: 25%;
    background: linear-gradient(90deg, var(--accent-primary) 25%, var(--bg-hover) 25%);
    border-radius: 2px;
}

.mini-about {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 8%;
    gap: 5%;
}

.mini-about::before {
    content: '';
    width: 40%;
    height: 100%;
    background: var(--bg-hover);
    border-radius: 3px;
}

.mini-about::after {
    content: '';
    width: 60%;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary) 20%, transparent 20%, transparent 30%, var(--text-muted) 30%, var(--text-muted) 80%, transparent 80%);
}

.mini-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 10%;
}

.mini-stats::before,
.mini-stats::after {
    content: '';
    width: 25%;
    height: 60%;
    background: linear-gradient(180deg, var(--accent-primary) 50%, var(--text-muted) 50%, var(--text-muted) 70%, transparent 70%);
    border-radius: 2px;
}

.mini-card {
    width: 70%;
    height: 80%;
    background: var(--bg-hover);
    border-radius: 3px;
    position: relative;
}

.mini-card.basic::after {
    content: '';
    position: absolute;
    bottom: 15%;
    left: 15%;
    right: 15%;
    height: 40%;
    background: linear-gradient(180deg, var(--accent-primary) 30%, var(--text-muted) 30%, var(--text-muted) 60%, transparent 60%);
}

.mini-card.image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: var(--accent-secondary);
    border-radius: 3px 3px 0 0;
}

.mini-card.profile::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    aspect-ratio: 1;
    background: var(--accent-primary);
    border-radius: 50%;
}

.mini-pricing {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 5%;
    gap: 5%;
}

.mini-pricing::before,
.mini-pricing::after {
    content: '';
    width: 28%;
    height: 90%;
    background: var(--bg-hover);
    border-radius: 2px;
}

.mini-gallery {
    display: grid;
    gap: 4%;
    padding: 8%;
    width: 100%;
    height: 100%;
}

.mini-gallery.grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.mini-gallery.grid::before,
.mini-gallery.grid::after {
    content: '';
    background: var(--accent-secondary);
    border-radius: 2px;
}

.mini-gallery.masonry {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(20%, auto);
}

.mini-gallery.masonry::before {
    content: '';
    background: var(--accent-primary);
    border-radius: 2px;
    grid-row: span 2;
}

.mini-gallery.masonry::after {
    content: '';
    background: var(--accent-secondary);
    border-radius: 2px;
}

.mini-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10%;
    gap: 5%;
}

.mini-carousel::before {
    content: '<';
    color: var(--accent-primary);
    font-weight: bold;
}

.mini-carousel::after {
    content: '>';
    color: var(--accent-primary);
    font-weight: bold;
}

.mini-form {
    display: flex;
    flex-direction: column;
    gap: 8%;
    padding: 15%;
    width: 100%;
    height: 100%;
}

.mini-form::before,
.mini-form::after {
    content: '';
    width: 100%;
    height: 18%;
    background: var(--bg-hover);
    border: 1px solid var(--text-muted);
    border-radius: 2px;
}

.mini-form.contact::after {
    height: 35%;
    margin-top: auto;
    background: var(--accent-primary);
    border: none;
}

.mini-form.newsletter {
    flex-direction: row;
    align-items: center;
}

.mini-form.newsletter::before {
    width: 60%;
    height: 40%;
}

.mini-form.newsletter::after {
    width: 35%;
    height: 40%;
    background: var(--accent-primary);
    border: none;
}

.mini-form.login::before {
    margin-top: 10%;
}

.mini-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10%;
    gap: 10%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
}

.mini-cta.banner::before {
    content: '';
    width: 60%;
    height: 20%;
    background: var(--text-primary);
    border-radius: 2px;
}

.mini-cta.banner::after {
    content: '';
    width: 30%;
    height: 25%;
    background: var(--accent-primary);
    border-radius: 3px;
}

.mini-cta.split {
    flex-direction: row;
}

.mini-cta.split::before {
    content: '';
    width: 50%;
    height: 40%;
    background: var(--text-primary);
}

.mini-cta.split::after {
    content: '';
    width: 25%;
    height: 40%;
    background: var(--accent-primary);
    border-radius: 3px;
}

.mini-buttons {
    display: flex;
    gap: 8%;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.mini-buttons::before {
    content: '';
    width: 30%;
    height: 35%;
    background: var(--accent-primary);
    border-radius: 3px;
}

.mini-buttons::after {
    content: '';
    width: 30%;
    height: 35%;
    background: transparent;
    border: 2px solid var(--accent-primary);
    border-radius: 3px;
}

.mini-testimonial {
    display: flex;
    gap: 5%;
    padding: 8%;
    width: 100%;
    height: 100%;
}

.mini-testimonial.cards::before,
.mini-testimonial.cards::after {
    content: '';
    width: 45%;
    height: 100%;
    background: var(--bg-hover);
    border-radius: 3px;
}

.mini-testimonial.slider {
    align-items: center;
    justify-content: center;
}

.mini-testimonial.slider::before {
    content: '"';
    font-size: 2rem;
    color: var(--accent-primary);
    font-family: serif;
}

.mini-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10%;
}

.mini-footer.simple::before {
    content: '';
    width: 50%;
    height: 30%;
    background: var(--text-muted);
    border-radius: 2px;
}

.mini-footer.columns {
    justify-content: space-around;
    height: 35%;
}

.mini-footer.columns::before,
.mini-footer.columns::after {
    content: '';
    width: 20%;
    height: 60%;
    background: linear-gradient(180deg, var(--accent-primary) 20%, var(--text-muted) 20%, var(--text-muted) 40%, transparent 40%, transparent 50%, var(--text-muted) 50%, var(--text-muted) 70%, transparent 70%);
}

.mini-footer.mega {
    height: 40%;
    justify-content: space-around;
}

/* Drop Zone Highlight */
.drop-zone-highlight {
    outline: 2px dashed var(--accent-primary) !important;
    outline-offset: -2px;
    background: rgba(139, 92, 246, 0.1) !important;
}

.drop-indicator {
    height: 4px;
    background: var(--accent-primary);
    margin: 0.5rem 0;
    border-radius: 2px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Toggle button active state */
#assetsToggleBtn.active {
    background: var(--accent-primary);
    color: white !important;
}

/* Adjust preview container when panel is open */
.preview-container.assets-open .preview-frame-container {
    margin-left: 280px;
}

/* Table editing styles for Live Edit mode */
iframe[name="preview"] table td:hover,
iframe[name="preview"] table th:hover {
    outline: 2px dashed #3b82f6 !important;
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.05) !important;
    cursor: text !important;
}

iframe[name="preview"] table td[contenteditable="true"],
iframe[name="preview"] table th[contenteditable="true"] {
    outline: 2px solid #10b981 !important;
    outline-offset: -2px;
    background: rgba(16, 185, 129, 0.05) !important;
}

iframe[name="preview"] table caption:hover {
    outline: 2px dashed #3b82f6 !important;
    outline-offset: 2px;
    background: rgba(59, 130, 246, 0.05) !important;
    cursor: text !important;
}

iframe[name="preview"] table {
    border-collapse: separate !important;
}
