:root {
    --bg: #080b14;
    --bg-panel: rgba(10, 14, 28, 0.75);
    --bg-header: rgba(8, 11, 20, 0.85);
    --text: #e8eaf0;
    --text-dim: #6b7280;
    --gold: #d4a853;
    --gold-light: #f0c040;
    --cyan: #00f5d4;
    --purple: #7b2ff7;
    --blue: #38bdf8;
    --green: #3fb950;
    --red: #f85149;
    --border: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow-cyan: rgba(0, 245, 212, 0.15);
    --glow-purple: rgba(123, 47, 247, 0.15);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ============ THREE.JS BACKGROUND ============ */

#bg-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

#css3d-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ============ UI LAYER ============ */

#ui-layer {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ============ HEADER ============ */

header#topbar {
    background: var(--bg-header);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; }
.logo-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}
.logo { height: 28px; }
.brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand-ver {
    font-weight: 400;
    color: var(--cyan);
    font-size: 0.85rem;
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

/* Dropdown */
select {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    max-width: 200px;
}
select:hover { border-color: var(--cyan); }
select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 2px var(--glow-cyan); }

optgroup { background: var(--bg); color: var(--text-dim); font-style: normal; font-weight: 600; }
option { background: var(--bg); color: var(--text); }

/* Backend radios */
.backend-group {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 2px;
    border: 1px solid var(--glass-border);
}
.radio-label {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    transition: all 0.2s;
    color: var(--text-dim);
}
.radio-label input { display: none; }
.radio-label:has(input:checked) {
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: #fff;
    box-shadow: 0 2px 8px var(--glow-cyan);
}

.llvm-opts {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.check-label {
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
}
.check-label input { accent-color: var(--cyan); }

/* Run button */
.btn-run {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: #080b14;
    border: none;
    padding: 0.45rem 1.1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: 'Inter', sans-serif;
}
.btn-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 168, 83, 0.4);
}
.btn-run:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-run.running {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 83, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(212, 168, 83, 0); }
}

#beklemeSuresi {
    font-size: 0.75rem;
    color: var(--red);
    font-weight: 600;
    min-width: 1.5rem;
    font-variant-numeric: tabular-nums;
}

/* ============ PANELS ============ */

.panels {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 0.5rem;
    gap: 0;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--glow-cyan), transparent 40%, transparent 60%, var(--glow-purple));
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}

.panel-editor { margin-right: 0.25rem; }
.panel-output { margin-left: 0.25rem; }

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-icon { font-size: 0.9rem; }

.panel-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.btn-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.btn-clear:hover { color: var(--red); background: rgba(248, 81, 73, 0.1); }

/* Monaco Editor container */
#monacoContainer {
    flex: 1;
    min-height: 0;
}

/* Output */
.output-content {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-all;
}

.output-content.error { color: var(--red); }
.output-content.success { color: var(--green); }

/* ============ DIVIDER ============ */

.panel-divider {
    width: 6px;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}
.panel-divider::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: var(--glass-border);
    border-radius: 2px;
    transition: background 0.2s, height 0.2s;
}
.panel-divider:hover::after {
    background: var(--cyan);
    height: 60px;
    box-shadow: 0 0 10px var(--glow-cyan);
}

/* ============ STATUS BAR ============ */

footer#statusbar {
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 0.3rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-dim);
    flex-shrink: 0;
    height: 28px;
}

#derlemeZamani {
    font-variant-numeric: tabular-nums;
    color: var(--green);
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
    .panels { flex-direction: column; }
    .panel-editor { margin-right: 0; margin-bottom: 0.25rem; }
    .panel-output { margin-left: 0; margin-top: 0.25rem; }
    .panel-divider { display: none; }
    .backend-group { display: none; }
    .llvm-opts { display: none !important; }
    header#topbar { padding: 0 0.75rem; }
    .brand-text { font-size: 0.9rem; }
    select { max-width: 140px; }
}

/* ============ NEON ANIMATION ============ */

@keyframes neonGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.panel::before {
    animation: neonGlow 4s ease-in-out infinite;
}

/* ============ LOADING SPINNER ============ */

.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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