/* ==============================================
   Tiptap Editor — GitBook / Ghost-grade Styles
   ============================================== */

/* ============ PROSEMIRROR CORE ============ */
.ProseMirror {
    outline: none;
}

.ProseMirror-gapcursor {
    display: none;
    pointer-events: none;
}

.ProseMirror-gapcursor:after {
    display: block;
    position: absolute;
    width: 20px;
    height: 1px;
    border-top: 1px solid #000;
    margin-top: 2px;
}

/* ============ EDITOR WRAPPER ============ */
#editor-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ============ CONTENT ============ */
.tiptap-content {
    padding: 0 48px 200px;
    max-width: 720px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #1a1a2e;
    caret-color: var(--color-primary, #346DDB);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tiptap-content>*:first-child {
    margin-top: 0;
}

.tiptap-content:focus {
    outline: none;
}

/* ============ HEADINGS ============ */
.tiptap-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 2.5rem 0 0.5rem;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: #0f0f1a;
}

.tiptap-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 0.5rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: #0f0f1a;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8ecf1;
}

.tiptap-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.75rem 0 0.4rem;
    line-height: 1.4;
    color: #1a1a2e;
}

.tiptap-content h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 1.5rem 0 0.3rem;
    color: #1a1a2e;
}

/* ============ PARAGRAPHS ============ */
.tiptap-content p {
    margin: 0 0 1rem;
    color: #374151;
}

/* ============ INLINE FORMATTING ============ */
.tiptap-content strong {
    font-weight: 700;
    color: #111827;
}

.tiptap-content em {
    font-style: italic;
}

.tiptap-content u {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(52, 109, 219, 0.4);
}

.tiptap-content s {
    text-decoration: line-through;
    color: #9ca3af;
}

.tiptap-content mark {
    background: linear-gradient(120deg, #fef08a 0%, #fde68a 100%);
    padding: 2px 4px;
    border-radius: 3px;
    box-decoration-break: clone;
}

/* ============ LINKS ============ */
.tiptap-content a,
.tiptap-content .editor-link {
    color: var(--color-primary, #346DDB);
    text-decoration: none;
    border-bottom: 1px solid rgba(52, 109, 219, 0.3);
    transition: border-color 0.15s, color 0.15s;
}

.tiptap-content a:hover {
    border-bottom-color: currentColor;
}

/* ============ INLINE CODE ============ */
.tiptap-content code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    letter-spacing: -0.01em;
    border: 1px solid #e2e8f0;
}

/* ============ CODE BLOCKS ============ */
.tiptap-content pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 1.25rem 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    border: 1px solid #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tiptap-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: inherit;
}

/* ============ BLOCKQUOTES ============ */
.tiptap-content blockquote {
    border-left: 3px solid var(--color-primary, #346DDB);
    padding: 2px 20px;
    margin: 1.25rem 0;
    color: #4b5563;
    background: linear-gradient(135deg, rgba(52, 109, 219, 0.03), rgba(52, 109, 219, 0.06));
    border-radius: 0 10px 10px 0;
}

.tiptap-content blockquote p {
    margin-bottom: 0.5rem;
}

.tiptap-content blockquote p:last-child {
    margin-bottom: 0;
}

.tiptap-content blockquote blockquote {
    margin: 0.75rem 0;
}

/* ============ LISTS ============ */
.tiptap-content ul,
.tiptap-content ol {
    padding-left: 24px;
    margin: 0.75rem 0;
}

.tiptap-content li {
    margin-bottom: 4px;
    color: #374151;
}

.tiptap-content li p {
    margin-bottom: 0;
}

.tiptap-content li::marker {
    color: var(--color-primary, #346DDB);
}

.tiptap-content ol li::marker {
    font-weight: 600;
    font-size: 0.9em;
}

/* ============ TASK LISTS ============ */
.tiptap-content ul[data-type="taskList"] {
    list-style: none;
    padding-left: 0;
}

.tiptap-content ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
}

.tiptap-content ul[data-type="taskList"] li label {
    flex-shrink: 0;
    margin-top: 4px;
}

.tiptap-content ul[data-type="taskList"] li label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary, #346DDB);
    cursor: pointer;
    border-radius: 4px;
}

.tiptap-content ul[data-type="taskList"] li>div {
    flex: 1;
}

.tiptap-content ul[data-type="taskList"] li[data-checked="true"]>div {
    text-decoration: line-through;
    color: #9ca3af;
}

