/* Playground Specific Styles */
.playground-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--vscode-editor);
}

/* Tab Bar Styling */
.tab-bar {
    display: flex;
    background-color: var(--vscode-tabs);
    border-bottom: 1px solid var(--vscode-border);
    height: 35px;
    align-items: center;
}

.tab {
    padding: 8px 16px;
    background-color: transparent;
    color: var(--vscode-text-muted);
    cursor: pointer;
    border: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    user-select: none;
}

.tab:hover {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
}

.tab.active {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
    border-bottom-color: var(--vscode-accent);
}

/* Full View Button */
.full-view-btn {
    padding: 8px 12px;
    background-color: transparent;
    color: var(--vscode-text-muted);
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
    user-select: none;
}

.full-view-btn:hover {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
}

.full-view-btn.active {
    background-color: var(--vscode-accent);
    color: var(--vscode-text);
}

/* Font Controls */
.font-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
}

.font-btn {
    padding: 4px 8px;
    background-color: transparent;
    color: var(--vscode-text-muted);
    cursor: pointer;
    border: none;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    border-radius: 3px;
    user-select: none;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.font-btn:hover {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
}

.font-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.font-size-display {
    color: var(--vscode-text-muted);
    font-size: 11px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
    user-select: none;
}

/* Split Container */
.split-container {
    flex: 1;
    display: flex;
    height: calc(100% - 35px);
    position: relative;
}



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

/* Resizer */
.resizer {
    width: 6px;
    background-color: var(--vscode-border);
    cursor: col-resize;
    position: relative;
    transition: background-color 0.2s ease;
    z-index: 10;
    flex-shrink: 0;
    user-select: none;
}

.resizer:hover,
.resizer.dragging {
    background-color: var(--vscode-accent);
    width: 8px;
}

.resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background-color: var(--vscode-text-muted);
    border-radius: 1px;
    transition: opacity 0.2s ease;
}

.resizer:hover::before,
.resizer.dragging::before {
    opacity: 0.7;
}

/* Prevent text selection during resize */
.split-container.resizing {
    user-select: none;
    cursor: col-resize;
}

.split-container.resizing * {
    user-select: none;
    pointer-events: none;
}

.split-container.resizing .resizer {
    pointer-events: auto;
}

/* Ensure proper flex behavior */
.editor-pane {
    flex: 1;
    min-width: 300px;
    max-width: calc(100% - 306px); /* Account for resizer width and preview min-width */
    background-color: var(--vscode-editor);
    position: relative;
    transition: none; /* Remove transition during resize for smooth dragging */
}

.editor-pane.resizing {
    transition: none;
}

.preview-pane {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background-color: var(--vscode-bg);
    border-left: 1px solid var(--vscode-border);
    transition: none; /* Remove transition during resize for smooth dragging */
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--vscode-tabs);
    border-bottom: 1px solid var(--vscode-border);
    font-size: 12px;
    color: var(--vscode-text);
    height: 35px;
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.preview-controls button {
    background: none;
    border: none;
    color: var(--vscode-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-1);
    font-size: 14px;
    transition: all 0.2s ease;
}

.preview-controls button:hover {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
}

#preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background-color: white;
}

/* Fullscreen Preview */
.preview-pane.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    min-width: unset;
}

.preview-pane.fullscreen .preview-header {
    background-color: var(--vscode-bg);
}

/* Monaco Editor Theme Integration */
.monaco-editor {
    background-color: var(--vscode-editor) !important;
}

.monaco-editor .monaco-editor-background {
    background-color: var(--vscode-editor) !important;
}

/* Enhanced Light Mode Editor Styling */
.light-theme .monaco-editor {
    background-color: #fafafa !important;
}

.light-theme .monaco-editor .monaco-editor-background {
    background-color: #fafafa !important;
}

.light-theme .monaco-editor .margin {
    background-color: #f3f4f6 !important;
}

.light-theme .monaco-editor .monaco-scrollable-element {
    background-color: #fafafa !important;
}

/* Improved text contrast in light mode */
.light-theme .monaco-editor .view-line {
    color: #111827 !important;
}

.light-theme .monaco-editor .token.comment {
    color: #4b5563 !important;
}

.light-theme .monaco-editor .token.string {
    color: #065f46 !important;
}

.light-theme .monaco-editor .token.keyword {
    color: #1e40af !important;
}

.light-theme .monaco-editor .token.function {
    color: #5b21b6 !important;
}

/* Enhanced tab styling for light mode */
.light-theme .tab-bar {
    background-color: #e5e7eb !important;
    border-bottom-color: #d1d5db !important;
}

.light-theme .tab {
    color: #374151 !important;
}

.light-theme .tab:hover {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
}

.light-theme .tab.active {
    background-color: #fafafa !important;
    color: #111827 !important;
    border-bottom-color: #1d4ed8 !important;
}

/* Enhanced preview pane for light mode */
.light-theme .preview-pane {
    background-color: #ffffff !important;
    border-left-color: #d1d5db !important;
}

.light-theme .preview-header {
    background-color: #e5e7eb !important;
    border-bottom-color: #d1d5db !important;
    color: #111827 !important;
}

.light-theme .preview-controls button {
    color: #374151 !important;
}

.light-theme .preview-controls button:hover {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
}

/* Enhanced resizer for light mode */
.light-theme .resizer {
    background-color: #d1d5db !important;
}

.light-theme .resizer:hover,
.light-theme .resizer.dragging {
    background-color: #1d4ed8 !important;
}

.light-theme .resizer::before {
    background-color: #6b7280 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
    }
    
    .resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }
    
    .resizer::before {
        width: 20px;
        height: 2px;
    }
    
    .editor-pane,
    .preview-pane {
        min-width: unset;
        min-height: 200px;
    }
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--vscode-text-muted);
    font-size: 14px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--vscode-border);
    border-top: 2px solid var(--vscode-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--vscode-error);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Code Examples */
.code-example {
    background-color: var(--vscode-sidebar);
    border: 1px solid var(--vscode-border);
    border-radius: var(--radius-2);
    padding: 16px;
    margin: 16px 0;
}

.code-example h3 {
    color: var(--vscode-text);
    margin-bottom: 12px;
    font-size: 14px;
}

.code-example p {
    color: var(--vscode-text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

/* Welcome Message */
.welcome-message {
    padding: 20px;
    color: var(--vscode-text);
    max-width: 600px;
    margin: 0 auto;
}

.welcome-message h1 {
    color: var(--vscode-accent);
    margin-bottom: 16px;
}

.welcome-message p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.feature-list li {
    padding: 4px 0;
    color: var(--vscode-text-muted);
}

.feature-list li::before {
    content: '✓';
    color: var(--vscode-success);
    margin-right: 8px;
    font-weight: bold;
}

/* Full View Mode */
.full-view-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background-color: var(--vscode-editor) !important;
}

.full-view-mode .main-content {
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

.full-view-mode .playground-container {
    height: 100vh !important;
    border-radius: 0 !important;
}

.full-view-mode .tab-bar {
    border-radius: 0 !important;
}

.full-view-mode .split-container {
    height: calc(100vh - 35px) !important;
}

/* Full View Mode Responsive */
@media (max-width: 768px) {
    .full-view-mode .tab-bar {
        flex-wrap: wrap;
        height: auto;
        min-height: 35px;
    }
    
    .full-view-mode .full-view-btn {
        margin-left: 0;
        margin-top: 4px;
    }
}
