/* Pastebin module styles */

/* Layout — left "My Pastes" aside + main column. Mirrors .forum-layout. */
.pastebin-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.pastebin-main { flex: 1 1 auto; min-width: 0; }

/* Sidebar (desktop) */
.pastebin-sidebar {
    flex: 0 0 250px;
    width: 250px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    box-sizing: border-box;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.pastebin-sidebar-title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}
.pastebin-sidebar-new {
    display: block;
    text-align: center;
    padding: 8px 10px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--text-link);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}
.pastebin-sidebar-new:hover {
    background: var(--color-primary);
    color: var(--text-inverse);
}
.pastebin-sidebar-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}
.pastebin-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pastebin-sidebar-item { margin: 0; }
.pastebin-sidebar-item + .pastebin-sidebar-item { margin-top: 4px; }
.pastebin-sidebar-item a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.92rem;
}
.pastebin-sidebar-item a:hover { background: var(--border-soft); }
.pastebin-sidebar-item.active a {
    background: var(--color-primary-soft);
    color: var(--text-link);
    font-weight: 600;
}
.pastebin-sidebar-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.pastebin-sidebar-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.pastebin-sidebar-untitled { color: var(--text-muted); }
.pastebin-sidebar-lock {
    flex: 0 0 auto;
    color: var(--text-muted);
}
.pastebin-sidebar-row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.pastebin-sidebar-row-meta .lang {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Per-user paste count / cap footer. */
.pastebin-sidebar-foot {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft, var(--border));
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}
.pastebin-sidebar-foot.is-full {
    color: var(--color-danger, #c0392b);
    font-weight: 600;
}

/* Mobile collapse: toggle button visible only on small screens. */
.pastebin-sidebar-toggle { display: none; }

@media (max-width: 768px) {
    .pastebin-layout { flex-direction: column; }
    .pastebin-sidebar-toggle {
        display: inline-block;
        align-self: flex-start;
        padding: 8px 14px;
        margin-bottom: 8px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-surface);
        color: var(--text-primary);
        font-size: 0.92rem;
        cursor: pointer;
    }
    .pastebin-sidebar {
        flex: 1 1 auto;
        width: 100%;
        position: static;
        display: none;
    }
    .pastebin-sidebar.is-open { display: block; }
}

/* Wide viewports: push sidebar into the left gutter outside .content's
   1200px box. Mirrors the forum-aside treatment. */
@media (min-width: 1300px) {
    .pastebin-sidebar {
        transform: translateX(calc((var(--container-max) - 100vw) / 2 - 8px));
    }
}

/* ── Issue 08: editor toolbar + CodeMirror layout ─────────────────────
   Basic-only. Issues 12/13 will flesh out the status footer + polish. */

