/* ================================
   CodingEval Compiler - Global
=================================== */

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

:root {
    --primary-blue: #4F46E5;
    --secondary-purple: #7C3AED;
    --accent-cyan: #06B6D4;

    --dark-bg: #020617;
    --dark-bg-elevated: #020617;
    --dark-bg-soft: #0F172A;

    --card-bg: rgba(15, 23, 42, 0.95);
    --border-subtle: rgba(148, 163, 184, 0.3);

    --text-main: #E5E7EB;
    --text-muted: #9CA3AF;
    --heading: #F9FAFB;

    --success-green: #10B981;
    --error-red: #EF4444;
    --warning-amber: #F59E0B;

    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.9);
    --radius-lg: 16px;
    --radius-md: 10px;

    --transition-fast: 0.15s ease-out;
    --transition-med: 0.2s ease;
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at top left, #111827 0, #020617 40%, #000 100%);
}

/* ================================
   Background Animation
=================================== */

.bg-animation {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.18) 0, transparent 55%),
                radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.18) 0, transparent 55%);
    pointer-events: none;
    z-index: -1;
}

.bg-animation::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(56, 189, 248, 0.08) 0, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(129, 140, 248, 0.12) 0, transparent 50%);
    opacity: 0.9;
}

/* ================================
   Top Navigation
=================================== */

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(24px);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.nav-container {
    max-width: 1400px; /* wider */
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    cursor: pointer;
    user-select: none;
}

.logo i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

.logo span {
    font-weight: 800;
    letter-spacing: 0.05em;
    font-size: 1.05rem;
    color: var(--heading);
}

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

/* ================================
   Buttons
=================================== */

.btn {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.48rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast),
                transform 0.08s ease-out,
                box-shadow 0.08s ease-out;
}

.btn i {
    font-size: 0.9rem;
}

.btn:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Secondary (Save, Share) - Dark theme base */
.btn.btn-secondary {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.75);
}

.btn.btn-secondary:hover:not(:disabled) {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(191, 219, 254, 0.8);
}

/* Primary Run button */
.btn.btn-success {
    background: linear-gradient(135deg, #22C55E, #16A34A);
    color: #f9fafb;
    border-color: rgba(34, 197, 94, 0.8);
    box-shadow: 0 12px 35px rgba(22, 163, 74, 0.75);
}

.btn.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #16A34A, #15803D);
}

/* ================================
   Layout: Editor Container
=================================== */

.editor-container {
    max-width: 1400px; /* wider */
    margin: 1.3rem auto 1.5rem;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr); /* wider sidebar */
    gap: 1.3rem;
    min-height: calc(100vh - 140px);
}

/* 🔄 Expand editor when sidebar collapsed (JS toggles this) */
.editor-container.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

/* ================================
   Sidebar
=================================== */

.sidebar {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.5);
    box-shadow: var(--shadow-soft);
    padding: 1rem 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-med);
}

.sidebar.collapsed {
    transform: translateX(-105%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-toggle {
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast),
                border-color var(--transition-fast),
                transform 0.08s ease-out;
}

.sidebar-toggle:hover {
    background: rgba(30, 64, 175, 0.85);
    border-color: rgba(191, 219, 254, 0.9);
    transform: translateY(-1px);
}

/* Language selector */

.language-selector {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.2rem;
}

.language-selector label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.language-search {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.96);
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-main);
    outline: none;
    width: 100%;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.language-search::placeholder {
    color: rgba(148, 163, 184, 0.8);
}

.language-search:focus {
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.7);
    background: rgba(15, 23, 42, 1);
}

.language-selector select {
    border-radius: 12px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 0.5rem 0.6rem;
    font-size: 0.84rem;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    max-height: 200px;
}

/* Sidebar sections */

.sidebar-section {
    border-top: 1px dashed rgba(75, 85, 99, 0.8);
    padding-top: 0.8rem;
    margin-top: 0.6rem;
}

