:root {
    --bg-dark: #0f172a;
    --panel-dark: #1e293b;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --header-height: 60px;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Styles */
.main-header {
    height: var(--header-height);
    background-color: var(--panel-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.logo h1 span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.actions {
    display: flex;
    gap: 12px;
}

.primary-btn,
.secondary-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.primary-btn {
    background-color: var(--accent-blue);
    color: #000;
    border: none;
}

.primary-btn:hover {
    background-color: #7dd3fc;
    transform: translateY(-1px);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background-color: var(--border-color);
}

/* Main Container Layout */
.app-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow: hidden;
    min-height: 0;
    /* Constraint for flex children */
}

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid var(--border-color);
    min-height: 0;
    /* Constraint for flex children */
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    min-height: 0;
    /* CRITICAL: Allows children to be smaller than content */
}

.editor-container:last-child {
    border-bottom: none;
}

.editor-header {
    background-color: #1a2233;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background-color: var(--panel-dark);
    min-height: 0;
    /* Constraint */
}

.line-numbers {
    width: 40px;
    background-color: #1a2233;
    color: #4b5563;
    font-family: var(--font-mono);
    font-size: 14px;
    /* Unify with textarea */
    line-height: 1.6;
    /* Unify with textarea */
    padding-top: 16px;
    text-align: right;
    padding-right: 10px;
    user-select: none;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    /* Allow scrolling via JS */
    height: 100%;
    box-sizing: border-box;
}

.line-number {
    height: 1.6em;
    /* Matches textarea line-height */
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.editor-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor-area textarea,
.highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 16px;
    font-family: var(--font-mono) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    white-space: pre !important;
    word-wrap: normal !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    tab-size: 4 !important;
    -moz-tab-size: 4 !important;
    font-variant-ligatures: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.editor-area textarea {
    background: transparent !important;
    color: transparent !important;
    caret-color: var(--text-primary) !important;
    z-index: 2;
    resize: none;
    overflow: auto;
}

.highlight-layer {
    z-index: 1;
    background: transparent !important;
    pointer-events: none;
    overflow: hidden;
    /* Prevent redundant scrollbars */
}

.highlight-layer code {
    background: transparent !important;
    padding: 0 !important;
    font-family: inherit !important;
}

/* Prism Overrides for Modern Look */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #64748b;
}

.token.punctuation {
    color: #94a3b8;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #f472b6;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: var(--accent-green);
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #fb7185;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: var(--accent-blue);
}

.token.function,
.token.class-name {
    color: #ef4444;
}

.token.regex,
.token.important,
.token.variable {
    color: #fbbf24;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    /* Initial iframe background */
}

.preview-header {
    background-color: var(--panel-dark);
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.iframe-wrapper {
    flex: 1;
    background-color: #fff;
    position: relative;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.toast {
    background-color: #1e293b;
    border-left: 4px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s ease forwards;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .editor-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Suggestion Box */
.suggestion-box {
    position: fixed;
    z-index: 1000;
    background-color: var(--panel-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    display: none;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item.selected {
    background-color: var(--accent-blue);
    color: white;
}

.suggestion-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.05);
}

.suggestion-type {
    font-size: 10px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom scrollbar for suggestion box */
.suggestion-box::-webkit-scrollbar {
    width: 6px;
}

.suggestion-box::-webkit-scrollbar-track {
    background: transparent;
}

.suggestion-box::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
}
}