.ai-grammar-field {
    position: relative;
    display: block;
}

.ai-grammar-field--textarea textarea {
    padding-right: 44px;
    padding-bottom: 34px;
}

.ai-grammar-field--input input {
    padding-right: 44px;
}

.ai-grammar-trigger {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #cccccc;
    border-radius: 50%;
    background: #ffffff;
    color: #514943;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.ai-grammar-field--textarea .ai-grammar-trigger {
    right: 8px;
    bottom: 8px;
}

.ai-grammar-field--input .ai-grammar-trigger {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.ai-grammar-trigger:hover,
.ai-grammar-trigger:focus {
    border-color: #ff5501;
    color: #ff5501;
}

.ai-grammar-trigger[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-grammar-trigger[disabled]:hover,
.ai-grammar-trigger[disabled]:focus {
    border-color: #cccccc;
    color: #514943;
}

.ai-grammar-trigger-icon {
    display: block;
    width: 16px;
    height: 16px;
    background-image: url('../images/ai-icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.ai-grammar-inline-message {
    display: none;
    margin-top: 6px;
    font-size: 1.2rem;
    color: #e02b27;
}

.ai-grammar-inline-message--visible {
    display: block;
}

.ai-grammar-modal .modal-header {
    position: relative;
    padding-top: 44px;
}

.ai-grammar-modal .modal-title {
    position: relative;
    border-bottom: none;
    text-align: center;
    padding-bottom: 16px;
    margin-top: 4px;
}

.ai-grammar-modal .modal-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-bottom: 2px solid #01549b;
}

.ai-grammar-disclaimer {
    margin-top: 4px;
    font-size: 1.1rem;
    color: #e02b27;
    text-align: center;
}

.ai-grammar-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-grammar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-grammar-label {
    font-weight: 600;
}

.ai-grammar-action {
    max-width: 320px;
}

.ai-grammar-preview {
    min-height: 60px;
    padding: 10px 12px;
    border: 1px solid #d6d6d6;
    border-radius: 4px;
    background: #fafafa;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-grammar-result {
    background: #ffffff;
}

.ai-grammar-status {
    min-height: 1.4em;
    font-size: 1.2rem;
    color: #666666;
}

.ai-grammar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.ai-grammar-actions button {
    border-radius: 6px;
}

.ai-grammar-actions button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-grammar-actions .ai-grammar-accept {
    background: #01549b;
    border-color: #01549b;
    color: #ffffff;
}

.ai-grammar-actions .ai-grammar-accept:hover,
.ai-grammar-actions .ai-grammar-accept:focus {
    background: #fff !important;
    color: #f6921e !important;
    border-color: #f6921e !important;
}

@media only screen and (max-width: 768px) {
    .ai-grammar-action {
        max-width: 100%;
    }

    /*
     * Magento's core mobile breakpoint turns any modal with `responsive: true` into a
     * right-side slide-out drawer (`.modal-popup.modal-slide` gets `left: 14.8rem` and
     * an auto-width inner wrap). That is overridden here, back to a centered dialog with
     * a fixed 310px width, using the same three classes for equal-or-higher specificity.
     */
    .ai-grammar-modal.modal-popup.modal-slide {
        left: 0;
    }

    .ai-grammar-modal.modal-popup.modal-slide .modal-inner-wrap {
        position: relative;
        transform: none;
        height: auto;
        max-height: 90vh;
        width: 310px;
        max-width: 310px;
        margin: 20px auto;
        overflow-y: auto;
    }

    .ai-grammar-modal.modal-popup.modal-slide.ai-grammar-modal--has-result .modal-inner-wrap {
        height: 480px;
        max-height: 480px;
    }

    .ai-grammar-modal .modal-header,
    .ai-grammar-modal .modal-content,
    .ai-grammar-modal .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .ai-grammar-modal .modal-header {
        padding-top: 32px;
        padding-bottom: 12px;
    }

    .ai-grammar-modal-content {
        gap: 12px;
    }

    .ai-grammar-actions {
        flex-wrap: wrap;
    }

    .ai-grammar-actions button {
        flex: 1 1 auto;
    }
}
@media (max-width: 768px) {
    .ai-grammar-modal.modal-popup.modal-slide .modal-inner-wrap {
        height: auto !important;
        max-height: fit-content !important;
        min-height: unset !important;
        overflow: visible !important;
        margin: 20px auto;
    }

    .ai-grammar-modal .modal-content {
        padding-bottom: 0;
    }

    .ai-grammar-modal .ai-grammar-disclaimer {
        margin-top: 20px !important; /* Adjust to 8px, 10px, 12px, etc. */
    }

   

.ai-grammar-modal .modal-title {
    flex: 1;
    text-align: center;
    margin: 0;
    padding: 10px 40px; /* 40px left & right reserves space for the X */
}

}