body:has(#main_tool_btn[disabled]) {

    #result,
    #result .ql-editor,
    .toolbar-container-tools,
    .toolbar-container-tools * {
        pointer-events: none;
    }
}

body:has(#floorad-wrapper:not([style*="display:none"])),
body:has(.top_ad_box) {
    --ad-shave: 100px;

    @media (max-width: 1024px) {
        --ad-shave: 0px;
    }
}

body:has(#floorad-wrapper:not([style*="display:none"])):has(.top_ad_box) {
    --ad-shave: 200px;
}

#captchaId {
    bottom: calc(100% + 10px);
    top: unset;
    left: 50%;
    transform: translateX(-50%);
}

.tool__div__section .tool__wrapper__design,
body .tool__wrapper__design {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 auto;
    width: 100%;

    @media (width <=768px) {
        padding: 0 16px;
    }
}

.flex-col:not(.sidebar__stick__ads, .sticky_ad, .main_box, .tool__wrapper__design) {
    width: 76%;
}

.tool-section-container {
    width: 70%;
    margin: 0 auto;

    @media screen and (max-width: 768px) {
        width: 95%;
    }
}

.flex-row-centered {
    margin: 0rem auto;
}

.gpt-tools-content {
    position: relative;
    margin: 40px auto;
}

.content-main-col {
    width: 76%;

    @media screen and (max-width: 768px) {
        width: 100%;
    }
}

.tool__wrapper__design::before,
.feedback_expression {
    background: #FBFDFD !important;
}

.feedback_expression {
    margin-top: 20px !important;
}

/* Tool Box */
.ep__tool__result {
    display: flex;
    flex-direction: column;
    width: 100%;
    outline: none;
    border-radius: 16px;
    border: 1px solid var(--dark-border-green);
    background-color: var(--color-light);
}

/* Header / Toolbar */
.js-sticky-header {
    padding: 12px 16px;
    background-color: var(--color-light);
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid rgba(2, 47, 54, 0.3);
}

#toolbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    padding: 0 !important;
    border: 0 !important;
}

.toolbar-container-tools {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px 12px;
}

.toolbar-container-tools>div:not(.toolbar-skeleton) {
    display: flex;
    flex-wrap: wrap;
}

/* Toolbar skeleton - shown until Quill finishes loading */
.toolbar-skeleton {
    display: none;
}

.toolbar-container-tools.is-loading {
    overflow: hidden;
    height: 24px;
}

.toolbar-container-tools.is-loading>*:not(.toolbar-skeleton) {
    visibility: hidden;
}

.toolbar-container-tools.is-loading .toolbar-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 8px 12px;
}

.tb-skel {
    display: block;
    width: 28px;
    height: 24px;
    max-height: 24px;
    min-height: 24px;
    border-radius: 6px;
    padding: 0 !important;
    flex: 0 0 auto;
    background: linear-gradient(90deg,
            rgba(2, 47, 54, 0.06) 25%,
            rgba(2, 47, 54, 0.12) 37%,
            rgba(2, 47, 54, 0.06) 63%);
    background-size: 400% 100%;
    animation: tb-skel-shimmer 1.4s ease infinite;
}

.tb-skel-lg {
    width: 96px;
}

@keyframes tb-skel-shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

.ql-snow.ql-toolbar:after,
.ql-snow .ql-toolbar:after {
    display: none !important;
}

.ql-toolbar.ql-snow .ql-formats {
    margin-right: 0 !important;
    display: flex;
    align-items: center;
}

/* Heading picker default label: show "Paragraph" (matches the dropdown
   option) instead of Quill's built-in "Normal". */
#toolbar-container .ql-picker.ql-header .ql-picker-label:not([data-value])::before,
#toolbar-container .ql-picker.ql-header .ql-picker-label[data-value=""]::before {
    content: 'Paragraph';
}

#undo-redo {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

#undo-redo button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: default;
    padding: 3px 5px;
    opacity: 0.35;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

