/* ============================================
   Code Station – Professional Web IDE
   ============================================ */

/* ---- Reset ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #020306;
    --text-primary: #f8f9fa;
    --text-secondary: #9aa0a6;
    --text-dim: #5f6368;

    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-bg-hover: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(255, 255, 255, 0.2);

    --accent-blue: #8ab4f8;
    --accent-green: #81c995;
    --accent-purple: #c58af9;
    --accent-yellow: #fde293;
    --accent-red: #f28b82;

    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Fira Code', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Canvases & Background ---- */
canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#starfield {
    z-index: 0;
}

#cosmic-dust {
    z-index: 1;
    mix-blend-mode: screen;
    opacity: 0.3;
}

.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(200px);
    opacity: 0.08;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 1;
}

.glow-blue {
    width: 1000px;
    height: 1000px;
    background: #2b70c9;
    top: -200px;
    right: -200px;
    animation: breathe 25s infinite alternate;
}

.glow-purple {
    width: 1200px;
    height: 1200px;
    background: #3d1b66;
    bottom: -300px;
    left: -200px;
    animation: breathe 30s infinite alternate-reverse;
}

@keyframes breathe {
    from {
        transform: scale(0.95);
        opacity: 0.05;
    }

    to {
        transform: scale(1.05);
        opacity: 0.12;
    }
}


/* ================================================
   Navbar  (Floating Pill)
   ================================================ */
.navbar {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: rgba(20, 22, 28, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    z-index: 100;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: background .3s;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.navbar__logo {
    font-size: 1.2rem;
}

.navbar__name {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.navbar__links {
    display: flex;
    list-style: none;
    gap: .5rem;
}

.navbar__link {
    font-size: .85rem;
    font-weight: 400;
    padding: .4rem 1rem;
    border-radius: 100px;
    color: var(--text-secondary);
    transition: color .25s, background .25s;
}

.navbar__link:hover {
    color: var(--text-primary);
    background: var(--glass-bg-hover);
}

.navbar__link--active {
    color: var(--bg-deep);
    background: var(--text-primary);
    font-weight: 500;
}

.navbar__hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.navbar__hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

.navbar__hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar__hamburger.active span:nth-child(2) {
    opacity: 0;
}

.navbar__hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ================================================
   Station Header
   ================================================ */
.page-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.station-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 120px clamp(1rem, 4vw, 3rem) 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.station-header {
    margin-bottom: 2rem;
    text-align: left;
}

.station-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 500;
    margin-bottom: .4rem;
    color: var(--text-primary);
}

.station-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ================================================
   Terminal Layout
   ================================================ */
.terminal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    flex: 1;
    align-items: stretch;
}

/* ---- Sidebar (Glass Panel) ---- */
.snippets-sidebar {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    padding: .4rem;
    border-radius: 100px;
    transition: all .2s;
}

.btn-icon:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.search-box {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    position: absolute;
    left: 1rem;
}

.search-box input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: .85rem;
    color: var(--text-primary);
    padding-left: 1.8rem;
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.snippet-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

/* Snippet Item */
.snippet-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background .2s, border-left-color .2s;
    border-left: 3px solid transparent;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.snippet-item:hover {
    background: var(--glass-bg-hover);
}

.snippet-item.active {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--text-primary);
}

.snippet-item__title {
    font-size: .9rem;
    font-weight: 500;
    font-family: var(--font-body);
}

.snippet-item.active .snippet-item__title {
    color: var(--text-primary);
}

.snippet-item__meta {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--text-dim);
}

.lang-badge {
    text-transform: uppercase;
    font-size: .65rem;
    font-weight: 500;
    padding: .15rem .5rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
}

/* ---- Main Editor Area (Clean IDE) ---- */
.editor-area {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
    /* Darker for code contrast */
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
}

/* Editor Topbar */
.editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot--red {
    background: #ff5f56;
}

.dot--yellow {
    background: #ffbd2e;
}

.dot--green {
    background: #27c93f;
}

.editor-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    margin: 0 2rem;
}

.title-input {
    background: transparent;
    border: 1px dashed transparent;
    outline: none;
    font-family: var(--font-body);
    font-size: .95rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: .25rem .5rem;
    border-radius: 6px;
    width: 100%;
    max-width: 300px;
    transition: all .2s;
}

.title-input:hover,
.title-input:focus {
    border-color: var(--glass-border-focus);
    background: rgba(255, 255, 255, 0.02);
}

.lang-select-wrapper {
    position: relative;
}

.lang-select {
    appearance: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: .8rem;
    color: var(--text-secondary);
    padding: .35rem 2rem .35rem 1rem;
    cursor: pointer;
    outline: none;
    transition: all .2s;
}

.lang-select:hover,
.lang-select:focus {
    border-color: var(--glass-border-focus);
    color: var(--text-primary);
}

.editor-actions {
    display: flex;
    gap: .6rem;
}

.btn {
    font-family: var(--font-body);
    font-size: .8rem;
    font-weight: 500;
    padding: .4rem 1rem;
    border-radius: 100px;
    cursor: pointer;
    border: none;
    transition: all .2s;
}

.btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn--outline:hover {
    background: rgba(242, 139, 130, 0.1);
    color: var(--accent-red);
    border-color: rgba(242, 139, 130, 0.3);
}

.btn--primary {
    background: var(--text-primary);
    color: var(--bg-deep);
}

.btn--primary:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Code Container */
.code-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.line-numbers {
    padding: 1.25rem .8rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-dim);
    font-family: var(--font-code);
    font-size: .9rem;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--glass-border);
    min-width: 3.2rem;
}

.code-editor {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 1.25rem;
    resize: none;
    font-family: var(--font-code);
    font-size: .9rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre;
    overflow: auto;
    caret-color: var(--text-primary);
}

.code-editor::placeholder {
    color: var(--text-dim);
}

/* Console Output */
.console {
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 160px;
}

.console-header {
    padding: .4rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    font-family: var(--font-body);
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon--small {
    padding: .2rem .5rem;
    font-size: .75rem;
    font-weight: 500;
    gap: .4rem;
}

.console-body {
    padding: 1rem 1.25rem;
    font-family: var(--font-code);
    font-size: .8rem;
    color: var(--text-primary);
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.sys-msg {
    color: var(--text-dim);
}

.err-msg {
    color: var(--accent-red);
}

.success-msg {
    color: var(--accent-green);
}

/* ================================================
   Footer
   ================================================ */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
    font-size: .8rem;
}

/* ================================================
   Responsive Layout
   ================================================ */
@media (max-width: 900px) {
    .terminal-layout {
        grid-template-columns: 1fr;
    }

    .snippets-sidebar {
        height: 320px;
    }

    .editor-area {
        height: 600px;
    }

    .editor-topbar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .editor-title-group {
        margin: 0;
        min-width: 100%;
        order: 3;
    }
}

@media (max-width: 768px) {
    .navbar__links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(20, 22, 28, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        padding: 2rem 0;
        gap: .5rem;
        transform: translateY(-120%);
        transition: transform .4s cubic-bezier(.22, 1, .36, 1);
        border-bottom: 1px solid var(--glass-border);
        border-radius: 20px;
    }

    .navbar__links.open {
        transform: translateY(0);
    }

    .navbar__hamburger {
        display: flex;
    }

    .station-title {
        font-size: 1.5rem;
    }
}