@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap");

/* ==================== ROOT VARIABLES ==================== */
:root {
    --primary-color: #00aaff;
    --bg-dark: #0a0a0f;
    --bg-darker: #05050a;
    --text-light: #ffffff;
    --text-muted: #ffffff;
    --accent-glow: rgba(0, 170, 255, 0.3);
    --card-bg: rgba(15, 15, 25, 0.8);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 62.5%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background: url('bg_image.jpg') center/cover fixed no-repeat;
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(2px);
    pointer-events: none;
    z-index: 0;
}

/* ==================== NAVIGATION ==================== */
.nav-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 2rem 0;
    backdrop-filter: blur(30px) saturate(180%);
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 170, 255, 0.1), 
                0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    font-size: 2.4rem;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.logo-bracket {
    color: var(--primary-color);
    font-size: 2.8rem;
}

.logo:hover .logo-text {
    color: var(--primary-color);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    padding-top: 10rem;
    padding-bottom: 5rem;
    position: relative;
    z-index: 2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ==================== HERO SECTION ==================== */
.hero-section {
    text-align: center;
    margin-bottom: 6rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.hero-cta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-btn,
.ghost-btn {
    padding: 1.5rem 3rem;
    font-size: 1.6rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-light);
}

.primary-btn {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.4), rgba(0, 170, 255, 0.2));
    border-color: rgba(0, 170, 255, 0.6);
    box-shadow: 0 8px 30px rgba(0, 170, 255, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 170, 255, 0.45);
}

.ghost-btn {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.ghost-btn:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.icon-wrapper {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 170, 255, 0.2),
                0 8px 32px rgba(0, 170, 255, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(0, 170, 255, 0.2),
                    0 8px 32px rgba(0, 170, 255, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(0, 170, 255, 0.4),
                    0 16px 48px rgba(0, 170, 255, 0.2);
    }
}

.main-title {
    font-size: 5rem;
    font-weight: 900;
    color: var(--text-light);
    text-shadow: 0 0 30px rgba(0, 170, 255, 0.3);
}

.subtitle {
    font-size: 1.8rem;
    color: var(--text-muted);
    max-width: 600px;
}

/* ==================== INTERPRETER SECTION ==================== */
.interpreter-section {
    margin-bottom: 6rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 3.2rem;
    color: var(--text-light);
}

.status-pill {
    padding: 1rem 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffaa00;
}

.status-pill[data-state="loading"] .status-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-pill[data-state="ready"] {
    border-color: rgba(0, 255, 128, 0.4);
    color: #00ff9d;
}

.status-pill[data-state="ready"] .status-dot {
    background: #00ff9d;
}

.status-pill[data-state="error"] {
    border-color: rgba(255, 68, 68, 0.4);
    color: #ff8888;
}

.status-pill[data-state="error"] .status-dot {
    background: #ff5555;
}

/* ==================== LANGUAGE TABS ==================== */
.language-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.lang-tab {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.2rem 2.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1.4rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-tab i {
    font-size: 1.8rem;
}

.lang-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 170, 255, 0.4);
    color: var(--text-light);
    transform: translateY(-2px);
}

.lang-tab.active {
    background: rgba(0, 170, 255, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.2);
}

.lang-tab.active i {
    color: var(--primary-color);
}

.interpreter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
}

.editor-card,
.output-card,
.info-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    padding: 3rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.03);
}

.editor-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.run-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.run-controls button {
    min-width: 140px;
    justify-content: center;
}

.code-shell {
    position: relative;
    min-height: 280px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 5, 15, 0.85);
}

.code-shell textarea,
.code-shell .code-highlight {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    line-height: 1.7;
    padding: 2rem;
    min-height: 280px;
    width: 100%;
    border: none;
    resize: none;
    tab-size: 4;
}

.code-shell textarea {
    position: relative;
    background: transparent;
    color: transparent;
    caret-color: var(--text-light);
    z-index: 2;
}

.code-shell textarea:focus {
    outline: none;
}

.code-shell .code-highlight {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    color: var(--token-base, #d4d4d4);
    white-space: pre-wrap;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* Syntax Highlighting Tokens (driven by CSS variables set via JS) */
.token-comment { color: var(--token-comment, #6a9955); font-style: italic; }
.token-string { color: var(--token-string, #ce9178); }
.token-number { color: var(--token-number, #b5cea8); }
.token-keyword { color: var(--token-keyword, #569cd6); font-weight: 600; }
.token-builtin { color: var(--token-builtin, #dcdcaa); }
.token-function { color: var(--token-function, #dcdcaa); }
.token-decorator { color: var(--token-decorator, #d7ba7d); }
.token-operator { color: var(--token-operator, #d4d4d4); }
.token-punctuation { color: var(--token-punctuation, #d4d4d4); }

/* Theme Selector */
.theme-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.theme-selector label {
    font-size: 1.8rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.theme-selector select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 1.3rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-selector select:hover {
    border-color: var(--primary-color);
}

.theme-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.2);
}

.theme-selector select option {
    background: #1e1e2e;
    color: #fff;
}

.output-card {
    min-height: 260px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.output-header h3 {
    font-size: 1.8rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.console-body {
    background: rgba(5, 5, 15, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    min-height: 180px;
    max-height: 320px;
    overflow-y: auto;
    padding: 1.8rem;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    color: var(--text-light);
    white-space: pre-wrap;
}

textarea::-webkit-scrollbar,
.console-body::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track,
.console-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb,
.console-body::-webkit-scrollbar-thumb {
    background: rgba(0, 170, 255, 0.6);
    border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb:hover,
.console-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 170, 255, 0.8);
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

.console-line {
    margin-bottom: 0.6rem;
    white-space: pre-wrap;
}

.console-line:last-child {
    margin-bottom: 0;
}

.console-info { color: #7fc7ff; }
.console-stdout { color: #e0e0e0; }
.console-stderr,
.console-error { color: #ff7b7b; }
.console-success { color: #72ffda; }
.console-result { color: #ffd479; }

.snippet-toolbar {
    margin-top: 2.5rem;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.snippet-toolbar p {
    font-size: 1.4rem;
    color: var(--text-muted);
    margin: 0;
}

.snippet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.snippet-chip {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.snippet-chip:hover {
    border-color: rgba(0, 170, 255, 0.7);
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* ==================== INFO SECTION ==================== */
.info-section {
    margin-bottom: 6rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.info-card {
    text-align: center;
}

.info-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-card h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.info-card p {
    font-size: 1.4rem;
    color: var(--text-muted);
}

/* ==================== FOOTER ==================== */
.footer {
    padding: 4rem 10%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
}

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

.footer-content span {
    color: var(--primary-color);
    font-weight: 600;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 2.4rem;
    transition: var(--transition-smooth);
}

.footer-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

.tech {
    color: var(--primary-color);
    font-weight: 600;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    html {
        font-size: 55%;
    }

    .nav-container {
        padding: 0 5%;
    }

    .main-title {
        font-size: 3.5rem;
    }

    .subtitle {
        font-size: 1.6rem;
    }

    .editor-card,
    .output-card {
        padding: 2rem;
    }

    .interpreter-grid {
        grid-template-columns: 1fr;
    }

    .hero-cta {
        flex-direction: column;
    }

    .run-controls {
        width: 100%;
        flex-direction: column;
    }

    .run-controls button {
        width: 100%;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 50%;
    }

    .icon-wrapper {
        width: 80px;
        height: 80px;
        font-size: 4rem;
    }

    .main-title {
        font-size: 3rem;
    }

    .logo { font-size: 2rem; }
    .logo-bracket { font-size: 2.4rem; }
}
