:root {
    /* Color Palette */
    --primary: #EC4899;
    --primary-hover: #db3787;
    --secondary: #F472B6;
    --accent: #FBCFE8;
    --background: #0F172A;
    --surface-dark: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.1);

    /* Variables */
    --border-radius: 12px;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

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

body {
    background-color: var(--background);
    background-image:
        radial-gradient(at 0% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(244, 114, 182, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Forms & Buttons */
.glass-select {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    /* Custom arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394A3B8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2rem;
}

.glass-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.glass-select option {
    background: var(--surface-dark);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.icon {
    display: block;
}

/* Workspace */
.workspace {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    min-height: 0;
    /* Important for flex child scrolling */
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.3);
}

.pane-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    background: rgba(236, 72, 153, 0.1);
    color: var(--secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
}

/* Editor Container */
.editor-container,
.output-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.4);
}

/* Code Editor Overlays (Textarea + Pre) */
#code-editor,
#highlighted-output {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    border: none;
    overflow: auto;
    white-space: pre;
    tab-size: 4;
}

#code-editor {
    z-index: 2;
    background: transparent;
    color: transparent;
    caret-color: var(--text-main);
    resize: none;
    outline: none;
}

/* Output Editor */
#output-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--accent);
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    tab-size: 4;
}

#highlighted-output {
    z-index: 1;
    color: var(--text-main);
    pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Error Display */
.error-display {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--danger-bg);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 1rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    max-height: 30%;
    overflow-y: auto;
    z-index: 10;
    transition: transform 0.3s ease;
}

.error-display.hidden {
    transform: translateY(100%);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-dark);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .workspace {
        flex-direction: column;
    }

    .pane {
        min-height: 400px;
    }
}