.pastebin-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.pastebin-title-input {
    flex: 1 1 240px;
    min-width: 160px;
    padding: 6px 10px;
    background: var(--bg-input, var(--bg-surface));
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.pastebin-language-select {
    padding: 6px 10px;
    background: var(--bg-input, var(--bg-surface));
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* Name-required gate (owned / new pastes). Title outline + inline hint that
   drops to its own row at the bottom of the toolbar via flex-wrap. */
.pastebin-title-input.pastebin-title-required {
    border-color: var(--color-danger, #c0392b);
    box-shadow: 0 0 0 1px var(--color-danger, #c0392b);
}
.pastebin-title-hint {
    flex: 1 0 100%;
    order: 99;
    margin: 2px 2px 0;
    color: var(--color-danger, #c0392b);
    font-size: 0.8rem;
}
.pastebin-title-hint[hidden] { display: none; }

.pastebin-toolbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

.pastebin-inline-form {
    display: inline;
    margin: 0;
    width: auto;
    padding: 0px;
    border: none;
}

.pastebin-editor-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}

.pastebin-content-textarea {
    width: 100%;
    height: calc(100vh - 280px);
    min-height: 360px;
    padding: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 0;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
}

.pastebin-editor-wrap .CodeMirror {
    height: calc(100vh - 280px);
    min-height: 360px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
}

.pastebin-status {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.pastebin-status-locked {
    color: var(--color-warning, var(--text-link));
    font-weight: 600;
}

.pastebin-message {
    text-align: center;
    padding: 32px 16px;
}

.pastebin-message h2 {
    margin-bottom: 8px;
}

/* ── Issue 09: autosave saved-indicator ───────────────────────────── */

.pastebin-status-saved {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    transition: color 120ms ease;
}

.pastebin-status-saved.is-saving {
    color: var(--text-link);
    font-style: italic;
}

.pastebin-status-saved.is-empty {
    color: var(--text-muted);
    font-style: italic;
}

.pastebin-status-saved.is-error {
    color: var(--color-danger, #c0392b);
    font-weight: 600;
}

/* ── Issue 12: status-footer dot separators + share toast ─────────── */

.pastebin-status > span:empty { display: none; }
.pastebin-status > span + span:not(:empty)::before {
    content: '\2022';
    color: var(--text-muted);
    margin-right: 12px;
}

.pastebin-toast-host {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.pastebin-toast {
    pointer-events: auto;
    min-width: 240px;
    max-width: 360px;
    padding: 10px 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--color-primary, var(--text-link));
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.25));
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 200ms ease, transform 200ms ease;
}

.pastebin-toast.is-leaving {
    opacity: 0;
    transform: translateY(-8px);
}

.pastebin-toast.is-success { border-left-color: var(--color-success, #27ae60); }
.pastebin-toast.is-error   { border-left-color: var(--color-danger, #c0392b); }

@media (max-width: 768px) {
    .pastebin-toast-host { top: 8px; left: 8px; right: 8px; }
    .pastebin-toast { min-width: 0; max-width: none; }
}

.pastebin-toast-url {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 6px;
    background: var(--bg-input, var(--bg-surface));
    color: var(--text-link);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

/* ── Issue 10: conflict modal (built dynamically by merge.js) ──────── */

.pastebin-conflict-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pastebin-conflict-modal {
    width: min(900px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md, 0 8px 32px rgba(0, 0, 0, 0.45));
    padding: 20px;
    box-sizing: border-box;
}

.pastebin-conflict-title {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.pastebin-conflict-blurb {
    margin: 0 0 16px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.pastebin-conflict-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.pastebin-conflict-col h4 {
    margin: 0 0 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pastebin-conflict-pre {
    margin: 0;
    padding: 10px;
    background: var(--bg-input, var(--bg-surface));
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    max-height: 50vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.pastebin-conflict-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.pastebin-conflict-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.92rem;
    cursor: pointer;
}

.pastebin-conflict-btn:hover {
    background: var(--border-soft);
}

.pastebin-conflict-btn[data-action="take-theirs"] {
    background: var(--color-primary-soft);
    color: var(--text-link);
    font-weight: 600;
}

.pastebin-conflict-btn[data-action="take-theirs"]:hover {
    background: var(--color-primary);
    color: var(--text-inverse);
}

@media (max-width: 768px) {
    .pastebin-conflict-cols { grid-template-columns: 1fr; }
}

/* ── Issue 11: presence overlays ──────────────────────────────────────
   "Paste full" replaces the toolbar + editor area with a centered card.
   "Tab idle" / "Disconnected" overlay covers the editor wrap. */

.pastebin-full-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 16px;
    min-height: calc(100vh - 280px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.pastebin-full-card-inner {
    max-width: 480px;
    text-align: center;
}

.pastebin-full-card-inner h2 {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.pastebin-full-card-inner p {
    margin: 0 0 14px;
    color: var(--text-secondary);
}

.pastebin-full-retry-line {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pastebin-full-retry-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--text-link);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.pastebin-full-retry-btn:hover {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.pastebin-full-retry-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.pastebin-idle-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.pastebin-idle-card {
    padding: 20px 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md, var(--shadow-sm));
    text-align: center;
    color: var(--text-primary);
    max-width: 360px;
}

.pastebin-idle-card p { margin: 4px 0; }
.pastebin-idle-card p:first-child { font-size: 1.05rem; }
.pastebin-idle-card p + p { color: var(--text-secondary); font-size: 0.9rem; }
