:root {
    --red: #ff605b;
    --background-color-tertiary: #E5E5E5;
    --text-color-tertiary: #9E9E9E;
}

[data-bs-theme=dark] {
    --background-color: #121212;
    --background-color-secondary: #252525;
    --background-color-tertiary: #1A1A1A;
    --text-color-secondary: #9E9E9E;
    --red: #c24f4e;
    --selection-color: #3C506DFF;
    --block-color: #414141;
    --toolbar-shadow: 0 4px 20px rgba(0, 0, 0, .32), 0 0 0 1px #363636
}

.ce-block__content,
.ce-toolbar__content {
    max-width: unset;
}

.ce-block-error,
.ce-block-error .cdx-button,
.ce-block-error ::before {
    color: var(--red) !important;
}

.ce-block-error-tooltip {
    color: var(--red) !important;
    font-size: 12px;
}

.cdx-notify {
    padding-right: 20px !important;
}

.cdx-notify__cross {
    right: 14px !important;
}

.scale-image {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.codex-editor {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.codex-editor__redactor {
    flex-grow: 1;
}

.ce-inline-toolbar__dropdown {
    display: none;
}

.ce-inline-toolbar__buttons button {
    margin-top: 4px;
    margin-bottom: 4px;
    width: 32px;
    border-radius: 6px;
}

.repost-container {
    background: #E5E5E5;
    border-radius: 12px;
}

.ce-popover-item--active .ce-popover-item__title {
    font-weight: bold;
}

/* Light Theme */

[data-bs-theme=light] .ct:has(.ce-block-error-tooltip):before {
    background-color: #fffbfb;
}


[data-bs-theme=light] .ct:before {
    content: "";
    bottom: 0;
    right: 0;
    background-color: #ffffff;
    z-index: -1;
    border-radius: 4px
}

[data-bs-theme=light] .ct {
    border: 1px solid #E8E8EB;
    -webkit-box-shadow: 0 3px 10px -3px rgba(13, 20, 33, .13);
    box-shadow: 0 3px 15px -3px #0d142121;
}

[data-bs-theme=light] .ct__content {
    color: #000;
}


[data-bs-theme=light] .ct--bottom:after {
    z-index: -2;
    background-color: #ffffff;
    -webkit-box-shadow: 0 3px 15px -3px rgba(13, 20, 33, .13);
    box-shadow: 0 3px 15px -3px #0d142121;
    border: 1px solid #E8E8EB;
}


/* Dark Theme */

[data-bs-theme=dark] .repost-container {
    background: var(--background-color-secondary);
    box-shadow: var(--toolbar-shadow);
}

[data-bs-theme=dark] body {
    background-color: var(--background-color)
}

[data-bs-theme=dark] ::selection {
    background: var(--selection-color);
}

/* Toolbar */

[data-bs-theme=dark] .ce-toolbar__plus path,
[data-bs-theme=dark] .ce-toolbar__settings-btn path {
    color: var(--text-color-secondary);
}

[data-bs-theme=dark] .ce-toolbar__plus:hover,
[data-bs-theme=dark] .ce-toolbar__settings-btn:hover {
    background-color: unset;
}

[data-bs-theme=dark] .ce-toolbar__plus:hover path,
[data-bs-theme=dark] .ce-toolbar__settings-btn:hover path {
    color: #ffffff;
}

[data-bs-theme=dark] .ce-popover-item {
    color: var(--text-color-secondary);
}

[data-bs-theme=dark] .ce-popover-item__icon,
[data-bs-theme=dark] .ce-conversion-tool__icon {
    background: unset;
    box-shadow: none;
}

[data-bs-theme=dark] .ce-popover-item--confirmation {
    background-color: unset;
}

[data-bs-theme=dark] .ce-popover-item--confirmation .ce-popover-item__title {
    color: var(--red);
}

@media (max-width: 650px) {
    [data-bs-theme=dark] .ce-toolbar__plus,
    [data-bs-theme=dark] .ce-toolbar__settings-btn {
        background-color: var(--background-color-secondary);
        box-shadow: var(--toolbar-shadow);
        border: unset;
    }

    [data-bs-theme=dark] .ce-toolbar__plus:hover,
    [data-bs-theme=dark] .ce-toolbar__settings-btn:hover {
        background-color: var(--background-color-secondary) !important;
    }

    [data-bs-theme=dark] .ce-popover__overlay {
        background: none;
    }
}

[data-bs-theme=dark] .ce-inline-toolbar {
    background: var(--background-color-tertiary);
    border: none;
    box-shadow: var(--toolbar-shadow);
    color: var(--text-color-secondary)
}

[data-bs-theme=dark] .ce-inline-tool:hover,
[data-bs-theme=dark] .ce-inline-toolbar__dropdown:hover,
[data-bs-theme=dark] .ce-popover-item:hover,
[data-bs-theme=dark] .ce-conversion-tool:hover {
    background: #23272f;
}

/* Media Toolbar */

[data-bs-theme=dark] .media-upload-btn,
[data-bs-theme=dark] .media-upload-btn,
[data-bs-theme=dark] .media-left-btn,
[data-bs-theme=dark] .media-right-btn,
[data-bs-theme=dark] .media-remove-btn {
    color: var(--text-color-secondary);
    background-color: var(--background-color-secondary);
    box-shadow: var(--toolbar-shadow)
}

[data-bs-theme=dark] .media-upload-btn:hover,
[data-bs-theme=dark] .media-upload-btn:hover,
[data-bs-theme=dark] .media-left-btn:hover,
[data-bs-theme=dark] .media-right-btn:hover,
[data-bs-theme=dark] .media-remove-btn:hover {
    background-color: var(--background-color-secondary);
}

[data-bs-theme=dark] .media-upload-btn:hover path,
[data-bs-theme=dark] .media-upload-btn:hover path,
[data-bs-theme=dark] .media-left-btn:hover path,
[data-bs-theme=dark] .media-right-btn:hover path,
[data-bs-theme=dark] .media-remove-btn:hover path {
    color: #ffffff;
}

/* Tools & Common Styles */

[data-bs-theme=dark] .cdx-block span {
    background-color: var(--block-color) !important;
}

[data-bs-theme=dark] .ce-block--selected .ce-block__content {
    background: var(--selection-color);
}

[data-bs-theme=dark] .cdx-button {
    background: var(--background-color-tertiary);
    border: none;
}

[data-bs-theme=dark] .ce-popover,
[data-bs-theme=dark] .cdx-search-field,
[data-bs-theme=dark] .ce-inline-tool-input,
[data-bs-theme=dark] .ce-conversion-toolbar {
    background: var(--background-color-tertiary);
    border: none;
    box-shadow: var(--toolbar-shadow);
}

[data-bs-theme=dark] .media-upload {
    border-radius: 12px;
}

[data-bs-theme=dark] .media-item--single {
    background-color: var(--background-color-tertiary);
    border-radius: 12px;
}

[data-bs-theme=dark] .cdx-input {
    background-color: var(--background-color-tertiary);
    border-color: var(--background-color-secondary);
}

/* Embed */


[data-bs-theme=dark] .embed-tool__preloader {
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

[data-bs-theme=dark] .embed-tool__content, .embed-tool__content--rendered {
    background-color: var(--background-color-tertiary) !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

[data-bs-theme=dark] .cdx-block .embed-tool span {
    background-color: var(--background-color-tertiary) !important;
}

/* Notification */

.cdx-notify--alert::before {
    background: #db9d39 !important
}

[data-bs-theme=dark] .cdx-notify {
    background-color: var(--background-color-tertiary) !important;
}

/* Tooltip */

[data-bs-theme=dark] .ct:before {
    content: "";
    bottom: 0;
    right: 0;
    background-color: var(--background-color-tertiary);
    z-index: -1;
    border-radius: 4px
}

/* Unsupported (Stub) */

[data-bs-theme=dark] .ce-stub {
    background-color: var(--background-color-tertiary);
    border: none;
    color: #ffffff;
}