/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --primary:      #2563eb;
    --primary-h:    #1d4ed8;
    --bg:           #ffffff;
    --surface:      #f8fafc;
    --border:       #e2e8f0;
    --text:         #1e293b;
    --text-sub:     #64748b;
    --text-muted:   #94a3b8;
    --code-bg:      #f8fafc;
    --nav-bg:       #ffffff;
    --nav-border:   #e2e8f0;
    --danger:       #dc2626;
    --radius:       4px;
    --mono:         'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}
[data-theme="dark"] {
    --primary:      #3b82f6;
    --primary-h:    #2563eb;
    --bg:           #0f172a;
    --surface:      #1e293b;
    --border:       #334155;
    --text:         #f1f5f9;
    --text-sub:     #cbd5e1;
    --text-muted:   #64748b;
    --code-bg:      #0f172a;
    --nav-bg:       #1e293b;
    --nav-border:   #334155;
    --danger:       #ef4444;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
html, body {
    height: 100%;
    overflow: hidden;
}
body {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
    flex-shrink: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.5rem;
    z-index: 10;
}
.nav-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.brand {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 1rem;
    white-space: nowrap;
    margin-right: 0.5rem;
}
.brand:hover { color: var(--primary-h); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

/* Nav controls */
.nav-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    width: 160px;
    outline: none;
}
.nav-input:focus { border-color: var(--primary); }

.nav-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    outline: none;
}
.nav-select:focus { border-color: var(--primary); }

.nav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-sub);
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); }

.nav-btn-save {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.nav-btn-save:hover { background: var(--primary); color: #fff; }

.nav-paste-title {
    font-size: 0.85rem;
    color: var(--text-sub);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.nav-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-sub);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    padding: 0 0.2rem;
}
.nav-label:hover { color: var(--primary); }
.nav-label input { cursor: pointer; }

/* ── Prism Line Numbers ────────────────────────────────────────────────── */
.line-numbers .line-numbers-rows {
    border-right: 1px solid var(--border) !important;
    padding-right: 0.5rem !important;
}
.line-numbers-rows > span:before {
    color: var(--text-muted) !important;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: var(--radius);
    line-height: 1;
    color: var(--text-sub);
}
.theme-toggle:hover { background: var(--surface); }

/* ── Full-page main ────────────────────────────────────────────────────── */
.full-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Editor textarea ───────────────────────────────────────────────────── */
.full-editor {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 1rem 1.5rem;
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    tab-size: 4;
}

/* ── View: full-page code ──────────────────────────────────────────────── */
.view-full {
    flex: 1;
    overflow: auto;
    background: var(--code-bg);
    min-height: 0;
}
.view-full pre {
    margin: 0;
    padding: 1rem 1.5rem;
    min-height: 100%;
    background: transparent;
}
.view-full code {
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ── Inline error (view page) ──────────────────────────────────────────── */
.error-inline {
    padding: 0.75rem 1.5rem;
    color: var(--danger);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

/* ── Page-container (error pages, etc.) ───────────────────────────────── */
.page-container {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
    overflow-y: auto;
}

/* ── Error pages ───────────────────────────────────────────────────────── */
.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60%;
}
.error-content { text-align: center; max-width: 380px; }
.error-content h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.error-content p  { color: var(--text-sub); margin-bottom: 1.5rem; }
.error-actions    { display: flex; justify-content: center; gap: 0.75rem; }

/* Generic button (used on error pages) */
.btn {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    background: none;
    color: var(--text-sub);
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary); color: #fff; }

/* ── Notification toast ────────────────────────────────────────────────── */
.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-sub);
    z-index: 100;
}

/* ── Prism overrides: transparent background ───────────────────────────── */
pre[class*="language-"], code[class*="language-"] {
    background: transparent !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .nav-input  { width: 90px; }
    .nav-paste-title { display: none; }
}
