:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --info-color: #0984e3;
    --border-radius: 6px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    transition: var(--transition);
}

body.dark-theme {
    --light-color: #2d3436;
    --dark-color: #f5f6fa;
    background-color: var(--light-color);
    color: var(--dark-color);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--box-shadow);
    z-index: 10;
}

.logo i {
    font-size: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: bold;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.run-btn {
    background-color: var(--success-color);
    color: white;
}

.run-btn:hover {
    background-color: #00997a;
}

.save-btn {
    background-color: var(--info-color);
    color: white;
}

.save-btn:hover {
    background-color: #0870c0;
}

.new-btn {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.new-btn:hover {
    background-color: #f5b84d;
}

.icon-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle {
    position: relative;
}

.theme-switch {
    display: none;
}

.theme-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 4rem;
    height: 2rem;
    background: var(--dark-color);
    border-radius: 50px;
    padding: 0.3rem;
    position: relative;
    cursor: pointer;
}

.theme-label i {
    font-size: 1rem;
    color: var(--light-color);
    z-index: 1;
}

.theme-ball {
    position: absolute;
    width: 1.6rem;
    height: 1.6rem;
    background-color: var(--light-color);
    border-radius: 50%;
    left: 0.2rem;
    transition: transform 0.3s ease;
}

.theme-switch:checked + .theme-label .theme-ball {
    transform: translateX(2rem);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 200px;
    background-color: var(--light-color);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem;
    overflow-y: auto;
    transition: var(--transition);
}

.file-explorer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.file-item {
    padding: 0.5rem 0.8rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.file-item::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
}

.file-item[data-file$=".html"]::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="%23E44D26" d="M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm308.2 127.9H124.4l4.1 49.4h175.6l-13.6 148.4-97.9 27v.3h-1.1l-98.7-27.3-6-75.8h47.7L138 320l53.5 14.5 53.7-14.5 6-62.2H84.3L71.5 112.2h241.1l-4.4 47.7z"/></svg>');
}

.file-item[data-file$=".css"]::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="%232964BC" d="M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm313.1 80l-4.8 47.3L193 208.6l-.3.1h111.5l-12.8 146.6-98.2 28.7-98.8-29.2-6.4-73.9h48.9l3.2 38.3 52.6 13.3 54.7-15.4 3.7-61.6-119.3-.3-1.6-19.6 119.3-.3-1.6-19.6-118.6-.3-3.2-38.3H306l4.8-47.3H100.3l-4.8-47.3h217.6z"/></svg>');
}

.file-item[data-file$=".js"]::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="%23F7DF1E" d="M0 32v448h448V32H0zm243.8 349.4c0 43.6-25.6 63.5-62.9 63.5-33.7 0-53.2-17.4-63.2-38.5l34.3-20.7c6.6 11.7 12.6 21.6 27.1 21.6 13.8 0 22.6-5.4 22.6-26.5V237.7h42.1v143.7zm99.6 63.5c-39.1 0-64.4-18.6-76.7-43l34.3-19.8c9 14.7 20.8 25.6 41.5 25.6 17.4 0 28.6-8.7 28.6-20.8 0-14.4-11.4-19.5-30.7-28l-10.5-4.5c-30.4-12.9-50.5-29.2-50.5-63.5 0-31.6 24.1-55.6 61.6-55.6 26.8 0 46 9.3 59.8 33.7L368 290c-7.2-12.9-15-18-27.1-18-12.3 0-20.1 7.8-20.1 18 0 12.6 7.8 17.7 25.9 25.6l10.5 4.5c35.8 15.3 55.9 31 55.9 66.2 0 37.8-29.8 58.6-69.7 58.6z"/></svg>');
}

.file-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.file-item.active {
    background-color: var(--primary-color);
    color: white;
}

.dark-theme .file-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-toolbar {
    padding: 0.5rem 1rem;
    background-color: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
}

.file-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.file-tabs::-webkit-scrollbar {
    height: 4px;
}

.file-tabs::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.file-tab {
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.dark-theme .file-tab {
    background-color: rgba(255, 255, 255, 0.05);
}

.file-tab.active {
    background-color: white;
    color: var(--primary-color);
    font-weight: 600;
}

.dark-theme .file-tab.active {
    background-color: #1e272e;
    color: var(--secondary-color);
}

.close-tab {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: var(--transition);
}

.close-tab:hover {
    opacity: 1;
    transform: scale(1.1);
}

.code-editor {
    flex: 1;
    overflow: hidden;
}

.output-container {
    width: 500px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--light-color);
}

.output-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.output-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
    transition: var(--transition);
}

.dark-theme .output-tab {
    color: rgba(255, 255, 255, 0.6);
}

.output-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.output-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

.console-output, .preview-output {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    overflow: auto;
    display: none;
}

.console-output.active-tab, .preview-output.active-tab {
    display: block;
}

.console-output {
    font-family: monospace;
    white-space: pre-wrap;
    background-color: var(--light-color);
    color: var(--dark-color);
}

.preview-output {
    background-color: white;
}

.dark-theme .preview-output {
    background-color: #1e272e;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 1rem;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.8rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .editor-container {
        height: 60%;
    }

    .output-container {
        height: 30%;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark-theme ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dark-theme ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}