
:root {
    --background: #0b1020;
    --surface: #121a2d;
    --surface-light: #19243a;
    --surface-hover: #202e47;
    --primary: #38bdf8;
    --primary-soft: rgba(56, 189, 248, 0.12);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #26334a;
    --success: #4ade80;
    --editor-bg: #080d19;
}

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

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    overflow: hidden;
}

button,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.studio {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% -30%, rgba(56, 189, 248, 0.07), transparent 55%),
        var(--background);
}

/* HEADER */

.studio-header {
    min-height: 76px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(18, 26, 45, 0.96);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 5;
}

.header-left,
.header-actions,
.brand,
.project-info {
    display: flex;
    align-items: center;
}

.header-left {
    gap: 22px;
}

.brand {
    gap: 11px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    font-family: Consolas, monospace;
    font-size: 15px;
}

.brand-name > span {
    color: var(--primary);
}

.header-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.project-info {
    gap: 11px;
}

.project-status,
.footer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.project-info strong {
    display: block;
    font-size: 13px;
}

.project-info small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.workspace-label,
.panel-eyebrow {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.header-actions {
    gap: 10px;
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    margin-right: 10px;
}

.save-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.action-button,
.run-button {
    min-height: 37px;
    padding: 0 14px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    transition: 0.2s;
}

.action-button {
    color: var(--text);
    background: var(--surface-light);
    border: 1px solid var(--border);
}

.action-button:hover {
    background: var(--surface-hover);
    border-color: #475b78;
}

.run-button {
    background: var(--primary);
    color: #07111e;
    border: 1px solid var(--primary);
    padding: 0 20px;
}

.run-button:hover {
    background: #7dd3fc;
    transform: translateY(-1px);
}

/* MAIN WORKSPACE */

.workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    padding: 22px;
    overflow: hidden;
}

.editor-panel,
.preview-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
}

/* PANEL HEADINGS */

.panel-top,
.preview-top {
    min-height: 85px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.panel-top h1,
.preview-top h2 {
    margin-top: 4px;
    font-size: 19px;
    letter-spacing: -0.5px;
}

.workspace-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 20px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
}

.workspace-badge span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

/* FILE TABS */

.file-tabs {
    display: flex;
    align-items: stretch;
    min-height: 48px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.file-tab {
    position: relative;
    min-width: 110px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-right: 1px solid rgba(38, 51, 74, 0.5);
    font-size: 11px;
    white-space: nowrap;
}

.file-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.025);
}

.file-tab.active {
    color: var(--text);
    background: var(--surface);
}

.file-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.file-icon {
    font-family: Consolas, monospace;
    font-size: 12px;
    font-weight: 800;
}

.html-icon {
    color: #fb923c;
}

.css-icon {
    color: #38bdf8;
}

.js-icon {
    color: #facc15;
}

/* EDITOR */

.editor-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
}

.editor-heading {
    min-height: 36px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0c1425;
    border-bottom: 1px solid rgba(38, 51, 74, 0.65);
    color: var(--muted);
    font-size: 10px;
}

.editor-heading > div {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.editor-file-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.code-editor {
    flex: 1;
    min-height: 0;
    display: none;
}

.code-editor.active {
    display: flex;
}

.code-editor textarea {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 250px;
    padding: 23px;
    resize: none;
    outline: none;
    border: 0;
    border-radius: 0;
    background: var(--editor-bg);
    color: #dbeafe;
    caret-color: var(--primary);
    font-family: "Courier New", Consolas, monospace;
    font-size: 13px;
    line-height: 1.9;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.code-editor textarea:focus {
    outline: none;
    background: #090f1e;
}

.code-editor textarea::selection {
    background: rgba(56, 189, 248, 0.25);
}

/* EDITOR FOOTER */

.editor-footer,
.preview-footer {
    min-height: 39px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #0e1729;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
}

.editor-footer > div:first-child,
.preview-footer > span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* PREVIEW */

.preview-top {
    min-height: 85px;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--success);
    font-size: 11px;
}

.preview-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.refresh-button {
    width: 34px;
    height: 34px;
    color: var(--text);
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 18px;
    transition: 0.2s;
}

.refresh-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(45deg);
}

