/* HTML Editor Styles - Visual HTML Editor with WebGL and AI */

.html-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 15px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    flex-shrink: 0;
}

.toolbar-section {
    display: flex;
    gap: 5px;
    align-items: center;
}

.toolbar-btn {
    background: #3d3d3d;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.toolbar-btn:hover {
    background: #4d4d4d;
}

.toolbar-btn:active {
    background: #5d5d5d;
}

.zoom-display {
    background: #3d3d3d;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 50px;
    text-align: center;
}

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

/* Sidebars */
.editor-sidebar {
    width: 280px;
    background: #252526;
    border-right: 1px solid #3d3d3d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-sidebar.right {
    border-right: none;
    border-left: 1px solid #3d3d3d;
}

.sidebar-header {
    padding: 15px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #cccccc;
}

/* Elements Palette */
.elements-palette {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.element-category {
    margin-bottom: 20px;
}

.element-category h4 {
    color: #888;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 0 0 10px 0;
    letter-spacing: 0.5px;
}

.element-item {
    background: #2d2d2d;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.element-item:hover {
    background: #3d3d3d;
    border-color: #667eea;
}

.element-item i {
    color: #667eea;
    width: 16px;
}

/* Canvas Area */
.editor-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    position: relative;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f5f5f5;
    background-image: 
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

#html-editor-canvas {
    width: 100%;
    height: 100%;
}

.elements-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.canvas-element {
    box-sizing: border-box;
    transition: border-color 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-element:hover {
    border-color: rgba(102, 126, 234, 0.8) !important;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.canvas-element.selected {
    border-color: #667eea !important;
    border-style: solid !important;
}

/* Code Editor */
#code-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.code-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.code-tab {
    background: transparent;
    color: #888;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    border-bottom: 2px solid transparent;
}

.code-tab:hover {
    color: #ccc;
    background: rgba(255,255,255,0.05);
}

.code-tab.active {
    color: #fff;
    border-bottom-color: #667eea;
}

.code-textarea {
    flex: 1;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    display: none;
}

.code-textarea.active {
    display: block;
}

.code-textarea:focus {
    outline: none;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.sidebar-tab {
    flex: 1;
    background: transparent;
    color: #888;
    border: none;
    padding: 12px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    border-bottom: 2px solid transparent;
}

.sidebar-tab:hover {
    color: #ccc;
    background: rgba(255,255,255,0.05);
}

.sidebar-tab.active {
    color: #fff;
    border-bottom-color: #667eea;
}

.sidebar-panel {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.sidebar-panel.active {
    display: flex;
    flex-direction: column;
}

/* Properties Panel */
.properties-content {
    padding: 15px;
}

.no-selection {
    color: #888;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

.property-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.property-group {
    background: #2d2d2d;
    border-radius: 6px;
    padding: 12px;
}

.property-group h4 {
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
}

.property-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.property-row label {
    flex: 0 0 80px;
    font-size: 12px;
    color: #ccc;
}

.property-row input,
.property-row select {
    flex: 1;
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #3d3d3d;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.property-row input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 2px;
    cursor: pointer;
}

.property-row input:focus,
.property-row select:focus {
    outline: none;
    border-color: #667eea;
}

/* Layers Panel */
.layers-list {
    padding: 10px;
}

.no-layers {
    color: #888;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

.layer-item {
    background: #2d2d2d;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.layer-item:hover {
    background: #3d3d3d;
    border-color: #667eea;
}

.layer-item i {
    color: #667eea;
    width: 16px;
}

.layer-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-delete {
    background: #d32f2f;
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
}

.layer-delete:hover {
    background: #f44336;
}

/* AI Assistant Panel */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-message.user .message-avatar {
    background: #2d2d2d;
}

.message-content {
    flex: 1;
    background: #2d2d2d;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.message-content p {
    margin: 0 0 10px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 5px;
}

.message-content pre {
    background: #1e1e1e;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #3d3d3d;
}

.message-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #4ec9b0;
}

.copy-code-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    transition: background 0.2s;
}

.copy-code-btn:hover {
    background: #7b8ff5;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.suggestion-btn {
    background: #3d3d3d;
    color: #fff;
    border: 1px solid #667eea;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.suggestion-btn:hover {
    background: #667eea;
}

.ai-chat-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #2d2d2d;
    border-top: 1px solid #3d3d3d;
}

.ai-chat-input input {
    flex: 1;
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #3d3d3d;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.ai-chat-input input:focus {
    outline: none;
    border-color: #667eea;
}

#ai-send-btn {
    background: #667eea;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

#ai-send-btn:hover {
    background: #7b8ff5;
}

/* Project Manager Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2d2d2d;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content.large {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #3d3d3d;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.modal-close {
    background: transparent;
    color: #888;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: #3d3d3d;
    color: #fff;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.project-card {
    background: #252526;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: #667eea;
}

.project-card.new-project {
    border: 2px dashed #667eea;
    background: transparent;
}

.project-icon,
.project-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: #3d3d3d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 32px;
    color: #667eea;
}

.project-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.project-date {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}

.project-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-sm {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-sm:hover {
    background: #7b8ff5;
}

.btn-sm.btn-danger {
    background: #d32f2f;
}

.btn-sm.btn-danger:hover {
    background: #f44336;
}

/* Scrollbar Styling */
.elements-palette::-webkit-scrollbar,
.ai-chat-messages::-webkit-scrollbar,
.layers-list::-webkit-scrollbar,
.canvas-container::-webkit-scrollbar {
    width: 8px;
}

.elements-palette::-webkit-scrollbar-track,
.ai-chat-messages::-webkit-scrollbar-track,
.layers-list::-webkit-scrollbar-track,
.canvas-container::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.elements-palette::-webkit-scrollbar-thumb,
.ai-chat-messages::-webkit-scrollbar-thumb,
.layers-list::-webkit-scrollbar-thumb,
.canvas-container::-webkit-scrollbar-thumb {
    background: #3d3d3d;
    border-radius: 4px;
}

.elements-palette::-webkit-scrollbar-thumb:hover,
.ai-chat-messages::-webkit-scrollbar-thumb:hover,
.layers-list::-webkit-scrollbar-thumb:hover,
.canvas-container::-webkit-scrollbar-thumb:hover {
    background: #4d4d4d;
}
