/* History and Revisions Sidebar Styles */
.atheaico-history-section {
    border-top: 1px solid #dcdcde;
    padding-top: 20px;
    margin-top: 20px;
}

.atheaico-history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.history-item.is-current {
    border-color: #cce5ff;
    background-color: #f0f7ff;
}

.history-item summary {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    position: relative;
    user-select: none;
}

.history-item summary::-webkit-details-marker {
    display: none;
}

/* Arrow icon */
.history-item summary::before {
    content: "▶";
    font-size: 10px;
    margin-right: 12px;
    transition: transform 0.2s;
    color: #757575;
}

.history-item[open] summary::before {
    transform: rotate(90deg);
}

.history-summary-left {
    flex: 0 0 150px;
}

.history-version-label {
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-now-badge {
    background: #2271b1;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
}

.history-date {
    font-size: 11px;
    color: #757575;
    margin-top: 2px;
}

.history-summary-middle {
    flex-grow: 1;
    padding: 0 20px;
    overflow: hidden;
}

.history-prompt-truncated {
    font-size: 12px;
    color: #50575d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f6f7f7;
    padding: 6px 12px;
    border-radius: 20px;
    max-width: 100%;
}

.history-summary-right {
    flex: 0 0 100px;
    text-align: right;
}

.history-item .restore-version {
    background: #fff;
    border: 1px solid #dcdcde;
    color: #2c3338;
    border-radius: 20px;
    padding: 4px 16px;
    font-size: 12px;
    font-weight: 500;
}

.history-item .restore-version:hover {
    border-color: #2271b1;
    color: #2271b1;
}

/* Expanded Content */
.history-item-content {
    padding: 0 16px 16px 16px;
    border-top: 1px solid #f0f0f1;
}

.history-expanded-prompt-wrapper {
    background: #f6f7f7;
    border-radius: 12px;
    padding: 16px;
    margin-top: 15px;
    position: relative;
}

.history-expanded-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: #1d2327;
}

.history-expanded-prompt-text {
    font-size: 13px;
    line-height: 1.5;
    color: #50575e;
    margin-bottom: 12px;
}

.history-expanded-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #757575;
}

.history-copy-prompt {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #2271b1;
    cursor: pointer;
    font-weight: 500;
    padding: 0;
}

.history-copy-prompt:hover {
    color: #135e96;
}

.history-expanded-response-wrapper {
    margin-top: 20px;
}

.history-expanded-response-content {
    border: 1px solid #dcdcde;
    border-radius: 12px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
}

.history-item-actions {
    margin-top: 15px;
    text-align: right;
}

.remove-version {
    color: #757575;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.remove-version:hover {
    color: #d63638;
}

/* Status Loading Bar */
.atheaico-loading-bar-container {
    position: fixed;
    top: 32px; /* WP Admin Bar height */
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(34, 113, 177, 0.1);
    z-index: 100000;
}

.atheaico-loading-bar-inner {
    height: 100%;
    background: #2271b1;
    width: 30%;
    animation: atheaico-loading-anim 1.5s infinite linear;
}

@keyframes atheaico-loading-anim {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 60%; }
    100% { transform: translateX(400%); width: 30%; }
}

/* Custom Icons */
.history-icon-copy {
    width: 14px;
    height: 14px;
}

/* Other UI Tweaks */
.atheaico-show-more {
    border-radius: 20px;
    padding: 4px 20px;
    margin: 20px auto;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .history-item summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .history-summary-left, .history-summary-right {
        flex: none;
        width: 100%;
        text-align: left;
    }
    .history-summary-middle {
        padding: 0;
        width: 100%;
    }
}

/* Custom Notice Styling */
.atheaico-notice-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.atheaico-notice {
    padding: 12px 20px;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    animation: atheaico-fade-in 0.3s forwards;
}

.atheaico-notice.is-success { background-color: #2271b1; } /* WordPress Blue */
.atheaico-notice.is-error { background-color: #d63638; } /* WordPress Red */

@keyframes atheaico-fade-in {
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Icon for TinyMCE Toolbar Button */
i.mce-i-atheaico_actions_button {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="currentColor" d="m13.294 7.436.803 2.23c.892 2.475 2.841 4.424 5.316 5.316l2.23.803c.201.073.201.358 0 .43l-2.23.803c-2.475.892-4.424 2.841-5.316 5.316l-.803 2.23c-.073.201-.358.201-.43 0l-.803-2.23c-.892-2.475-2.841-4.424-5.316-5.316l-2.23-.803c-.201-.073-.201-.358 0-.43l2.23-.803c2.475-.892 4.424-2.841 5.316-5.316l.803-2.23c.072-.202.357-.202.43 0z"/><path fill="currentColor" d="m23.332 2.077.407 1.129c.452 1.253 1.439 2.24 2.692 2.692l1.129.407c.102.037.102.181 0 .218l-1.129.407c-1.253.452-2.24 1.439-2.692 2.692l-.407 1.129c-.037.102-.181.102-.218 0l-.407-1.129c-.452-1.253-1.439-2.24-2.692-2.692l-1.129-.407c-.102-.037-.102-.181 0-.218l1.129-.407c1.253-.452 2.24-1.439 2.692-2.692l.407-1.129c.037-.103.182-.103.218 0z"/><path fill="currentColor" d="m23.332 21.25.407 1.129c.452 1.253 1.439 2.24 2.692 2.692l1.129.407c.102.037.102.181 0 .218l-1.129.407c-1.253.452-2.24 1.439-2.692 2.692l-.407 1.129c-.037.102-.181.102-.218 0l-.407-1.129c-.452-1.253-1.439-2.24-2.692-2.692l-1.129-.407c-.102-.037-.102-.181 0-.218l1.129-.407c1.253-.452 2.24-1.439 2.692-2.692l.407-1.129c.037-.102.182-.102.218 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    width: 20px;
    height: 20px;
    font-size: inherit !important; /* Prevent TinyMCE from deforming the icon */
}

/* Modal Styles for "Add Image" action */
.atheaico-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 160000; /* High z-index to be on top of WP UI */
    display: flex;
    justify-content: center;
    align-items: center;
}

.atheaico-modal-content {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,.5);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.atheaico-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.atheaico-modal-close:hover {
    opacity: 0.8;
}

.atheaico-modal-footer {
    margin-top: 20px;
    display: flex;
    align-items: center;
}

.block-editor-page #atheaico-image-generator-container {
    padding-bottom: 50px;
    box-sizing: border-box; /* Ensure padding is included correctly */
}