.rich-text-field {
    position: relative;
    --rich-text-editor-height: 340px;
    --rich-text-toolbar-bg: linear-gradient(180deg, #1a2332 0%, #151d2a 100%);
    --rich-text-toolbar-border: rgba(124, 155, 200, 0.18);
    --rich-text-toolbar-button-bg: rgba(255, 255, 255, 0.04);
    --rich-text-toolbar-button-bg-hover: rgba(100, 185, 255, 0.12);
    --rich-text-toolbar-button-border: rgba(124, 155, 200, 0.16);
    --rich-text-toolbar-button-border-active: rgba(100, 185, 255, 0.38);
}

.rich-text-field__actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.rich-text-field__preview-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(124, 155, 200, 0.22);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(31, 43, 61, 0.94) 0%, rgba(20, 28, 40, 0.94) 100%);
    color: #e5f0ff;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.rich-text-field__preview-toggle:hover,
.rich-text-field.is-preview-visible .rich-text-field__preview-toggle {
    background: linear-gradient(180deg, rgba(53, 102, 161, 0.34) 0%, rgba(31, 63, 103, 0.34) 100%);
    border-color: rgba(100, 185, 255, 0.4);
    color: #f3f8ff;
    transform: translateY(-1px);
}

.rich-text-field__textarea {
    min-height: var(--rich-text-editor-height);
    padding: 18px 20px;
    background: #0d1420;
    color: #d6e4f5;
    border: 1px solid rgba(124, 155, 200, 0.18);
    border-radius: 16px;
    line-height: 1.7;
    resize: vertical;
}

.rich-text-field__textarea::placeholder {
    color: rgba(214, 228, 245, 0.54);
}

.rich-text-field.is-rich-editor-ready .rich-text-field__textarea {
    display: none;
}

.rich-text-field .ck.ck-editor {
    display: block;
    border: 1px solid rgba(124, 155, 200, 0.18);
    border-radius: 16px;
    overflow: hidden;
    background: #0d1420;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.rich-text-field .ck.ck-sticky-panel .ck-sticky-panel__content {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.rich-text-field .ck.ck-toolbar {
    background: var(--rich-text-toolbar-bg);
    border: 0;
    border-bottom: 1px solid rgba(124, 155, 200, 0.14);
    padding: 11px 12px;
    gap: 7px;
    flex-wrap: wrap;
    align-items: center;
}

.rich-text-field .ck.ck-toolbar .ck-toolbar__items {
    gap: 7px;
    flex-wrap: wrap;
    align-items: center;
}

.rich-text-field .ck.ck-toolbar__separator {
    align-self: center;
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, rgba(124, 155, 200, 0.06) 0%, rgba(124, 155, 200, 0.3) 50%, rgba(124, 155, 200, 0.06) 100%);
    margin: 0 2px;
}

