:root {
    --bg-primary: #050510;
    --bg-secondary: rgba(15, 15, 35, 0.7);
    --accent-primary: #00f2fe;
    --accent-secondary: #7000ff;
    --accent-glow: 0 0 20px rgba(0, 242, 254, 0.4);
    --text-main: #e0e0f0;
    --text-dim: #8080a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Varients - Inherited from previous version */
[data-theme="cyberpunk"] {
    --bg-primary: #050510;
    --accent-primary: #00f2fe;
}

[data-theme="midnight"] {
    --bg-primary: #0f0c29;
    --accent-primary: #ff00de;
}

[data-theme="minimal"] {
    --bg-primary: #121212;
    --accent-primary: #ffffff;
}

[data-theme="solar"] {
    --bg-primary: #1a0a0a;
    --accent-primary: #ff4e50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.glass {
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
}

/* Layout Grid */
.app-layout {
    display: grid;
    grid-template-areas: "nav header" "nav stage" "nav footer";
    grid-template-columns: 65px 1fr;
    grid-template-rows: 60px 1fr 30px;
    height: 100vh;
}

/* Side Navigation */
.side-nav {
    grid-area: nav;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    z-index: 100;
    border-right: 1px solid var(--border-color);
}

.pro-logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-bottom: 2rem;
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-grow: 1;
}

.nav-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.4;
    transition: var(--transition-base);
}

.nav-btn:hover,
.nav-btn.active {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(var(--accent-glow));
}

/* Header */
.app-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.header-left h1 {
    font-size: 1.1rem;
}

.header-left h1 span {
    color: var(--accent-primary);
}

.session-info {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    gap: 10px;
}

.save-status {
    color: #2ecc71;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.collab-status {
    font-size: 0.75rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* View Management */
.content-view {
    display: none;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.4s ease;
}

.content-view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* View: Editor */
#view-editor {
    display: none;
    gap: 10px;
    padding: 10px;
}

#view-editor.active {
    display: flex;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
}

.tabs-container {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    height: 40px;
    position: relative;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0 1.2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 2;
}

.tab-btn.active {
    color: var(--text-main);
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: var(--accent-glow);
    transition: var(--transition-base);
}

.editors-container {
    flex-grow: 1;
    position: relative;
    background: #000;
}

.editor-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.editor-wrapper.active {
    display: flex;
}

.gutter {
    width: 45px;
    background: #0a0a0a;
    border-right: 1px solid var(--border-color);
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    text-align: right;
    padding: 15px 10px;
    overflow: hidden;
}

textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    padding: 15px;
    resize: none;
    outline: none;
    line-height: 1.6;
}

/* Collaborative Cursor */
.remote-cursor {
    position: absolute;
    width: 2px;
    height: 20px;
    background: #f1c40f;
    pointer-events: none;
    z-index: 10;
    transition: all 0.1s linear;
}

.cursor-tag {
    position: absolute;
    top: -20px;
    left: 0;
    background: #f1c40f;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Viewport Panel */
.viewport-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-container {
    flex-grow: 1;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-toolbar {
    height: 35px;
    background: #f0f0f5;
    display: flex;
    align-items: center;
    padding: 0 10px;
    justify-content: space-between;
    color: #666;
    font-size: 0.75rem;
    border-bottom: 1px solid #ddd;
}

#main-preview {
    flex-grow: 1;
    border: none;
}

/* Console */
.console-panel {
    height: 200px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    transition: height 0.3s;
}

.console-panel.collapsed {
    height: 40px;
}

.console-header {
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.console-body {
    flex-grow: 1;
    background: #000;
    padding: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    color: #ddd;
}

/* View: Stats */
#view-stats {
    padding: 2rem;
    overflow-y: auto;
}

.stats-dashboard {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    border-radius: 12px;
    padding: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
}

.stat-val {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-top: 1rem;
}

.chart-mock {
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 1rem;
    border-radius: 5px;
    display: flex;
    align-items: flex-end;
    padding: 5px;
}

.bar {
    width: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: height 1s;
}

/* View: Settings */
#view-settings {
    padding: 2rem;
}

.settings-pane {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    border-radius: 12px;
    padding: 2rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.pro-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    width: 100%;
}

/* Collaboration Sidebar */
.collab-sidebar {
    position: fixed;
    right: 10px;
    top: 70px;
    bottom: 40px;
    width: 280px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease;
    transform: translateX(0);
}

.collab-sidebar.hidden {
    transform: translateX(300px);
}

.collab-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
}

.peer-list {
    padding: 1rem;
    flex-grow: 1;
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
}

.peer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.peer-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.collab-chat {
    height: 250px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 0.8rem;
}

.msg {
    margin-bottom: 5px;
}

.msg.system {
    color: var(--accent-primary);
    font-style: italic;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

#chat-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: #fff;
    font-size: 0.8rem;
    padding: 5px 0;
    outline: none;
}

/* Utilities */
.pro-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-base);
}

.pro-btn.primary {
    background: var(--accent-primary);
    color: #000;
}

.pro-btn.ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.pro-btn.danger {
    background: rgba(255, 78, 80, 0.1);
    border-color: rgba(255, 78, 80, 0.3);
    color: #ff4e50;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
}

.pro-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    width: 400px;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.invite-link-box {
    display: flex;
    margin: 1.5rem 0;
    gap: 5px;
}

.invite-link-box input {
    flex-grow: 1;
    background: #000;
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.invite-link-box button {
    background: var(--accent-primary);
    color: #000;
    border: none;
    padding: 0 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* Footer */
.app-footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border-color);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}