:root {
    --primary: #74B9FF;
    --primary-dark: #0984E3;
    --secondary: #DFE6E9;
    --accent: #E17055;
    --background: #0A121A;
    --surface: #1E272E;
    --border: #2D3436;
    --text-main: #F5F6FA;
    --text-muted: #B2BEC3;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

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

body {
    background-color: var(--background);
    color: var(--text-main);
    font-family: var(--font-family);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    height: 60px;
    background-color: rgba(30, 39, 46, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

button:hover {
    background-color: rgba(116, 185, 255, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.primary-btn {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

/* Main Layout */
.main-container {
    flex: 1;
    display: flex;
    height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
}

.editors-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--background);
    border-right: 1px solid var(--border);
    min-width: 200px;
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    min-height: 50px;
    position: relative;
}

.editor-pane:last-child {
    border-bottom: none;
}

.pane-header {
    height: 30px;
    background-color: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.pane-header span i {
    margin-right: 5px;
}

.pane-header .copy-btn {
    border: none;
    padding: 2px 6px;
    font-size: 0.8rem;
}

.code-editor {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* CodeMirror Overrides */
.CodeMirror {
    height: 100% !important;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    background-color: var(--background) !important;
    color: #F8F8F2 !important;
}

.CodeMirror-gutters {
    background-color: var(--background) !important;
    border-right: 1px solid var(--border) !important;
}

/* Resizer */
.resizer {
    width: 6px;
    background-color: var(--border);
    cursor: col-resize;
    z-index: 5;
    transition: background-color 0.2s;
}

.resizer:hover {
    background-color: var(--primary);
}

/* Preview */
.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
    min-width: 200px;
}

.preview-header {
    background-color: var(--surface);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    height: 30px;
}

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

/* Console */
.console-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: var(--transition);
}

.console-panel.hidden {
    display: none;
}

.console-header {
    background-color: #2D3436;
    height: 30px;
    border-bottom: 1px solid #000;
}

.console-actions button {
    border: none;
    padding: 2px 6px;
    color: var(--text-muted);
}

.console-actions button:hover {
    color: var(--accent);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: #F8F8F2;
    background-color: #000;
}

.log-entry {
    margin-bottom: 4px;
    border-bottom: 1px solid #333;
    padding-bottom: 2px;
}

.log-log { color: #fff; }
.log-info { color: #74B9FF; }
.log-warn { color: #FAB1A0; }
.log-error { color: #FF7675; }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--primary);
    font-weight: 500;
}

.close-modal-btn {
    border: none;
    font-size: 1.5rem;
    padding: 0;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

textarea {
    width: 100%;
    height: 150px;
    background-color: var(--background);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    background-color: var(--background);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Layout Specifics */
.editors-container.horizontal {
    flex-direction: row;
}

.editor-pane.horizontal {
    border-bottom: none;
    border-right: 1px solid var(--border);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 0 10px;
    }

    .logo span {
        display: none;
    }

    .actions button span {
        display: none;
    }

    .main-container {
        flex-direction: column;
    }

    .editors-container {
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .resizer {
        height: 6px;
        width: 100%;
        cursor: row-resize;
    }

    .preview-container {
        height: 50%;
    }
}
