/* Paste view toolbar — clear labels, committed layout */
.paste-toolbar-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.paste-toolbar__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.paste-toolbar__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    margin: 0;
}

.paste-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .paste-toolbar-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
    }

    .paste-toolbar__heading {
        justify-content: flex-start;
    }

    .paste-toolbar__title {
        text-align: left;
    }

    .paste-toolbar__actions {
        justify-content: flex-end;
        flex-shrink: 0;
    }
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    line-height: 1.25;
}

.toolbar-btn--icon {
    min-width: 2.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 1rem;
    font-weight: 700;
}

.toolbar-btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--bg-primary, #fff), 0 0 0 4px var(--accent-primary);
}

.toolbar-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.toolbar-btn--default,
.toolbar-btn--secondary {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.toolbar-btn--default:hover,
.toolbar-btn--secondary:hover {
    background-color: color-mix(in srgb, var(--bg-tertiary) 70%, var(--accent-primary));
    border-color: color-mix(in srgb, var(--border-color) 60%, var(--accent-primary));
}

.toolbar-btn--ghost {
    color: var(--text-secondary);
    background: transparent;
    border-color: var(--border-color);
}

.toolbar-btn--ghost:hover,
.toolbar-btn--ghost[aria-pressed="true"] {
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary));
    border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--border-color));
}

.toolbar-btn--primary {
    color: #fff;
    background-color: var(--accent-primary);
}

.toolbar-btn--primary:hover {
    background-color: var(--accent-primary-hover);
}

.toolbar-btn--success {
    color: #fff;
    background-color: #16a34a;
    border-color: #15803d;
}

.toolbar-btn--success:hover {
    background-color: #15803d;
}

.toolbar-btn--danger {
    color: #fff;
    background-color: #dc2626;
}

.toolbar-btn--danger:hover {
    background-color: #b91c1c;
}

.toolbar-btn--warning {
    color: #1f2937;
    background-color: #facc15;
}

.toolbar-btn--warning:hover {
    background-color: #eab308;
}

.toolbar-btn--disabled {
    color: #fff;
    background-color: #9ca3af;
}

.dark .toolbar-btn--default,
.dark .toolbar-btn--secondary {
    background-color: #334155;
    border-color: var(--border-color);
}

.dark .toolbar-btn--default:hover,
.dark .toolbar-btn--secondary:hover {
    background-color: #475569;
}

.dark .toolbar-btn--disabled {
    background-color: #4b5563;
}

.toolbar-more {
    position: relative;
}

.toolbar-more > summary {
    list-style: none;
    cursor: pointer;
}

.toolbar-more > summary::-webkit-details-marker {
    display: none;
}

.toolbar-more[open] > summary {
    background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--accent-primary) 30%, var(--border-color));
}

.toolbar-more__panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 30;
    min-width: 11rem;
    padding: 0.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.toolbar-more__item,
