:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(30, 41, 59, 0.7);
    --sidebar-width: 260px;
    --sidebar-collapsed: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    max-width: none;
    overflow: hidden;
    display: flex;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    flex-shrink: 0;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

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

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
}

#sidebar.collapsed .brand {
    display: none;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem 0.5rem;
    font-weight: 600;
    white-space: nowrap;
}

#sidebar.collapsed .menu-label,
#sidebar.collapsed .btn-text {
    display: none;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-align: left;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-btn.primary {
    background: var(--primary);
    color: white;
    margin-bottom: 0.5rem;
}

.nav-btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-btn.accent {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.nav-btn.accent:hover {
    background: rgba(139, 92, 246, 0.2);
}

.nav-btn i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
#main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
}

/* Workspace (Editor + Preview) */
#workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-dark);
}

.pane-header {
    height: 48px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pane-title {
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#page {
    flex: 1;
    background: #1e1e1e;
    /* VS Code-like bg */
    border: none;
    color: #e0e0e0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 1rem;
    resize: none;
    outline: none;
}

#preview {
    flex: 1;
    background: white;
    border: none;
    width: 100%;
    height: 100%;
}

/* Resizer handle if we wanted one, purely visual for now assuming 50/50 split or simple CSS flex */
.resizer {
    width: 1px;
    background: var(--border);
    cursor: col-resize;
}

/* Bottom Panel */
#bottom-panel {
    height: 200px;
    background: var(--bg-card);
    padding: 1rem;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.link-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.output-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.output-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.85rem;
}

/* Inputs */
.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.styled-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utilities */
.hidden {
    display: none;
}