/* Enabled (history available) - clickable and highlights on hover */
#undo-redo button.is-enabled {
    cursor: pointer;
    opacity: 1;
}

#undo-redo button.is-enabled:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

/* Editor Area - min height, expands on input, capped to viewport */
.ql-container.ql-snow {
    border: none;
    height: auto;
}

.ep__tool__editor {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Clear-input button pinned to the editor corner */
.clear-input-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(2, 47, 54, 0.06);
    color: rgba(2, 47, 54, 0.7);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.clear-input-btn:hover {
    background: rgba(2, 47, 54, 0.12);
    color: rgba(2, 47, 54, 0.95);
}

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

/* Custom placeholder with a clickable "Paste text" link */
.textarea-custom-placeholder {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-weight: 400;
    font-size: 16px;
    line-height: 28px;
    color: rgba(2, 47, 54, 0.5);
    pointer-events: none;
}

.textarea-custom-placeholder .paste__text-btn {
    all: unset;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 400;
    font-size: 16px;
    line-height: 28px;
    color: rgba(2, 47, 54, 0.8);
    pointer-events: all;
}

#result {
    font-size: 16px;
    padding: 0 16px;
    padding-right: 50px;
    min-height: 364px;
    max-height: calc(100vh - 220px - var(--ad-shave, 0px));
    overflow-y: auto;

    .ql-editor {
        padding-inline: 0 !important;
        padding-block: 16px !important;
        min-height: 332px;
        line-height: 28px;
    }

    .ql-editor.ql-blank::before {
        left: 16px;
        right: 16px;
        font-style: normal;
        color: rgba(2, 47, 54, 0.5);
    }

    h1 {
        font-size: 28px !important;
        margin: 4px 0 12px;
    }

    h2 {
        font-size: 24px !important;
        margin: 4px 0 12px;
    }

    h3 {
        font-size: 22px !important;
        margin: 4px 0 12px;
    }

    h4 {
        font-size: 20px !important;
        margin: 4px 0 12px;
    }

    h5 {
        font-size: 18px !important;
        margin: 4px 0 12px;
    }

    h6 {
        font-size: 16px !important;
        margin: 4px 0 12px;
    }

    p,
    ul,
    ol {
        margin-bottom: 12px;
    }
}

#result::-webkit-scrollbar-track {
    margin: 10px 0 16px;
}

/* Bottom Bar - submit button centered, upload/word-count pinned left */
.bottom-bar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background-color: var(--color-light);
    border-radius: 0 0 16px 16px;
    border-top: 1px solid rgba(2, 47, 54, 0.3);
}

.result__bottombar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #022F36CC;
}

.result__bottombar p {
    margin: 0;
}

.bottom-bar-left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: rgba(2, 47, 54, 0.8);
}

.upload-btn img {
    width: 20px;
    height: 20px;
}

.action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

#main_tool_btn.main-btn {
    margin: 0;
    min-width: unset;
    padding: 8px 20px;
    border-radius: 999px;
}

/* Mobile: let the toolbar scroll horizontally; hand the scroll to the
   result box while a tool dropdown is open so the menu isn't clipped */
@media (max-width: 1024px) {
    .js-sticky-header {
        overflow-x: auto;
    }

    .ep__tool__result.tool-dropdown-open .js-sticky-header {
        overflow-x: visible;
    }

    .ep__tool__result.tool-dropdown-open {
        overflow-x: hidden;
    }
}

@media screen and (max-width: 768px) {
    #toolbar-container {
        flex-direction: column;
        align-items: start;
        gap: 16px;
    }

    /* Mobile: upload/word-count on the left, submit on the right */
    .bottom-bar {
        justify-content: space-between;
        gap: 8px;
    }

    .bottom-bar-left {
        position: static;
        transform: none;
    }

    #main_tool_btn.main-btn {
        margin-left: auto;
    }
    #captchaId {
        left: unset;
        right: -32px;
        transform: translateX(0);
    }
}