:root {
    --primary-color: #0dcaf0;
    --primary-hover: #0bb8d9;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --dark-bg: #1e1e1e;
    --darker-bg: #111;
    --editor-bg: #252526;
    --border-color: #333;
    --text-color: #fff;
    --text-muted: #aaa;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 6px;
    --transition: all 0.2s ease;
}

[data-theme="light"] {
    --dark-bg: #f8f9fa;
    --darker-bg: #e9ecef;
    --editor-bg: #ffffff;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
    --primary-hover: #0aa5c4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--dark-bg);
    color: var(--text-color);
    transition: var(--transition);
}

/* Header Styles */
header {
    background: var(--darker-bg);
    padding: 12px 20px;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.header-content h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 10px;
}
.btns-box{
    display: flex;
    gap: 10px;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
    outline: none;
}

.icon-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.icon-btn:hover {
    color: var(--primary-color);
    background: rgba(13, 202, 240, 0.1);
}

/* Container Layout */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Editors Panel */
#editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
    min-width: 200px;
    overflow: hidden;
}

/* Editor Sections */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 45px;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.editor-section.minimized {
    flex: 0 0 40px;
}

.editor-section.minimized .editor {
    display: none;
}

.editor-section.hidden {
    display: none;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--darker-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    user-select: none;
}

.editor-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-controls {
    display: flex;
    gap: 4px;
}

#html-editor,
#css-editor,
#js-editor {
    flex: 1;
    min-height: 80px;
    overflow: hidden;
}



/* Main Divider */
#divider {
    width: 8px;
    background: var(--border-color);
    /* cursor: col-resize; */
    /* user-select: none; */
    /* flex-shrink: 0; */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}



/* Preview Panel */
#preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--darker-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    user-select: none;
}

.preview-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-controls {
    display: flex;
    gap: 4px;
}

.preview-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    gap: 10px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.preview-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid transparent;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    background: var(--darker-bg);
    color: var(--text-color);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast i {
    font-size: 16px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Fullscreen mode */
body.fullscreen {
    overflow: hidden;
}

body.fullscreen header,
body.fullscreen #editor-panel,
body.fullscreen #divider {
    display: none;
}

body.fullscreen #preview-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
}

body.fullscreen .preview-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 101;
}

body.fullscreen .preview-container {
    position: absolute;
    top: 45px;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Responsive Design */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    

    .header-content {
        flex-direction: column;
        gap: 10px;
        align-items: center ;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 600px) {
    .header-content h1 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        max-width: 100%;
    }
}

/* Smooth transitions */
#html-section,
#css-section,
#js-section,
#editor-panel,
#preview-panel,
#html-editor,
#css-editor,
#js-editor,
#preview {
    transition: var(--transition);
}

/* Monaco Editor Customization */
.monaco-editor {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Focus styles for accessibility */
button:focus-visible,
.icon-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}