/* BROWSER WINDOW */

.browser-window {
    flex: 1;
    min-height: 0;
    margin: 17px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.browser-toolbar {
    height: 42px;
    min-height: 42px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #edf1f5;
    border-bottom: 1px solid #dbe2ea;
}

.browser-dots {
    display: flex;
    gap: 5px;
}

.browser-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f87171;
}

.browser-dots span:nth-child(2) {
    background: #fbbf24;
}

.browser-dots span:nth-child(3) {
    background: #4ade80;
}

.browser-address {
    flex: 1;
    max-width: 360px;
    padding: 5px 12px;
    border-radius: 5px;
    background: #fff;
    color: #64748b;
    text-align: center;
    font-size: 10px;
}

.browser-menu {
    color: #64748b;
    font-size: 13px;
}

.preview-container {
    position: relative;
    flex: 1;
    min-height: 0;
    background: white;
}

.preview-container iframe {
    width: 100%;
    height: 100%;
    display: block;
    background: white;
    border: 0;
}

.preview-empty {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
    background: #fff;
    color: #1e293b;
}

.preview-empty.visible {
    display: flex;
}

.empty-icon {
    width: 65px;
    height: 65px;
    margin-bottom: 20px;
    display: grid;
    place-items: center;
    color: #0284c7;
    background: #e0f2fe;
    border-radius: 16px;
    font-family: Consolas, monospace;
    font-size: 22px;
}

.preview-empty h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.preview-empty p {
    max-width: 270px;
    color: #64748b;
    font-size: 13px;
}

/* BOTTOM STATUS BAR */

.studio-statusbar {
    min-height: 32px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #101a2d;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-brand {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 1px;
}

/* SCROLLBARS */

textarea::-webkit-scrollbar,
.file-tabs::-webkit-scrollbar {
    width: 7px;
    height: 6px;
}

textarea::-webkit-scrollbar-track {
    background: var(--editor-bg);
}

textarea::-webkit-scrollbar-thumb {
    background: #34445e;
    border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #4b6484;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .workspace {
        gap: 12px;
        padding: 14px;
    }

    .studio-header {
        padding: 0 17px;
    }

    .workspace-label {
        display: none;
    }

    .save-indicator {
        display: none;
    }
}

@media (max-width: 800px) {
    body {
        overflow: auto;
    }

    .studio {
        min-height: 100vh;
        height: auto;
    }

    .studio-header {
        flex-wrap: wrap;
        padding: 13px 16px;
        gap: 12px;
    }

    .header-left {
        flex: 1;
    }

    .header-center {
        display: none;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .workspace {
        display: flex;
        flex-direction: column;
        overflow: visible;
        padding: 12px;
    }

    .editor-panel {
        min-height: 650px;
    }

    .preview-panel {
        min-height: 550px;
    }

    .code-editor textarea {
        min-height: 450px;
    }

    .studio-statusbar {
        flex-wrap: wrap;
        padding: 10px 14px;
    }

    .status-left,
    .status-right {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 520px) {
    .header-divider,
    .project-info {
        display: none;
    }

    .brand {
        font-size: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .action-button,
    .run-button {
        padding: 0 11px;
        font-size: 11px;
    }

    .panel-top,
    .preview-top {
        padding: 15px;
    }

    .panel-top h1,
    .preview-top h2 {
        font-size: 17px;
    }

    .file-tab {
        min-width: 100px;
        padding: 0 10px;
        font-size: 10px;
    }

    .browser-window {
        margin: 10px;
    }

    .preview-footer {
        font-size: 9px;
    }

    .studio-statusbar {
        font-size: 9px;
    }
}
