/* === Top Navbar === */
.top-navbar {
    height: 56px;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    flex-shrink: 0;
    z-index: 100;
}

.project-switcher {
    display: flex;
    background-color: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
    border: 1px solid var(--border-color);
}

.project-item {
    padding: 6px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.project-item.active {
    background-color: var(--bg-main);
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* === Placeholder View === */
.placeholder-view {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-workspace);
    padding: 2rem;
}

.placeholder-content {
    text-align: center;
    max-width: 400px;
    padding: 3rem;
    background: var(--bg-main);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.placeholder-icon {
    display: inline-flex;
    padding: 1rem;
    background: var(--accent-light);
    color: var(--accent-color);
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
}

.placeholder-icon svg {
    width: 48px;
    height: 48px;
}

.placeholder-content h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.placeholder-content p {
    color: var(--text-secondary);
}

/* === Left Panel (Editor) === */
.studio-panel { 
    grid-column: 1 / 2; 
    min-height: 0; 
    background: #fdfdfd; 
    border-radius: 20px; 
    border: 1px solid rgba(0, 0, 0, 0.05); 
    display: flex; 
    overflow: visible; 
    padding: 0.75rem; 
    min-width: 0; 
    width: 100%; 
    max-width: 100%; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}
.detailed-mode-container { display: flex; height: 100%; width: 100%; min-height: 0; font-family: 'AiDianQuYaYuan', sans-serif; min-width: 0; }

/* === Mini Sidebar === */
.mini-sidebar { 
    width: 60px; 
    flex-shrink: 0; 
    border: 1.5px solid rgba(255, 255, 255, 0.8); 
    background: rgba(255, 255, 255, 0.4); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 1.25rem 0 0.75rem 0; 
    gap: 0.75rem; 
    position: relative; 
    border-radius: 14px; 
    margin-right: 0.75rem;
    overflow: hidden; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}
.sidebar-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: transparent; border: 1px solid transparent; color: var(--text-secondary); cursor: pointer; transition: all var(--transition-base) ease; flex-shrink: 0; position: relative; }
.sidebar-btn::before { content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%); width: 3px; height: 0; background: var(--accent-color); border-radius: 0 var(--radius-full) var(--radius-full) 0; transition: height var(--transition-base) ease; }
.sidebar-btn:hover { color: var(--accent-color); }
.sidebar-btn:active { transform: translateY(0); }
.sidebar-btn.active { background-color: var(--accent-light); color: var(--accent-color); border-color: var(--accent-highlight); }
.sidebar-btn.active::before { height: 20px; }
.sidebar-btn svg { width: 20px; height: 20px; transition: transform var(--transition-base) ease; }
.sidebar-btn:hover svg { transform: scale(1.05); }

/* === Sidebar Drag & Drop === */
.sidebar-btn { cursor: grab; }
.sidebar-btn:active { cursor: grabbing; }
.sidebar-btn.dragging { opacity: 0.4; transform: scale(0.95); background-color: var(--accent-light); border-color: var(--accent-color); }
.sidebar-btn.drag-over { border-color: var(--accent-color); background-color: var(--accent-light); transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent-color); }
.sidebar-btn.drag-over::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); width: 24px; height: 3px; background: var(--accent-color); border-radius: 2px; }

/* === Add Module Button === */
.add-module-wrapper { position: relative; margin-top: auto; padding-top: 0.5rem; }
.add-module-btn { width: 40px !important; height: 40px !important; padding: 0 !important; border-radius: var(--radius-md) !important; background: transparent !important; border: none !important; color: var(--text-secondary) !important; box-shadow: none !important; transition: all var(--transition-base) ease !important; }
.add-module-btn:hover { background: var(--accent-light) !important; color: var(--accent-color) !important; }
.add-module-btn.active { background: var(--accent-color) !important; color: #ffffff !important; }
.add-module-btn svg { width: 20px; height: 20px; }

/* === Detailed Config Panel (Editor Area) === */
.detailed-config-panel { flex: 1 1 0; min-height: 0; position: relative; overflow: visible; background-color: var(--bg-main); display: flex; flex-direction: column; scrollbar-width: none; -ms-overflow-style: none; }
.detailed-config-panel::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* === Editor Layout === */
.editor-layout { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
.library-layout { flex-direction: column; }

/* === Editor Header === */
.editor-header { background-color: #ffffff; border-bottom: none; flex-shrink: 0; height: 60px; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.editor-heading { font-family: 'AiDianQuYaYuan', sans-serif; font-size: 1.1rem; font-weight: 300; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin: 0; white-space: nowrap; }
.header-right-controls { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

/* === Editor Body === */
.editor-body { 
    flex: 1 1 0; 
    min-height: 0; 
    display: flex; 
    flex-direction: column; 
    padding: 0.75rem; 
    overflow: visible; 
    position: relative;
    background-color: var(--bg-main);
}

.editor-body.scrollable { overflow-y: auto; overflow-x: visible; overscroll-behavior: contain; }

/* === Editor Footer === */
.editor-footer { flex-shrink: 0; background-color: var(--bg-main); border-top: 1px solid var(--border-color); padding: 0.5rem 0.75rem; }

/* === Icon Toggle Button === */
.icon-toggle-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); border: 1.5px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; transition: all var(--transition-base) ease; padding: 0; box-sizing: border-box; line-height: 1; font-size: 0; }
.icon-toggle-btn:hover { background-color: var(--error-bg); color: var(--error-text); transform: scale(1.05); }
.icon-toggle-btn.bordered { border-color: var(--border-color); background: var(--bg-main); }
.icon-toggle-btn.bordered:hover { border-color: var(--error-text); background-color: var(--error-bg); color: var(--error-text); }
.icon-toggle-btn span { display: inline-flex; align-items: center; justify-content: center; line-height: 0; font-size: 0; width: 14px; height: 14px; }
.icon-toggle-btn svg { width: 14px; height: 14px; display: block; }

/* === Resizer === */
.panel-resizer { grid-column: 2 / 3; cursor: col-resize; display: flex; align-items: center; justify-content: center; width: 100%; position: relative; z-index: 50; user-select: none; }
.panel-resizer::after { content: ''; position: absolute; top: 2rem; bottom: 2rem; width: 1px; background: linear-gradient(to bottom, transparent, var(--border-color) 15%, var(--border-color) 85%, transparent); opacity: 0.6; }
.panel-resizer::before { content: ''; width: 6px; height: 48px; background-color: var(--border-color); border-radius: 20px; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 50; }
.panel-resizer:hover::before, .panel-resizer.active::before { height: 64px; background-color: var(--accent-highlight); }

/* === Right Panel (Preview) === */
.right-panel-container { 
    grid-column: 3 / 4; 
    min-height: 0; 
    display: flex; 
    flex-direction: column; 
    background: #ffffff; 
    border-radius: 20px; 
    border: 1px solid rgba(0, 0, 0, 0.05); 
    padding: 0.75rem; 
    overflow: hidden; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}