/* ============ HORIZONTAL RULE ============ */
.tiptap-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #d1d5db, transparent);
    margin: 2rem 0;
}

/* ============ IMAGES ============ */
.tiptap-content .image-node-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 1.25rem 0;
    border-radius: 10px;
    line-height: 0;
}

.tiptap-content .image-node-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
    cursor: pointer;
    display: block;
}

.tiptap-content .image-node-wrapper:hover img {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Selected state */
.tiptap-content .image-node-wrapper.ProseMirror-selectednode img,
.tiptap-content .image-node-wrapper:focus-within img {
    outline: 3px solid var(--color-primary, #346DDB);
    outline-offset: 2px;
}

/* ---- Resize handles ---- */
.image-resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 2px solid var(--color-primary, #346DDB);
    border-radius: 50%;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.15s;
}

.image-node-wrapper:hover .image-resize-handle,
.image-node-wrapper.resizing .image-resize-handle {
    opacity: 1;
}

.handle-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.handle-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.handle-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.handle-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* ---- Image edit popup ---- */
.image-edit-popup {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translate(-50%, 100%);
    z-index: 10;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 14px;
    min-width: 320px;
    animation: ftFadeIn 0.12s ease;
}

.image-edit-field {
    margin-bottom: 10px;
}

.image-edit-field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.image-alt-input {
    width: 100%;
    font-family: var(--font, 'Inter', sans-serif);
    font-size: 0.8125rem;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.image-alt-input:focus {
    border-color: var(--color-primary, #346DDB);
}

.image-edit-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.image-edit-actions button {
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
}

.image-replace {
    background: #f1f5f9;
    color: #334155;
    margin-right: auto;
}

.image-replace:hover {
    background: #e2e8f0;
}

.image-save {
    background: var(--color-primary, #346DDB);
    color: #fff;
}

.image-save:hover {
    filter: brightness(1.1);
}

.image-delete {
    background: #fef2f2;
    color: #ef4444;
}

.image-delete:hover {
    background: #fee2e2;
}

/* ============ TABLES ============ */
.tiptap-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.25rem 0;
    font-size: 0.875rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.tiptap-content th,
.tiptap-content td {
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}

.tiptap-content th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.8125rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tiptap-content td p,
.tiptap-content th p {
    margin: 0;
}

.tiptap-content .selectedCell {
    background: rgba(52, 109, 219, 0.08);
}

.tiptap-content .column-resize-handle {
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary, #346DDB);
    cursor: col-resize;
}

/* ============ PLACEHOLDER ============ */
.tiptap-content p.is-editor-empty:first-child::before,
.tiptap-content .is-node-empty:first-child::before {
    color: #94a3b8;
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
    font-style: italic;
}

/* ============ CALLOUT BLOCKS ============ */
/* Token variables sourced from Docusaurus _admonition.scss
   Update these to match the published site's theme */
:root {
    --admonition-note-c-bg: #fefce8;
    --admonition-info-c-bg: #eff6ff;
    --admonition-tip-c-bg: #f0fdf4;
    --admonition-warning-c-bg: #fff7ed;
    --admonition-danger-c-bg: #fef2f2;
    --admonition-caution-c-bg: #fff7ed;
    --admonition-bar-note-c-bg: #ca8a04;
    --admonition-bar-info-c-bg: #2563eb;
    --admonition-bar-tip-c-bg: #16a34a;
    --admonition-bar-warning-c-bg: #ea580c;
    --admonition-bar-danger-c-bg: #dc2626;
    --admonition-bar-caution-c-bg: #ea580c;
}

.callout {
    position: relative;
    border: none;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    overflow: hidden;
}

.callout::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--callout-bar-color);
    border-radius: 4px 0 0 4px;
}

.callout-content>*:first-child {
    margin-top: 0;
}

.callout-content>*:last-child {
    margin-bottom: 0;
}

.callout-note {
    background: var(--admonition-note-c-bg);
    --callout-bar-color: var(--admonition-bar-note-c-bg);
}

.callout-info {
    background: var(--admonition-info-c-bg);
    --callout-bar-color: var(--admonition-bar-info-c-bg);
}

.callout-tip {
    background: var(--admonition-tip-c-bg);
    --callout-bar-color: var(--admonition-bar-tip-c-bg);
}

.callout-warning {
    background: var(--admonition-warning-c-bg);
    --callout-bar-color: var(--admonition-bar-warning-c-bg);
}

.callout-danger {
    background: var(--admonition-danger-c-bg);
    --callout-bar-color: var(--admonition-bar-danger-c-bg);
}

.callout-caution {
    background: var(--admonition-caution-c-bg);
    --callout-bar-color: var(--admonition-bar-caution-c-bg);
}

/* ============ SLASH COMMANDS MENU ============ */
.slash-menu {
    position: fixed;
    z-index: 3000;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 6px;
    min-width: 280px;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    animation: slashFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.slash-menu::-webkit-scrollbar {
    width: 4px;
}

.slash-menu::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

@keyframes slashFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.slash-menu-header {
    padding: 8px 10px 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.slash-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: 8px;
    font-family: var(--font, 'Inter', sans-serif);
    font-size: 0.875rem;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.1s ease;
    text-align: left;
}

.slash-menu-item:hover,
.slash-menu-item.selected {
    background: #f1f5f9;
}

.slash-menu-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    flex-shrink: 0;
    transition: border-color 0.1s;
}

.slash-menu-item:hover .slash-menu-icon,
.slash-menu-item.selected .slash-menu-icon {
    border-color: #cbd5e1;
    background: #fff;
}

.slash-menu-text {
    flex: 1;
    min-width: 0;
}

.slash-menu-label {
    font-weight: 500;
    display: block;
}

.slash-menu-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ FLOATING TOOLBAR ============ */
.floating-toolbar {
    position: fixed;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #1a1f2e;
    border-radius: 10px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: ftFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

@keyframes ftFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.ft-group {
    display: flex;
    align-items: center;
    gap: 1px;
}

.ft-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #8b95a9;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: var(--font, 'Inter', sans-serif);
    transition: all 0.1s;
    padding: 0;
}

.ft-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.ft-btn.active {
    background: rgba(99, 131, 255, 0.2);
    color: #93b4ff;
}

.ft-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.ft-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ---- Heading dropdown ---- */
.ft-heading-group {
    position: relative;
}

.ft-heading-trigger {
    width: auto !important;
    padding: 0 8px !important;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.ft-heading-label {
    min-width: 24px;
    text-align: center;
}

.ft-heading-trigger svg {
    width: 10px;
    height: 10px;
    opacity: 0.5;
    transition: transform 0.15s;
}

.ft-heading-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 4px;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

.ft-heading-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ft-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: var(--font, 'Inter', sans-serif);
    text-align: left;
    transition: all 0.1s;
}

.ft-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.ft-h-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 20px;
    border-radius: 4px;
    background: rgba(99, 131, 255, 0.12);
    color: #93b4ff;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* ============ LINK INPUT POPUP ============ */
.link-popup {
    position: fixed;
    z-index: 2600;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 10px;
    min-width: 340px;
    animation: ftFadeIn 0.12s ease;
}

.link-popup-row {
    display: flex;
    gap: 6px;
}

.link-popup input {
    font-family: var(--font, 'Inter', sans-serif);
    font-size: 0.8125rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    flex: 1;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.link-popup input:focus {
    border-color: var(--color-primary, #346DDB);
}

.link-popup button {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
    font-family: var(--font, 'Inter', sans-serif);
}

.link-popup .link-save {
    background: var(--color-primary, #346DDB);
    color: #fff;
    white-space: nowrap;
}

.link-popup .link-save:hover {
    filter: brightness(1.1);
}

.link-popup .link-remove {
    display: block;
    width: 100%;
    margin-top: 6px;
    background: #fef2f2;
    color: #ef4444;
    text-align: center;
    font-size: 0.75rem;
}

.link-popup .link-remove:hover {
    background: #fee2e2;
}

/* ============ BLOCK ADD BUTTON (+ on left) ============ */
.block-add-btn {
    position: absolute;
    left: -40px;
    top: 2px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 300;
    opacity: 0;
    transition: all 0.15s;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.block-add-btn:hover {
    border-color: var(--color-primary, #346DDB);
    color: var(--color-primary, #346DDB);
    background: rgba(52, 109, 219, 0.04);
    transform: scale(1.05);
}

/* ============ DRAG HANDLE ============ */
.drag-handle {
    position: absolute;
    left: -56px;
    top: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
    font-size: 12px;
}

.drag-handle:hover {
    color: #64748b;
}

.drag-handle svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Show controls on block hover */
.tiptap-content>*:hover>.block-add-btn,
.tiptap-content>*:hover>.drag-handle,
.tiptap-content>.has-focus>.block-add-btn,
.tiptap-content>.has-focus>.drag-handle {
    opacity: 1;
}

/* ============ SELECTION ============ */
.tiptap-content ::selection {
    background: rgba(52, 109, 219, 0.15);
}

.tiptap-content *::selection {
    background: rgba(52, 109, 219, 0.15);
}

/* ============ VIDEO EMBEDS (YouTube, Loom, etc.) ============ */
.tiptap-content .video-embed {
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    position: relative;
}

.tiptap-content .video-embed iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    border-radius: 12px;
}

/* Overlay to capture clicks (iframes swallow events) */
.video-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.15s;
}

.video-overlay:hover {
    background: rgba(0, 0, 0, 0.08);
}

.video-overlay:hover::after {
    content: '✏️ Sửa link video';
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    pointer-events: none;
}

/* Edit popup */
.video-edit-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 16px;
    min-width: 380px;
}

.video-edit-popup input {
    width: 100%;
    font-family: var(--font, 'Inter', sans-serif);
    font-size: 0.875rem;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.video-edit-popup input:focus {
    border-color: var(--color-primary, #346DDB);
}

.video-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.video-edit-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s;
}

.video-save {
    background: var(--color-primary, #346DDB);
    color: #fff;
}

.video-save:hover {
    filter: brightness(1.1);
}

.video-delete {
    background: #fef2f2;
    color: #ef4444;
}

.video-delete:hover {
    background: #fee2e2;
}

/* ============ DOCS CARD NODE ============ */
.tiptap-content .docs-card-node {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0;
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.tiptap-content .docs-card-node:hover {
    border-color: var(--color-primary, #346DDB);
    box-shadow: 0 2px 8px rgba(52, 109, 219, 0.1);
}

.docs-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.docs-card-icon {
    flex-shrink: 0;
    color: var(--color-primary, #346DDB);
    margin-top: 2px;
}

.docs-card-body {
    flex: 1;
    min-width: 0;
}

.docs-card-header {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text, #1a1a2e);
    margin-bottom: 2px;
}

.docs-card-text {
    font-size: 0.8125rem;
    color: var(--color-primary, #346DDB);
    font-weight: 500;
}

.docs-card-href {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Edit popup */
.docs-card-popup {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.docs-card-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.docs-card-field input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.docs-card-field input:focus {
    border-color: var(--color-primary, #346DDB);
}

.docs-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.docs-card-save,
.docs-card-delete {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    font-weight: 500;
}

.docs-card-save {
    background: var(--color-primary, #346DDB);
    color: #fff;
}

.docs-card-save:hover {
    opacity: 0.9;
}

.docs-card-delete {
    background: #fee;
    color: #d33;
}

.docs-card-delete:hover {
    background: #fdd;
}

/* ============ IMAGE CHOICE & MEDIA PICKER ============ */
.img-choice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.img-choice-modal {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    min-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.img-choice-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.img-choice-options {
    display: flex;
    gap: 12px;
}

.img-choice-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #333;
}

.img-choice-btn:hover {
    border-color: var(--color-primary, #346DDB);
    background: #f0f4ff;
    color: var(--color-primary, #346DDB);
}

.img-choice-btn svg {
    color: var(--color-primary, #346DDB);
}

/* Media Picker Modal */
.media-picker-modal {
    background: #fff;
    border-radius: 14px;
    width: 640px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.media-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.media-picker-title {
    font-size: 0.9375rem;
    font-weight: 700;
}

.media-picker-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.media-picker-close:hover {
    background: #f3f4f6;
    color: #333;
}

.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.media-picker-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.media-picker-item:hover {
    border-color: var(--color-primary, #346DDB);
    box-shadow: 0 2px 8px rgba(52, 109, 219, 0.15);
}

.media-picker-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}

.media-picker-name {
    font-size: 0.6875rem;
    padding: 6px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #666;
}

/* ============ EMPTY STATE ============ */
.tiptap-content.is-editor-empty::before {
    display: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .tiptap-content {
        padding: 0 20px 120px;
        font-size: 15px;
    }

    .tiptap-content h1 {
        font-size: 1.625rem;
    }

    .tiptap-content h2 {
        font-size: 1.25rem;
    }

    .slash-menu {
        min-width: 240px;
    }

    .block-add-btn,
    .drag-handle {
        display: none;
    }
}