/* AI Loader */
/* Optional post.html plug-in for AI / Prompt / Handmade views. */

.ai-header {
    width: 340px;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;    
}


.ai-loader[hidden] {
    display: none !important;
}

.ai-loader {
    position: absolute;
    top: 40px;
    right: 0;
    z-index: 1500;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.ai-btn {
    width: 34px;
    height: 34px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    border: 1px solid currentColor;
    border-radius: 10%;
    color: #69696920;
    transition: color 160ms ease, background-color 160ms ease;
    box-shadow: 3px 2px 3px #fa669930;
}

.ai-btn::before {
    display: block;
    font-size: 18px;
    line-height: 1;
}

.ai-btn::after {
    display: block;
    margin-top: 1px;
    font-size: 6.5px;
    line-height: 1;
    white-space: nowrap;
}

.ai-btn.a::before { content: "𝓐"; }
.ai-btn.a::after { content: "AI"; }
.ai-btn.p::before { content: "𝓟"; }
.ai-btn.p::after { content: "Prompt"; }
.ai-btn.h::before { content: "𝓗"; }
.ai-btn.h::after { content: "Human"; }

.ai-btn:hover {
    background: #f8f8f8;
}

.post-text.post .user {
    text-align: justify;
}

.post-text.post .llm {
    text-align: left;
    /*font-size: 0.9rem;*/
    line-height: 25px;
    padding:10px;
}

.post-text.post .ai-source-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.2;
    letter-spacing: 0.9px;
}

.post-text.post hr {
    margin: 28px 0;
}

/* Markdown blockquote in AI-rendered content. */
.post-text.post .llm blockquote.ai-markdown-quote {
    margin: 18px 0;
    padding: 10px 14px;
    border-left: 3px solid #fa6699;
    background: rgba(250, 102, 153, 0.05);
    color: inherit;
    font-style: normal;
}

.post-text.post .llm blockquote.ai-markdown-quote:first-child {
    margin-top: 0;
}

.post-text.post .llm blockquote.ai-markdown-quote:last-child {
    margin-bottom: 0;
}

/* All mode: highlight user content */
.user{margin:10px;}
body:has(#ai-loader:not([hidden]):not([data-mode]),
         #ai-loader[data-mode="all"]) .post-text.post .user {
    /*background-color: #ffffff;*/
    padding: 20px;
    border-radius: 10px;
    /*font-size: 0.9rem;*/
    /* color: #fa6699; */
    border: 1px solid #fa669910;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
}

.post-text.post { padding:20px;}

/* H / P mode: lift the whole post text as one card */
body:has(#ai-loader[data-mode="h"],
         #ai-loader[data-mode="p"]) .post-text.post {
    width: calc(100% - 14px);
    margin-left: 7px;
    margin-right: 7px;
    box-sizing: border-box;
    position: relative;
    z-index: 0;
   /* background-color: #ffffff;*/
    padding: 20px;
    border-radius: 10px;
    /*font-size: 0.9rem;*/
    /* color: #fa6699; */
    border: 1px solid #fa669910;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
}

@media (max-width: 600px) {
    .ai-header {
        width: 340px;
    }

    .ai-loader {
        top: 40px;
        right: 0;
        gap: 5px;
    }

    .ai-btn {
        width: 34px;
        height: 34px;
    }

    .ai-btn::before {
        font-size: 18px;
    }

    .ai-btn::after {
        font-size: 6.5px;
    }
}

/* Current version status */
.ai-version-status {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    padding: 5px 9px;
    color: #696969;
    font-size: 9px;
    line-height: 1.2;
    white-space: nowrap;
    z-index: 1501;
    pointer-events: none;
    width: 110px;
    text-align: center;
    border-bottom: 1px solid #fa6699;
}

/* Hide only when there is no active version label. */
.ai-version-status:empty {
    display: none;
}

/* Connected downward arrow pointing to the active mode button. */
.ai-version-status::after {
    content: "";
    position: absolute;

    width: 0;
    height: 0;

    bottom: -5px;

    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #fa6699;
}

.ai-version-status[data-mode="a"]::after {
    left: 14px;
}

.ai-version-status[data-mode="h"]::after {
    left: 50%;
    margin-left: -4px;
}

.ai-version-status[data-mode="p"]::after {
    right: 14px;
}