.toolbar-more__link {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.toolbar-more__item:hover,
.toolbar-more__link:hover {
    background: var(--bg-tertiary);
}

.toolbar-more__search {
    padding: 0.25rem 0.35rem 0.5rem;
}

.toolbar-more__search .paste-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.paste-content-view {
    font-size: var(--paste-font-size, 0.875rem);
}

.paste-content-view.paste-wrap pre,
.paste-content-view.paste-wrap code {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 639px) {
    .toolbar-more__panel {
        right: 0;
        left: auto;
    }
}

/* Markdown styling helpers (Restores styles stripped by Tailwind) */
.markdown-body {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

#markdownContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.markdown-body strong,
.markdown-body b {
    font-weight: 700 !important;
}
.markdown-body em,
.markdown-body i {
    font-style: italic !important;
}
.markdown-body h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 0.67em 0;
}
.markdown-body h2 {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0.83em 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    padding-bottom: 0.3em;
}
.markdown-body h3 {
    font-size: 1.17em;
    font-weight: 700;
    margin: 1em 0;
}
.markdown-body h4 {
    font-size: 1em;
    font-weight: 700;
    margin: 1.33em 0;
}
.markdown-body ul {
    list-style-type: disc;
    padding-left: 2em;
    margin-bottom: 1em;
}
.markdown-body ol {
    list-style-type: decimal;
    padding-left: 2em;
    margin-bottom: 1em;
}
.markdown-body li {
    margin-bottom: 0.25em;
}
.markdown-body p {
    margin-bottom: 1em;
}
.markdown-body blockquote {
    border-left: 4px solid #d1d5db;
    padding-left: 1em;
    color: #6b7280;
    font-style: italic;
    margin-bottom: 1em;
}
.markdown-body a {
    color: var(--accent-primary);
    text-decoration: underline;
    overflow-wrap: break-word;
    word-break: break-word;
}
.markdown-body code:not(pre code) {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-size: 85%;
}

.markdown-body img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

.markdown-body img.align-left {
    float: left;
    margin-right: 1em;
    margin-bottom: 0.5em;
}

.markdown-body img.align-right {
    float: right;
    margin-left: 1em;
    margin-bottom: 0.5em;
}

.markdown-body::after {
    content: "";
    display: table;
    clear: both;
}

.markdown-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-body table th,
.markdown-body table td {
    border: 1px solid var(--border-color, #e5e7eb);
    padding: 0.5rem 0.75rem;
}

.markdown-body hr {
    border: 0;
    border-top: 1px solid var(--border-color, #e5e7eb);
    margin: 1.5rem 0;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
}

.markdown-body pre {
    overflow-x: auto;
    max-width: 100%;
    border-radius: 0.75rem;
    padding: 1rem;
    background-color: var(--bg-secondary, #f3f4f6);
    margin-bottom: 1rem;
}

.dark .markdown-body pre {
    background-color: #1e293b;
}

.markdown-body pre code {
    white-space: pre;
    word-break: normal;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

@keyframes copy-combo-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    18% {
        transform: translateX(-6px);
    }
    36% {
        transform: translateX(6px);
    }
    54% {
        transform: translateX(-4px);
    }
    72% {
        transform: translateX(4px);
    }
}
.copy-combo-shake {
    animation: copy-combo-shake 0.45s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
    .copy-combo-shake {
        animation: none;
    }
}

/* readability */
.paste-pre,
.paste-content-view pre,
.paste-content-view code {
    font-size: var(--paste-font-size, 14px);
    white-space: var(--paste-wrap, pre-wrap);
}

.paste-toolbar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.expiry-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: var(--color-accent-muted);
    color: var(--accent-primary);
}

.paste-search-input {
    min-width: 10rem;
    max-width: 14rem;
}

.search-highlight {
    background: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
.dark .search-highlight {
    background: #854d0e;
    color: #fef9c3;
}

/* line numbers */
.line-number-wrapper {
    display: flex;
    overflow: auto;
}
.line-number-gutter {
    flex-shrink: 0;
    padding: 1rem 0.5rem 1rem 0.75rem;
    text-align: right;
    user-select: none;
    font-family: ui-monospace, monospace;
    font-size: var(--paste-font-size, 14px);
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
}
.line-number {
    display: block;
}
.line-number--clickable {
    cursor: pointer;
}
.line-number--clickable:hover {
    color: var(--accent-primary);
}
.line-number-content {
    flex: 1;
    min-width: 0;
}
.line-number-content pre {
    margin: 0;
    border: none;
    background: transparent;
}

/* markdown TOC & anchors */
.markdown-toc ul {
    list-style: disc;
    padding-left: 1.25rem;
}
.heading-anchor {
    opacity: 0;
    margin-left: 0.35rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: normal;
}
.markdown-body h1:hover .heading-anchor,
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor,
.markdown-body h4:hover .heading-anchor {
    opacity: 1;
}

/* readability toolbar */
.paste-toolbar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}
.paste-toolbar__readability {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}
.paste-search-input {
    min-width: 8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}
.toolbar-btn--icon {
    padding: 0.5rem 0.75rem;
    min-width: 2.5rem;
}
.paste-view-content {
    font-size: var(--paste-font-size, 0.875rem);
}
.paste-view-content.paste-wrap pre,
.paste-view-content.paste-wrap code {
    white-space: pre-wrap;
    word-break: break-word;
}

/* line numbers */
.paste-line-wrap { position: relative; }
.paste-line-scroll {
    display: flex;
    overflow: auto;
    max-width: 100%;
}
.paste-line-gutter {
    flex-shrink: 0;
    padding: 1rem 0.5rem 1rem 1rem;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.paste-line-number {
    display: block;
    padding: 0 0.5rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.paste-line-number:hover {
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}
.paste-line--highlight {
    background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

/* search highlights */
.paste-search-mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
}
.paste-search-mark--active {
    background: #facc15;
    outline: 1px solid #ca8a04;
}
.dark .paste-search-mark { background: rgba(250, 204, 21, 0.35); }
.dark .paste-search-mark--active { background: rgba(250, 204, 21, 0.55); }

/* line-number-wrapper (PastedLineNumbers) */
.line-number-wrapper {
    display: flex;
    overflow: auto;
}
.line-number-gutter {
    flex-shrink: 0;
    padding: 1rem 0.5rem;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.line-number {
    display: block;
    padding: 0 0.35rem;
}
.line-number--clickable {
    cursor: pointer;
}
.line-number--clickable:hover {
    color: var(--accent-primary);
}
.line-number-content {
    flex: 1;
    min-width: 0;
}
.search-hit {
    background: #fef08a;
    border-radius: 2px;
}
.search-hit--current {
    background: #facc15;
    outline: 1px solid #ca8a04;
}
.paste-search-wrap input {
    min-width: 8rem;
}
.markdown-toc {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}
.markdown-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.markdown-toc a { color: var(--accent-primary); text-decoration: none; }
.markdown-toc a:hover { text-decoration: underline; }
.markdown-body .heading-anchor {
    opacity: 0;
    margin-left: 0.35rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: normal;
}
.markdown-body h1:hover .heading-anchor,
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor { opacity: 1; }

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-panel { max-height: 90vh; overflow-y: auto; }

.expiry-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: #e0f2fe;
    color: #0369a1;
}
.dark .expiry-badge {
    background: rgba(14, 165, 233, 0.2);
    color: #7dd3fc;
}

.line-number-wrapper {
    display: flex;
    overflow: auto;
}
.line-number-gutter {
    flex-shrink: 0;
    padding: 1rem 0.5rem;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.line-number {
    display: block;
    padding: 0 0.35rem;
}
.line-number--clickable {
    cursor: pointer;
}
.line-number--clickable:hover {
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}
.line-number-content { flex: 1; min-width: 0; }

.search-hit { background: #fef08a; }
.search-hit--current { background: #facc15; outline: 1px solid #ca8a04; }
