/* ============================================
   DevCue IDE - Replit-like Browser IDE Styles
   ============================================ */

/* IDE Layout - Full viewport, no scroll */
.ide-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: #1e1e1e;
    color: #cccccc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
}

/* Top Bar */
.ide-topbar {
    display: flex;
    align-items: center;
    height: 40px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    padding: 0 12px;
    flex-shrink: 0;
    gap: 8px;
}

.ide-topbar-title {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ide-topbar-title img {
    height: 20px;
}

.ide-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ide-topbar-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #cccccc;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}

.ide-topbar-btn:hover {
    background: #3c3c3c;
}

.ide-topbar-btn.primary {
    background: #0e639c;
    color: #fff;
}

.ide-topbar-btn.primary:hover {
    background: #1177bb;
}

.ide-topbar-btn.success {
    background: #16825d;
    color: #fff;
}

.ide-topbar-btn.success:hover {
    background: #1a9e6f;
}

/* Main IDE Body */
.ide-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar (File Explorer) */
.ide-sidebar {
    width: 260px;
    min-width: 200px;
    max-width: 400px;
    background: #252526;
    border-right: 1px solid #3c3c3c;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.ide-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

.ide-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #bbbbbb;
    border-bottom: 1px solid #3c3c3c;
}

.ide-sidebar-actions {
    display: flex;
    gap: 2px;
}

.ide-sidebar-btn {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1;
}

.ide-sidebar-btn:hover {
    color: #fff;
    background: #3c3c3c;
}

.ide-file-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}

.ide-file-tree::-webkit-scrollbar {
    width: 6px;
}

.ide-file-tree::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 3px;
}

/* File Tree Items */
.tree-item {
    display: flex;
    align-items: center;
    padding: 2px 8px 2px 0;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    height: 24px;
}

.tree-item:hover {
    background: #2a2d2e;
}

.tree-item.active {
    background: #094771;
    color: #fff;
}

.tree-item .tree-indent {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

.tree-item .tree-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    line-height: 16px;
}

