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

:root {
    --bg:          #0f1117;
    --surface:     #171b26;
    --surface2:    #1e2330;
    --border:      #2a2f3f;
    --border2:     #363d52;
    --text:        #e2e6f0;
    --text-dim:    #8892a4;
    --text-muted:  #4e5668;
    --accent:      #5b8df6;
    --accent-dim:  #3d6ad4;
    --green:       #3ecf8e;
    --red:         #f56565;
    --yellow:      #ecc94b;
    --mono:        'IBM Plex Mono', 'Fira Code', 'Courier New', monospace;
    --sans:        'IBM Plex Sans', 'Inter', system-ui, sans-serif;
    --radius:      6px;
    --radius-lg:   10px;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    font-size: 1.4rem;
    color: var(--accent);
    line-height: 1;
    font-family: var(--mono);
}

.brand-name {
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.nav-btn {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.nav-btn:hover {
    color: var(--text);
    border-color: var(--border2);
    background: var(--surface);
}

/* ── App shell ── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Editor layout ── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 20px;
    width: 100%;
}

@media (max-width: 780px) {
    .editor-layout { grid-template-columns: 1fr; }
    .sidebar-col { display: none; }
}

/* ── Cards ── */
.editor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
}

.sidebar-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* ── Editor header ── */
.editor-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.title-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--sans);
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    caret-color: var(--accent);
}

.title-input::placeholder { color: var(--text-muted); }

.editor-meta-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-select, .meta-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 6px 10px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}

.meta-select:hover, .meta-input:hover,
.meta-select:focus, .meta-input:focus {
    border-color: var(--border2);
    color: var(--text);
}

.meta-input {
    flex: 1;
    min-width: 120px;
    cursor: text;
}

.meta-input::placeholder { color: var(--text-muted); }

/* ── Code area ── */
.code-area {
    flex: 1;
    min-height: 420px;
    background: #0b0d14;
    color: #abb2bf;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    padding: 20px;
    caret-color: var(--accent);
    tab-size: 4;
}

.code-area::placeholder { color: var(--text-muted); }

/* ── Editor footer ── */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.char-count {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.editor-actions { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ── */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 8px 16px;
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 14px;
    font-family: var(--sans);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-ghost:hover { border-color: var(--border2); color: var(--text); }

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(245,101,101,0.3);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-family: var(--sans);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger:hover { background: rgba(245,101,101,0.1); }

.btn-warn {
    background: transparent;
    color: var(--yellow);
    border: 1px solid rgba(236,201,75,0.3);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-family: var(--sans);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-warn:hover { background: rgba(236,201,75,0.1); }

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
}

/* ── Recent list ── */
.recent-list { display: flex; flex-direction: column; gap: 2px; }

.recent-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid transparent;
}

.recent-item:hover {
    background: var(--surface2);
    border-color: var(--border);
}

.recent-title {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.recent-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 8px 0;
    font-style: italic;
}

/* ── Features list ── */
.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-list li {
    font-size: 0.82rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.feat-icon {
    color: var(--accent);
    font-size: 0.6rem;
}

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(3px);
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    width: min(480px, 94vw);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
}

.modal-icon { color: var(--green); font-size: 1rem; }

.modal-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }

.url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
}

.url-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 28px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.url-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.78rem;
    min-width: 0;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    transition: color 0.12s;
    line-height: 1;
}
.copy-btn:hover { color: var(--accent); }

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px 20px;
    border-top: 1px solid var(--border);
}

/* ── Paste view ── */
.paste-view-wrap {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 20px;
}

.paste-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.paste-title-block {}

.paste-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.paste-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
}

.chip-accent {
    color: var(--accent);
    border-color: rgba(91,141,246,0.3);
    background: rgba(91,141,246,0.08);
}

.paste-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

.code-toolbar-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.code-toolbar-left, .code-toolbar-right {
    display: flex;
    gap: 8px;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block pre code {
    display: block;
    padding: 20px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    background: #0b0d14 !important;
}

.share-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-bar-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* ── Error page ── */
.error-page {
    text-align: center;
    padding: 80px 20px;
    max-width: 420px;
    margin: 0 auto;
}

.error-code {
    font-family: var(--mono);
    font-size: 5rem;
    font-weight: 500;
    color: var(--border2);
    line-height: 1;
    margin-bottom: 16px;
}

.error-msg {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.error-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* ── Inline modals (edit/delete) ── */
.inline-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    backdrop-filter: blur(3px);
}

.inline-modal-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    width: min(560px, 94vw);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.inline-modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.inline-modal-footer {
    padding: 14px 20px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.edit-textarea {
    width: 100%;
    height: 280px;
    background: #0b0d14;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #abb2bf;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    padding: 16px;
    outline: none;
    resize: vertical;
}

.edit-textarea:focus { border-color: var(--border2); }

.pw-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
    padding: 10px 14px;
    outline: none;
}

.pw-input:focus { border-color: var(--border2); }
.pw-input::placeholder { color: var(--text-muted); }

.warn-text {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ── Notifications ── */
.toast {
    position: fixed;
    top: 64px;
    right: 20px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-left: 3px solid var(--green);
    border-radius: var(--radius);
    padding: 12px 18px;
    color: var(--text);
    font-size: 0.85rem;
    z-index: 9999;
    animation: slideIn 0.2s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: 320px;
}

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

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

/* ── Misc ── */
a { color: inherit; }

.hljs { background: #0b0d14 !important; }

@media (max-width: 520px) {
    .topbar { padding: 0 14px; }
    .editor-layout { padding: 0 12px; margin: 14px auto; }
    .paste-view-wrap { padding: 0 12px; margin: 14px auto; }
    .paste-top { flex-direction: column; }
    .code-toolbar-bar { flex-direction: column; gap: 8px; align-items: stretch; }
    .code-toolbar-left, .code-toolbar-right { justify-content: center; }
}