.rich-text-field .ck.ck-button,
.rich-text-field .ck.ck-dropdown > .ck-button {
    min-height: 34px;
    min-width: 34px;
    border-radius: 10px;
    border: 1px solid var(--rich-text-toolbar-button-border);
    background: var(--rich-text-toolbar-button-bg);
    color: #d6e4f5;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.rich-text-field .ck.ck-button:hover,
.rich-text-field .ck.ck-button.ck-on,
.rich-text-field .ck.ck-button.ck-on:hover,
.rich-text-field .ck.ck-dropdown > .ck-button:hover,
.rich-text-field .ck.ck-dropdown > .ck-button.ck-on {
    background: var(--rich-text-toolbar-button-bg-hover);
    border-color: var(--rich-text-toolbar-button-border-active);
    color: #f3f8ff;
    box-shadow: none;
    transform: translateY(-1px);
}

.rich-text-field .ck.ck-button .ck-icon,
.rich-text-field .ck.ck-dropdown > .ck-button .ck-icon {
    color: currentColor;
}

.rich-text-field .ck.ck-button.ck-disabled,
.rich-text-field .ck.ck-dropdown > .ck-button.ck-disabled {
    opacity: 0.5;
    transform: none;
}

.rich-text-field .ck.ck-button.ck-button_with-text {
    min-width: auto;
    padding: 0 11px;
}

.rich-text-field .ck.ck-button .ck-button__label,
.rich-text-field .ck.ck-dropdown > .ck-button .ck-button__label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.rich-text-field .ck.ck-button.ck-button_with-text.ck-on {
    background: linear-gradient(180deg, rgba(53, 102, 161, 0.28) 0%, rgba(31, 63, 103, 0.28) 100%);
}

.rich-text-field .ck.ck-editor__main > .ck-editor__editable {
    min-height: var(--rich-text-editor-height);
    padding: 20px 22px;
    background: #0d1420;
    color: #d6e4f5;
    border: 0;
    box-shadow: none;
}

.rich-text-field .ck.ck-editor__main > .ck-editor__editable.ck-focused {
    box-shadow: inset 0 0 0 1px rgba(100, 185, 255, 0.4);
}

.rich-text-field .ck.ck-editor__editable > .ck-placeholder::before {
    color: rgba(214, 228, 245, 0.5);
}

.rich-text-field .ck.ck-dropdown__panel,
.rich-text-field .ck.ck-balloon-panel,
.rich-text-field .ck.ck-balloon-panel.ck-powered-by-balloon,
.rich-text-field .ck.ck-list,
.rich-text-field .ck.ck-toolbar-dropdown .ck-toolbar,
.rich-text-field .ck.ck-input,
.rich-text-field .ck.ck-input-text,
.rich-text-field .ck.ck-labeled-field-view .ck.ck-input-text {
    background: #121a27;
    color: #d6e4f5;
    border-color: rgba(124, 155, 200, 0.18);
}

.rich-text-field .ck.ck-list__item .ck-button {
    border: 0;
    background: transparent;
    border-radius: 8px;
}

.rich-text-field .ck.ck-list__item .ck-button:hover,
.rich-text-field .ck.ck-list__item .ck-button.ck-on {
    background: rgba(100, 185, 255, 0.12);
}

.rich-text-field .ck.ck-input,
.rich-text-field .ck.ck-input-text,
.rich-text-field .ck.ck-labeled-field-view .ck.ck-input-text {
    color: #d6e4f5;
}

.rich-text-field .ck.ck-input.ck-input-text:focus {
    border-color: rgba(100, 185, 255, 0.4);
    box-shadow: none;
}

.rich-text-field .ck.ck-powered-by {
    background: rgba(18, 26, 39, 0.92);
    border-color: rgba(124, 155, 200, 0.18);
    color: rgba(214, 228, 245, 0.8);
}

.rich-text-field__preview {
    display: none;
    min-height: 180px;
    margin-top: 14px;
    padding: 20px 22px;
    border: 1px solid rgba(124, 155, 200, 0.18);
    border-radius: 16px;
    background: #0d1420;
}

.rich-text-field.is-preview-visible .rich-text-field__preview {
    display: block !important;
}

.rich-text-field__footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px 0;
    color: rgba(214, 228, 245, 0.78);
    font-size: 0.95rem;
}

.rich-text-field.is-invalid .ck.ck-editor,
.rich-text-field.is-invalid .rich-text-field__textarea,
.rich-text-field.is-invalid .rich-text-field__preview {
    border-color: rgba(255, 107, 107, 0.55) !important;
}

.rich-text-field .ck-content,
.rich-text-content {
    color: inherit;
    line-height: 1.7;
}

.rich-text-field .ck-content > :first-child,
.rich-text-content > :first-child {
    margin-top: 0;
}

.rich-text-field .ck-content > :last-child,
.rich-text-content > :last-child {
    margin-bottom: 0;
}

.rich-text-field .ck-content a,
.rich-text-content a {
    color: #8ac8ff;
    text-decoration: underline;
}

.rich-text-field .ck-content blockquote,
.rich-text-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid rgba(100, 185, 255, 0.45);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 12px 12px 0;
}

.rich-text-field .ck-content pre,
.rich-text-content pre {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    overflow-x: auto;
}

.rich-text-field .ck-content code,
.rich-text-content code {
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.rich-text-field .ck-content pre code,
.rich-text-content pre code {
    padding: 0;
    background: transparent;
}

.rich-text-field .ck-content figure.image,
.rich-text-content figure.image {
    margin: 14px auto;
    text-align: center;
}

.rich-text-field .ck-content figure.image img,
.rich-text-content figure.image img,
.rich-text-content > img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
}

.rich-text-field .ck-content figcaption,
.rich-text-content figcaption {
    margin-top: 8px;
    color: rgba(214, 228, 245, 0.68);
    font-size: 0.92rem;
}

.rich-text-field .ck-content table,
.rich-text-content table {
    width: 100%;
    margin: 14px 0;
    border-collapse: collapse;
}

.rich-text-field .ck-content th,
.rich-text-field .ck-content td,
.rich-text-content th,
.rich-text-content td {
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(124, 155, 200, 0.18);
}

@media (max-width: 575.98px) {
    .rich-text-field__actions {
        justify-content: flex-start;
    }

    .rich-text-field .ck.ck-toolbar {
        padding: 8px 10px;
    }

    .rich-text-field .ck.ck-toolbar__separator {
        display: none;
    }

    .rich-text-field .ck.ck-editor__main > .ck-editor__editable {
        padding: 16px 18px;
    }

    .rich-text-field__preview {
        padding: 16px 18px;
    }

    .rich-text-field__footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