.tree-icon.folder { color: #dcb67a; }
.tree-icon.folder-open { color: #dcb67a; }
.tree-icon.file-cs { color: #68217a; }
.tree-icon.file-js { color: #f1e05a; }
.tree-icon.file-ts { color: #3178c6; }
.tree-icon.file-json { color: #f1e05a; }
.tree-icon.file-html { color: #e34c26; }
.tree-icon.file-css { color: #563d7c; }
.tree-icon.file-razor { color: #512bd4; }
.tree-icon.file-md { color: #083fa1; }
.tree-icon.file-xml { color: #e34c26; }
.tree-icon.file-py { color: #3572a5; }
.tree-icon.file-default { color: #999; }

.tree-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-chevron {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 10px;
    color: #999;
    transition: transform 0.1s;
}

.tree-chevron.expanded {
    transform: rotate(90deg);
}

/* Main Editor Area */
.ide-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Tab Bar */
.ide-tabs {
    display: flex;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    overflow-x: auto;
    flex-shrink: 0;
    height: 36px;
}

.ide-tabs::-webkit-scrollbar {
    height: 0;
}

.ide-tab {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 36px;
    font-size: 12px;
    color: #969696;
    background: #2d2d2d;
    border-right: 1px solid #252526;
    cursor: pointer;
    white-space: nowrap;
    gap: 6px;
    min-width: 0;
    flex-shrink: 0;
}

.ide-tab:hover {
    color: #cccccc;
}

.ide-tab.active {
    background: #1e1e1e;
    color: #ffffff;
    border-top: 2px solid #0e639c;
}

.ide-tab.modified .ide-tab-name::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 50%;
    margin-left: 4px;
}

.ide-tab-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.ide-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ide-tab-close {
    background: none;
    border: none;
    color: #969696;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    border-radius: 3px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    flex-shrink: 0;
}

.ide-tab:hover .ide-tab-close,
.ide-tab.active .ide-tab-close {
    opacity: 1;
}

.ide-tab-close:hover {
    background: #3c3c3c;
    color: #fff;
}

/* Editor Container */
.ide-editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.ide-editor-container .monaco-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
    flex-direction: column;
    gap: 12px;
}

.ide-editor-container .monaco-placeholder i {
    font-size: 48px;
    color: #444;
}

#monaco-editor {
    width: 100%;
    height: 100%;
}

/* Resizable Panels */
.ide-content-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.ide-editor-and-preview {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Preview Panel */
.ide-preview {
    width: 50%;
    min-width: 200px;
    border-left: 1px solid #3c3c3c;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.ide-preview.hidden {
    display: none;
}

.ide-preview-header {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 8px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    font-size: 12px;
    gap: 8px;
}

.ide-preview-url {
    flex: 1;
    background: #3c3c3c;
    border: none;
    color: #cccccc;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    height: 22px;
}

.ide-preview-frame {
    flex: 1;
    border: none;
    background: #fff;
}

/* Bottom Panel (Terminal + AI Chat) */
.ide-bottom-panel {
    height: 250px;
    min-height: 100px;
    max-height: 60vh;
    border-top: 1px solid #3c3c3c;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.ide-bottom-panel.collapsed {
    height: 32px;
    min-height: 32px;
}

.ide-bottom-tabs {
    display: flex;
    align-items: center;
    height: 32px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    padding: 0 8px;
}

.ide-bottom-tab {
    padding: 4px 12px;
    font-size: 12px;
    color: #969696;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    height: 32px;
}

.ide-bottom-tab:hover {
    color: #cccccc;
}

.ide-bottom-tab.active {
    color: #ffffff;
    border-bottom-color: #0e639c;
}

.ide-bottom-toggle {
    margin-left: auto;
    background: none;
    border: none;
    color: #969696;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.ide-bottom-toggle:hover {
    color: #fff;
}

.ide-bottom-content {
    flex: 1;
    overflow: hidden;
}

/* Terminal */
.ide-terminal {
    height: 100%;
    padding: 8px;
    background: #1e1e1e;
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
}

.ide-terminal::-webkit-scrollbar {
    width: 6px;
}

.ide-terminal::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 3px;
}

.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.4;
}

.terminal-line.stdout { color: #cccccc; }
.terminal-line.stderr { color: #f48771; }
.terminal-line.command { color: #569cd6; }
.terminal-line.info { color: #6a9955; }

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 4px;
}

.terminal-prompt {
    color: #6a9955;
    font-weight: bold;
    flex-shrink: 0;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #cccccc;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    caret-color: #fff;
}

/* AI Chat Panel */
.ide-chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    overflow: hidden;
}

.ide-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.ide-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ide-chat-messages::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 3px;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
}

.chat-message .chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.chat-message.user .chat-avatar {
    background: #0e639c;
    color: #fff;
}

.chat-message.assistant .chat-avatar {
    background: #16825d;
    color: #fff;
}

.chat-bubble {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.5;
    max-width: calc(100% - 40px);
}

.chat-bubble pre {
    background: #1e1e1e;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
}

.chat-bubble code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}

.ide-chat-input {
    display: flex;
    padding: 8px 12px;
    border-top: 1px solid #3c3c3c;
    gap: 8px;
}

.ide-chat-input textarea {
    flex: 1;
    background: #3c3c3c;
    border: 1px solid #555;
    color: #cccccc;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 36px;
    max-height: 120px;
    outline: none;
}

.ide-chat-input textarea:focus {
    border-color: #0e639c;
}

.ide-chat-send {
    background: #0e639c;
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    align-self: flex-end;
}

.ide-chat-send:hover {
    background: #1177bb;
}

.ide-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Right sidebar (AI Chat as sidebar) */
.ide-right-sidebar {
    width: 400px;
    min-width: 320px;
    border-left: 1px solid #3c3c3c;
    display: flex;
    flex-direction: column;
    background: #252526;
    flex-shrink: 0;
    overflow: hidden;
    max-height: 100%;
}

.ide-right-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
    overflow: hidden;
}

.ide-right-sidebar-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    height: 36px;
    font-size: 12px;
    font-weight: 600;
    color: #cccccc;
    border-bottom: 1px solid #3c3c3c;
    gap: 8px;
}

.ide-right-sidebar-header .close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
}

.ide-right-sidebar-header .close-btn:hover {
    color: #fff;
}

/* Resize Handle */
.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: #0e639c;
}

.resize-handle-h {
    height: 4px;
    cursor: row-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
}

.resize-handle-h:hover,
.resize-handle-h.dragging {
    background: #0e639c;
}

/* Welcome/Empty State */
.ide-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: #666;
}

.ide-welcome-logo {
    width: 80px;
    opacity: 0.4;
}

.ide-welcome h2 {
    color: #999;
    font-size: 20px;
    font-weight: 400;
}

.ide-welcome-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.ide-welcome-shortcuts kbd {
    background: #3c3c3c;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #ccc;
}

/* Status Bar */
.ide-statusbar {
    display: flex;
    align-items: center;
    height: 24px;
    background: #007acc;
    padding: 0 12px;
    font-size: 11px;
    color: #fff;
    flex-shrink: 0;
    gap: 16px;
}

.ide-statusbar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: default;
}

.ide-statusbar-right {
    margin-left: auto;
    display: flex;
    gap: 16px;
}

/* Loading overlay */
.ide-loading {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.ide-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #3c3c3c;
    border-top-color: #0e639c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Context menu */
.ide-context-menu {
    position: fixed;
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 5px;
    padding: 4px 0;
    min-width: 180px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.ide-context-menu-item {
    display: flex;
    align-items: center;
    padding: 4px 20px;
    font-size: 12px;
    color: #cccccc;
    cursor: pointer;
    gap: 8px;
}

.ide-context-menu-item:hover {
    background: #094771;
}

.ide-context-menu-divider {
    height: 1px;
    background: #3c3c3c;
    margin: 4px 0;
}

/* Notification toast */
.ide-toast {
    position: fixed;
    bottom: 40px;
    right: 20px;
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 13px;
    color: #cccccc;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease-out;
}

.ide-toast.success { border-left: 3px solid #16825d; }
.ide-toast.error { border-left: 3px solid #f48771; }
.ide-toast.info { border-left: 3px solid #0e639c; }

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