.sidebar-section h4 {
    font-size: 0.85rem;
    margin-bottom: 0.55rem;
    color: var(--heading);
}

/* Theme options */

.theme-options {
    display: flex;
    gap: 0.55rem;
}

.theme-option {
    flex: 1;
    border-radius: 12px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    padding: 0.45rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    font-size: 0.8rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.92));
    color: var(--text-muted);
    transition: border-color var(--transition-fast), background var(--transition-fast), transform 0.08s ease-out;
}

.theme-option i {
    font-size: 0.9rem;
}

.theme-option.active {
    border-color: rgba(129, 140, 248, 0.95);
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.9), rgba(15, 23, 42, 0.98));
    color: var(--heading);
    transform: translateY(-1px);
}

.theme-option:hover {
    border-color: rgba(129, 140, 248, 0.8);
}

/* Shortcuts */

.shortcuts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.shortcuts-list li {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.shortcut-key {
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    font-size: 0.74rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(55, 65, 81, 0.9);
}

/* ================================
   Editor Area
=================================== */

.editor-area {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Toolbar */

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.99), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(55, 65, 81, 0.95);
    padding: 0.5rem 0.8rem;
    box-shadow: var(--shadow-soft);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 0.5rem;
}

.toolbar-btn {
    border-radius: 999px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                transform 0.08s ease-out;
}

.toolbar-btn i {
    font-size: 0.8rem;
}

.toolbar-btn:hover {
    background: rgba(30, 64, 175, 0.9);
    color: #E5E7EB;
    border-color: rgba(129, 140, 248, 0.9);
    transform: translateY(-1px);
}

/* ================================
   Editor + Output Wrapper
=================================== */

.editor-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 0.9rem;
    align-items: stretch;
}

/* 🔄 Expand editor when output collapsed (JS toggles this) */
.editor-wrapper.output-collapsed {
    grid-template-columns: minmax(0, 1fr) 0;
}

/* ================================
   Code Editor Panel
=================================== */

.code-editor {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(55, 65, 81, 0.95);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Editor header */

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.9rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.95);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
}

.editor-tabs {
    display: flex;
    gap: 0.4rem;
}

.editor-tab {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.2rem 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.95);
}

.editor-tab i {
    font-size: 0.8rem;
}

.editor-tab.active {
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.95), rgba(79, 70, 229, 0.94));
    border-color: rgba(191, 219, 254, 0.9);
    color: #E5E7EB;
}

.editor-dots {
    display: flex;
    gap: 0.35rem;
}

.editor-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.dot-red {
    background: #F97373;
}

.dot-yellow {
    background: #FACC15;
}

.dot-green {
    background: #22C55E;
}

/* Editor content */

.editor-content {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: stretch;
    min-height: 520px; /* taller editor area */
}

.line-numbers {
    background: radial-gradient(circle at top, #020617, #020617);
    border-right: 1px solid rgba(55, 65, 81, 0.9);
    color: rgba(148, 163, 184, 0.9);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    padding: 0.6rem 0.4rem;
    text-align: right;
    white-space: pre;
    user-select: none;
}

#codeInput {
    background: radial-gradient(circle at top, #020617, #020617);
    border: none;
    outline: none;
    color: #E5E7EB;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.88rem;
    padding: 0.65rem 0.8rem;
    resize: none;
    width: 100%;
    height: 100%;
    line-height: 1.55;
}

#codeInput::placeholder {
    color: rgba(100, 116, 139, 0.9);
}

/* ================================
   Output Panel
=================================== */

.output-panel {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(55, 65, 81, 0.95);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.output-panel.collapsed {
    display: none;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.9rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.95);
}

.output-header h3 {
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--heading);
}

.output-header h3 i {
    font-size: 0.82rem;
}

/* Tabs */

.output-tabs {
    display: flex;
    border-bottom: 1px solid rgba(55, 65, 81, 0.95);
}

