/*
 * Стили TipTap-редактора статей (кастомное поле Filament).
 * Префикс tbe- = tiptap blog editor.
 */

.tbe-wrapper {
    width: 100%;
    border-radius: 0.5rem;
    --tw-ring-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    box-shadow: var(--tw-ring-shadow);
    background: #fff;
    overflow: hidden;
}

.tbe-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tbe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tbe-btn:hover {
    background: #e5e7eb;
}

.tbe-btn.is-active {
    background: #111827;
    color: #fff;
}

.tbe-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tbe-btn svg {
    width: 16px;
    height: 16px;
}

.tbe-sep {
    width: 1px;
    height: 22px;
    margin: 0 6px;
    background: #e5e7eb;
}

.tbe-btn-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Область редактирования */
.tbe-scroll {
    overflow-y: auto;
    max-height: 70vh;
}

.tbe-content {
    min-height: 420px;
    padding: 16px 20px 32px;
    outline: none;
    font-size: 14px;
    line-height: 1.65;
    color: #111827;
}

.tbe-content > * + * {
    margin-top: 0.75em;
}

.tbe-content h2 {
    font-size: 1.45em;
    font-weight: 700;
    margin-top: 1.2em;
}

.tbe-content h3 {
    font-size: 1.2em;
    font-weight: 700;
    margin-top: 1.1em;
}

.tbe-content ul,
.tbe-content ol {
    padding-left: 1.4em;
}

.tbe-content ul {
    list-style: disc;
}

.tbe-content ol {
    list-style: decimal;
}

.tbe-content li + li {
    margin-top: 0.25em;
}

.tbe-content blockquote {
    padding: 4px 0 4px 16px;
    border-left: 3px solid #d1d5db;
    color: #6b7280;
    font-style: italic;
}

.tbe-content pre {
    padding: 12px 16px;
    border-radius: 8px;
    background: #f3f4f6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    overflow-x: auto;
}

.tbe-content code {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}

.tbe-content pre code {
    background: transparent;
    padding: 0;
}

.tbe-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.4em 0;
}

.tbe-content a {
    color: #4f46e5;
    text-decoration: underline;
}

.tbe-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.tbe-content img.ProseMirror-selectednode {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.tbe-content table {
    border-collapse: collapse;
    width: 100%;
    overflow: hidden;
}

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

.tbe-content th {
    background: #f9fafb;
    font-weight: 600;
}

.tbe-content .selectedCell {
    background: #eef2ff;
}

/* Видео-ноды */
.tbe-video {
    display: block;
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background: #000;
}

video.tbe-video {
    aspect-ratio: auto;
    max-height: 70vh;
}

.tbe-content .ProseMirror-selectednode iframe,
.tbe-content .ProseMirror-selectednode video {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.tbe-video-placeholder {
    padding: 24px;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    color: #9ca3af;
    text-align: center;
}

/* Служебные состояния */
.tbe-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #6b7280;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.tbe-status .tbe-error {
    color: #b91c1c;
}

.tbe-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #d1d5db;
    border-top-color: #4b5563;
    border-radius: 50%;
    animation: tbe-spin 0.7s linear infinite;
}

@keyframes tbe-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Режим только для чтения */
.tbe-readonly {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.65;
    color: #374151;
    background: #f9fafb;
}
