:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #3c3c3c;
    --bg-active: #37373d;
    --border-color: #3c3c3c;
    --text-primary: #cccccc;
    --text-secondary: #858585;
    --text-bright: #ffffff;
    --accent-blue: #007acc;
    --accent-green: #4ec9b0;
    --accent-orange: #ce9178;
    --accent-purple: #c586c0;
    --accent-yellow: #dcdcaa;
    --activity-bar-width: 48px;
    --tab-height: 35px;
    --status-bar-height: 22px;
    --title-bar-height: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Title Bar */
.title-bar {
    height: var(--title-bar-height);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-color);
    -webkit-app-region: drag;
}

.title-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-bar-icon {
    font-size: 16px;
}

.title-bar-menu {
    display: flex;
    gap: 4px;
}

.menu-item {
    padding: 2px 8px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.title-bar-title {
    font-size: 12px;
    color: var(--text-secondary);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.title-bar-controls {
    display: flex;
    gap: 8px;
    -webkit-app-region: no-drag;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.15s;
}

.window-control:hover {
    opacity: 0.8;
}

.control-close {
    background: #ff5f57;
}

.control-minimize {
    background: #febc2e;
}

.control-maximize {
    background: #28c840;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Activity Bar */
.activity-bar {
    width: var(--activity-bar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    border-right: 1px solid var(--border-color);
}

.activity-item {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    font-size: 22px;
    transition: all 0.15s;
}

.activity-item:hover {
    color: var(--text-primary);
}

.activity-item.active {
    color: var(--text-bright);
}

.activity-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-blue);
}

.activity-item .tooltip {
    position: absolute;
    left: calc(100% + 8px);
    background: var(--bg-tertiary);
    color: var(--text-bright);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.activity-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.activity-spacer {
    flex: 1;
}

.activity-divider {
    width: 24px;
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs */
.tabs-container {
    height: var(--tab-height);
    background: var(--bg-tertiary);
    display: flex;
    align-items: flex-end;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.tabs-container::-webkit-scrollbar {
    height: 3px;
}

.tabs-container::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
}

.tab {
    height: calc(var(--tab-height) - 1px);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    min-width: 120px;
    max-width: 200px;
    transition: background 0.15s;
    position: relative;
}

.tab:hover {
    background: var(--bg-hover);
}

.tab.active {
    background: var(--bg-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent-blue);
}

.tab-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.tab-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.tab-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.15s;
    font-size: 14px;
}

.tab:hover .tab-close {
    opacity: 0.6;
}

.tab-close:hover {
    opacity: 1 !important;
    background: var(--bg-hover);
}

.tab-add {
    width: 28px;
    height: var(--tab-height);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.15s;
}

.tab-add:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Editor Area */
.editor-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.iframe-container.active {
    display: block;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

/* Welcome Screen */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 40px;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-logo {
    font-size: 80px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 20px rgba(0, 122, 204, 0.3));
}

.welcome-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.welcome-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 32px;
}

.welcome-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.welcome-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 14px;
}

.welcome-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.welcome-card-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 8px;
}

.welcome-card-content {
    flex: 1;
}

.welcome-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-bright);
    margin-bottom: 2px;
}

.welcome-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Status Bar */
.status-bar {
    height: var(--status-bar-height);
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 12px;
    color: #fff;
}

.status-bar-left,
.status-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0 6px;
    height: 100%;
    transition: background 0.15s;
}

.status-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ec9b0;
}

.status-dot.warning {
    background: #dcdcaa;
}

.status-dot.error {
    background: #f14c4c;
}

/* Command Palette */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 2000;
}

.command-palette-overlay.active {
    display: flex;
}

.command-palette {
    width: 600px;
    max-width: 90%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.command-palette-input {
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text-bright);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    border-bottom: 1px solid var(--border-color);
}

.command-palette-input::placeholder {
    color: var(--text-secondary);
}

.command-list {
    max-height: 300px;
    overflow-y: auto;
}

.command-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.command-item:hover,
.command-item.selected {
    background: var(--bg-hover);
}

.command-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.command-item-title {
    flex: 1;
    font-size: 13px;
}

.command-item-shortcut {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* Loading animation */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .tab-title {
        display: none;
    }

    .tab {
        min-width: auto;
        padding: 0 10px;
    }
}