.output-tab {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-muted);
    border: none;
    border-right: 1px solid rgba(55, 65, 81, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.output-tab:last-child {
    border-right: none;
}

.output-tab i {
    font-size: 0.78rem;
}

.output-tab.active {
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.9), rgba(79, 70, 229, 0.9));
    color: #E5E7EB;
}

/* Output content */

.output-content {
    padding: 0.6rem 0.8rem 0.8rem;
    font-size: 0.8rem;
    flex: 1;
    overflow: auto;
}

.output-tab-content {
    display: none;
}

.output-tab-content.active {
    display: block;
}

.output-message {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    border-left: 3px solid rgba(148, 163, 184, 0.8);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
}

.output-message.success {
    border-left-color: var(--success-green);
}

.output-message.error {
    border-left-color: var(--error-red);
}

.output-message pre {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ================================
   Status Bar
=================================== */

.status-bar {
    position: sticky;
    bottom: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(75, 85, 99, 0.9);
    padding: 0.4rem 1.8rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

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

.status-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.status-item i {
    font-size: 0.78rem;
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--success-green);
}

/* ================================
   Spinner (Run button)
=================================== */

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   Toast Notification
=================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
    display: none;
}

.toast.active {
    display: flex;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.5rem;
}

.toast.success .toast-icon {
    color: var(--success-green);
}

.toast.error .toast-icon {
    color: var(--error-red);
}

.toast-content h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.toast-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ================================
   Light Theme Overrides
=================================== */

body.light-theme {
    background-color: #e5e7eb; /* grey */
    color: #0f172a;
}

body.light-theme .bg-animation {
    background: #e5e7eb;
}

