:root {
    --bg-dark: #0a0f0f;
    --bg-darker: #050808;
    --bg-panel: #0d1515;
    --bg-input: #1a2a2a;
    --accent-cyan: #00ffcc;
    --accent-green: #00cc88;
    --text-primary: #e0e0e0;
    --text-secondary: #a0b0b0;
    --border-color: #1a3a3a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

header {
    background: linear-gradient(135deg, var(--bg-darker), var(--bg-panel));
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.toolbar {
    display: flex;
    gap: 10px;
}

button {
    background: var(--bg-input);
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

button:hover {
    background: var(--border-color);
    border-color: var(--accent-cyan);
    color: white;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.new-file-btn {
    margin: 0;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 20px;
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.file-item, .dir-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    font-size: 13px;
    user-select: none;
    border-radius: 12px;
    margin: 2px 6px;
}

.file-item.drag-over, .dir-item.drag-over {
    background: rgba(0, 255, 204, 0.3);
    border: 1px dashed var(--accent-cyan);
}

.file-item:hover, .dir-item:hover {
    background: rgba(0, 255, 204, 0.1);
}

.file-item.active {
    background: rgba(0, 255, 204, 0.2);
    border-left: 3px solid var(--accent-cyan);
}

.dir-item {
    font-weight: 500;
}

.file-icon, .dir-icon {
    font-size: 16px;
}

.file-name, .dir-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dir-children {
    margin-left: 20px;
    display: none;
}

.dir-children.open {
    display: block;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff8866;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 4px;
}

.delete-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tabs {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    padding: 0 10px;
}

.tab {
    padding: 8px 16px;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-panel);
    min-width: 140px;
    border-radius: 12px 12px 0 0;
    margin-right: 2px;
}

.tab.active {
    background: var(--bg-dark);
    border-bottom: 2px solid var(--accent-cyan);
}

.tab-name {
    flex: 1;
    outline: none;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

.tab-close {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.tab-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.editor-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.code-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    padding: 8px 15px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.editor-type {
    color: var(--accent-cyan);
}

#code-editor {
    flex: 1;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: none;
    padding: 20px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    overflow: auto;
}

.preview-container {
    flex: 1;
    display: none;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
}

.preview-container.active {
    display: flex;
}

.preview-header {
    padding: 8px 15px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

#preview-frame {
    flex: 1;
    background: white;
    border: none;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}

.settings-panel.active {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.close-settings {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.setting-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a4a4a;
    transition: .3s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.btn-danger {
    background: #3a1a1a;
    border-color: #6a3a3a;
    color: #ff8866;
}

.btn-danger:hover {
    background: #6a2a2a;
}

.status-bar {
    background: var(--bg-panel);
    padding: 6px 15px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.credit {
    color: var(--accent-cyan);
    opacity: 0.6;
}

@media (max-width: 768px) {
    .sidebar {
        width: 220px;
    }
    .settings-panel {
        width: 100%;
        right: -100%;
    }
}