body.light-theme .bg-animation::before {
    background:
        radial-gradient(circle at 20% 50%, rgba(148, 163, 184, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(156, 163, 175, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(209, 213, 219, 0.5) 0%, transparent 50%);
}

body.light-theme nav {
    background: rgba(243, 244, 246, 0.96);
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

/* Logo strong in light theme */
body.light-theme .logo span {
    color: #111827;
    text-shadow: 0 0 4px rgba(209, 213, 219, 0.8);
}

body.light-theme .logo i {
    -webkit-text-fill-color: #4F46E5;
    text-shadow: 0 0 10px rgba(79, 70, 229, 0.7);
}

body.light-theme .sidebar {
    background: rgba(249, 250, 251, 0.97);
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    border-color: #e5e7eb;
}

body.light-theme .language-search {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

body.light-theme .language-search::placeholder {
    color: #6b7280;
}

body.light-theme .language-selector select {
    background: #f9fafb;
    color: #111827;
    border-color: #d1d5db;
}

body.light-theme .sidebar-section {
    border-top-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .theme-option {
    background: #f3f4f6;
}

body.light-theme .theme-option:hover {
    background: #e5e7eb;
}

body.light-theme .shortcuts-list li {
    color: #4b5563;
}

body.light-theme .shortcut-key {
    background: #e5e7eb;
}

/* Toolbar & editor */

body.light-theme .editor-toolbar {
    background: #f3f4f6;
    border-bottom-color: rgba(15, 23, 42, 0.08);
    border-color: #d1d5db;
}

body.light-theme .toolbar-btn {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

body.light-theme .toolbar-btn:hover {
    background: #d1d5db;
}

body.light-theme .code-editor {
    background: #f9fafb;
    border-color: #d1d5db;
}

body.light-theme .editor-header {
    background: #e5e7eb;
    border-bottom-color: #d1d5db;
}

body.light-theme .editor-tab {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
}

body.light-theme .editor-tab.active {
    background: #e0e7ff;
    border-color: #4f46e5;
    color: #111827;
}

body.light-theme .line-numbers {
    background: #e5e7eb;
    color: #6b7280;
    border-right-color: #d1d5db;
}

body.light-theme #codeInput {
    color: #111827;
    background: #f9fafb;
}

body.light-theme #codeInput::placeholder {
    color: #9ca3af;
}

/* Output */

body.light-theme .output-panel {
    background: #f9fafb;
    border-left-color: #d1d5db;
    border-color: #d1d5db;
}

body.light-theme .output-header {
    border-bottom-color: #d1d5db;
}

body.light-theme .output-tabs {
    border-bottom-color: #d1d5db;
}

body.light-theme .output-tab {
    color: #6b7280;
    background: #f3f4f6;
    border-right-color: #e5e7eb;
}

body.light-theme .output-tab.active {
    color: #111827;
    background: #e0e7ff;
}

body.light-theme .output-message {
    background: #f3f4f6;
    border-left-color: #9ca3af;
    color: #111827;
}

body.light-theme .output-message.success {
    background: #dcfce7;
    border-left-color: #16a34a;
}

body.light-theme .output-message.error {
    background: #fee2e2;
    border-left-color: #ef4444;
}

/* Status bar */

body.light-theme .status-bar {
    background: #f3f4f6;
    border-top-color: #d1d5db;
    color: #6b7280;
}

body.light-theme .status-item {
    color: #4b5563;
}

/* Toast */

body.light-theme .toast {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

/* ✅ Fix: Buttons looking disabled in light theme */

body.light-theme .btn {
    cursor: pointer;
    opacity: 1;
}

body.light-theme .btn.btn-secondary {
    background: #e5e7eb;
    color: #111827;
    border-color: #9ca3af;
}

body.light-theme .btn.btn-secondary:hover {
    background: #d1d5db;
}

body.light-theme .btn.btn-success {
    background: #16a34a;
    color: #f9fafb;
    border-color: #15803d;
}

body.light-theme .btn.btn-success:hover {
    background: #15803d;
}

/* ================================
   Responsive
=================================== */

@media (max-width: 968px) {
    .editor-container {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 1rem;
        min-height: auto;
    }

    .sidebar {
        position: fixed;
        top: 3.25rem;
        left: 0.75rem;
        width: 260px;
        z-index: 120;
    }

    .sidebar.collapsed {
        transform: translateX(-105%);
    }

    .editor-wrapper {
        grid-template-columns: minmax(0, 1fr);
    }

    .output-panel {
        margin-top: 0.7rem;
    }

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

    /* Status bar behaves like normal footer on small screens */
    .status-bar {
        position: relative;
        padding-inline: 1.2rem;
        font-size: 0.78rem;
    }

    /* Slightly shorter editor so it fits better below nav */
    .editor-content {
        min-height: 360px;
    }
}

/* ==========================================
   FIX: Dropdown (select) background too dark
   and unreadable options in dark & light mode
========================================== */

.language-selector select {
    background: rgba(15, 23, 42, 0.98) !important; /* darker */
    color: #E5E7EB !important;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

/* Dropdown options */
.language-selector select option {
    background: rgba(15, 23, 42, 0.98);
    color: #E5E7EB;
    padding: 0.45rem;
    font-size: 0.85rem;
}

/* Hover effect for options (Chrome only) */
.language-selector select option:checked,
.language-selector select option:hover {
    background: rgba(30, 58, 138, 0.9); /* blue-ish highlight */
    color: #fff;
}

/* Scrollbar styling */
.language-selector select::-webkit-scrollbar {
    width: 8px;
}
.language-selector select::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.8);
    border-radius: 8px;
}
.language-selector select::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

/* ==========================================
   LIGHT THEME FIXES
========================================== */

body.light-theme .language-selector select {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #d1d5db;
}

body.light-theme .language-selector select option {
    background: #ffffff !important;
    color: #111827 !important;
}

body.light-theme .language-selector select option:hover,
body.light-theme .language-selector select option:checked {
    background: #e0e7ff !important;
    color: #1e3a8a !important;
}

body.light-theme .language-selector select::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

