/**
 * Elite Public Chat — RC.3
 *
 * Modern, clean shell inspired by contemporary SaaS support assistants while
 * preserving Elite Pigeon Software navy, cream and gold identity.
 */

:root {
    --eps-ai-vtop:0px;
    --eps-ai-vh:100dvh;
    --eps-ai-primary:#0D1B2A;
    --eps-ai-primary-2:#173A59;
    --eps-ai-accent:#C9A84C;
    --eps-ai-accent-soft:#F8F0D9;
    --eps-ai-canvas:#F6F8FB;
    --eps-ai-surface:#FFFFFF;
    --eps-ai-border:#E3E8EF;
    --eps-ai-text:#152338;
    --eps-ai-muted:#718096;
}

.eps-ai-root,
.eps-ai-root * {
    box-sizing:border-box;
}

.eps-ai-root {
    position:fixed;
    z-index:99990;
    right:22px;
    bottom:20px;
    color:var(--eps-ai-text);
    font-family:
        var(--eps-site-font,Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif);
}

.eps-ai-root.eps-ai-left {
    right:auto;
    left:22px;
}

.eps-ai-launcher {
    min-width:178px;
    min-height:56px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:6px 16px 6px 6px;
    border:1px solid rgba(201,168,76,.64);
    border-radius:999px;
    background:linear-gradient(135deg,var(--eps-ai-primary),#133451);
    color:#fff;
    box-shadow:0 18px 46px rgba(8,22,37,.22);
    cursor:pointer;
    transition:transform .18s ease,box-shadow .18s ease;
}

.eps-ai-launcher:hover {
    transform:translateY(-2px);
    box-shadow:0 24px 58px rgba(8,22,37,.28);
}

.eps-ai-launcher-mark,
.eps-ai-avatar {
    flex:0 0 auto;
    display:grid;
    place-items:center;
    overflow:hidden;
    border:1px solid rgba(201,168,76,.78);
    background:#F5E9C5;
}

.eps-ai-launcher-mark {
    width:43px;
    height:43px;
    border-radius:50%;
}

.eps-ai-avatar {
    width:42px;
    height:42px;
    border-radius:13px;
}

.eps-ai-pigeon-art {
    width:112%;
    height:112%;
    display:block;
    object-fit:contain;
}

.eps-ai-launcher-copy {
    min-width:0;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
}

.eps-ai-launcher-label {
    color:#fff;
    font-size:13px;
    font-weight:800;
    line-height:1.1;
    white-space:nowrap;
}

.eps-ai-launcher-status {
    display:flex;
    align-items:center;
    gap:6px;
    margin-top:4px;
    color:rgba(255,255,255,.73);
    font-size:9px;
    font-weight:650;
}

.eps-ai-launcher-status i,
.eps-ai-header small i {
    width:8px;
    height:8px;
    flex:0 0 8px;
    border-radius:50%;
    background:#35D17B;
    box-shadow:0 0 0 4px rgba(53,209,123,.11);
}

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

.eps-ai-panel {
    position:absolute;
    right:0;
    bottom:70px;
    width:min(400px,calc(100vw - 28px));
    height:min(600px,calc(var(--eps-ai-vh) - 106px));
    display:grid;
    grid-template-rows:auto minmax(0,1fr) auto;
    overflow:hidden;
    border:1px solid rgba(13,27,42,.09);
    border-radius:24px;
    background:var(--eps-ai-surface);
    box-shadow:0 32px 100px rgba(8,22,37,.25);
    transform-origin:bottom right;
    animation:epsAiOpen .2s ease both;
}

.eps-ai-left .eps-ai-panel {
    right:auto;
    left:0;
    transform-origin:bottom left;
}

.eps-ai-header {
    min-height:72px;
    display:grid;
    grid-template-columns:42px minmax(0,1fr) 36px 36px;
    align-items:center;
    gap:9px;
    padding:12px 13px 12px 15px;
    background:linear-gradient(135deg,var(--eps-ai-primary),#143654);
    color:#fff;
}

.eps-ai-header-copy {
    min-width:0;
}

.eps-ai-header strong {
    display:block;
    overflow:hidden;
    color:#fff;
    font-size:14px;
    font-weight:800;
    line-height:1.2;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.eps-ai-header small {
    display:flex;
    align-items:center;
    gap:7px;
    margin-top:5px;
    overflow:hidden;
    color:rgba(255,255,255,.69);
    font-size:9px;
    line-height:1.2;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.eps-ai-icon-button {
    width:36px;
    height:36px;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.09);
    border-radius:11px;
    background:rgba(255,255,255,.08);
    color:#fff;
    padding:0;
    cursor:pointer;
}

.eps-ai-icon-button:hover {
    background:rgba(255,255,255,.15);
}

.eps-ai-icon-button svg {
    width:18px;
    height:18px;
    display:block;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.eps-ai-body {
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:16px 15px 22px;
    background:
        radial-gradient(circle at 100% 0,rgba(201,168,76,.055),transparent 28%),
        #F7F9FC;
    scrollbar-width:thin;
    scrollbar-color:#CBD4DF transparent;
}

.eps-ai-guide-shortcut {
    margin:0 0 11px;
    padding:0;
}

.eps-ai-guide-shortcut button {
    width:100%;
    min-height:39px;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:9px;
    border:1px solid rgba(201,168,76,.25);
    border-radius:13px;
    background:#FFF9EA;
    color:#72520D;
    padding:7px 10px;
    font-size:9px;
    font-weight:850;
    cursor:pointer;
}

.eps-ai-guide-shortcut span {
    width:24px;
    height:24px;
    display:grid;
    place-items:center;
    border-radius:8px;
    background:var(--eps-ai-primary);
    color:#E0C15C;
}

.eps-ai-suggestions {
    display:flex;
    gap:7px;
    margin:0 0 14px;
    overflow-x:auto;
    padding-bottom:2px;
    scrollbar-width:none;
}

.eps-ai-suggestions::-webkit-scrollbar {
    display:none;
}

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

.eps-ai-suggestions button {
    flex:0 0 auto;
    max-width:255px;
    min-height:34px;
    border:1px solid #DEE5ED;
    border-radius:999px;
    background:#fff;
    color:#526278;
    padding:7px 11px;
    font-size:9px;
    font-weight:750;
    line-height:1.25;
    cursor:pointer;
}

.eps-ai-suggestions button:hover {
    border-color:rgba(201,168,76,.45);
    color:#7A590D;
}

.eps-ai-messages {
    min-height:20px;
    display:flex;
    flex-direction:column;
    gap:9px;
}

.eps-ai-message {
    min-width:0;
    display:flex;
}

.eps-ai-message-user {
    justify-content:flex-end;
}

.eps-ai-message-bubble {
    max-width:84%;
    padding:10px 12px;
    border:1px solid #E2E7EE;
    border-radius:16px 16px 16px 6px;
    background:#fff;
    color:#34445A;
    box-shadow:0 5px 18px rgba(8,22,37,.035);
    font-size:12px;
    line-height:1.52;
    overflow-wrap:anywhere;
}

.eps-ai-message-user .eps-ai-message-bubble {
    border-color:var(--eps-ai-primary);
    border-radius:16px 16px 6px 16px;
    background:var(--eps-ai-primary);
    color:#fff;
    box-shadow:none;
}

.eps-ai-message.is-new {
    animation:epsAiMessage .17s ease both;
}

/*
 * Ephemeral indicator. It exists only while one active request owns it.
 */
.eps-ai-message-typing .eps-ai-message-bubble {
    width:max-content;
    min-width:48px;
    display:flex;
    align-items:center;
    gap:4px;
    padding:11px 12px;
}

.eps-ai-typing-bubble span {
    width:6px;
    height:6px;
    display:block;
    border-radius:50%;
    background:#7D8B9E;
    animation:epsAiDot .95s ease-in-out infinite;
}

.eps-ai-typing-bubble span:nth-child(2) {
    animation-delay:.12s;
}

.eps-ai-typing-bubble span:nth-child(3) {
    animation-delay:.24s;
}

/*
 * Absolute protection against cached legacy markup.
 */
[data-eps-ai-typing][hidden],
.eps-ai-typing[hidden],
.eps-ai-typing[aria-hidden="true"] {
    display:none!important;
}

.eps-ai-composer {
    min-height:76px;
    display:grid;
    grid-template-columns:minmax(0,1fr) 43px;
    gap:8px;
    padding:10px 11px 8px;
    border-top:1px solid #E8EDF2;
    background:#fff;
}

.eps-ai-composer textarea {
    width:100%;
    height:43px;
    max-height:104px;
    resize:none;
    border:1px solid #D8E0E9;
    border-radius:14px;
    background:#F9FAFC;
    color:var(--eps-ai-text);
    padding:10px 12px;
    font:500 13px/1.45 inherit;
    outline:none;
}

.eps-ai-composer textarea::placeholder {
    color:#98A4B4;
}

.eps-ai-composer textarea:focus {
    border-color:rgba(201,168,76,.72);
    background:#fff;
    box-shadow:0 0 0 3px rgba(201,168,76,.11);
}

.eps-ai-composer > button {
    width:43px;
    height:43px;
    display:grid;
    place-items:center;
    border:0;
    border-radius:14px;
    background:linear-gradient(145deg,#A97710,#D9B949);
    color:#112136;
    padding:0;
    cursor:pointer;
}

.eps-ai-composer > button:hover {
    filter:brightness(1.04);
}

.eps-ai-composer > button:disabled {
    opacity:.55;
    cursor:wait;
}

.eps-ai-composer > button svg {
    width:19px;
    height:19px;
    display:block;
    fill:none;
    stroke:currentColor;
    stroke-width:1.9;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.eps-ai-composer small {
    grid-column:1/-1;
    color:#98A4B4;
    font-size:8px;
    line-height:1.2;
    text-align:center;
}

.eps-ai-panel[aria-hidden="true"] {
    pointer-events:none;
}

.eps-ai-panel[aria-hidden="false"] {
    pointer-events:auto;
}

html.eps-ai-chat-open,
html.eps-ai-chat-open body {
    overflow:hidden!important;
}

.eps-ai-launcher:focus-visible,
.eps-ai-icon-button:focus-visible,
.eps-ai-composer button:focus-visible,
.eps-ai-suggestions button:focus-visible,
.eps-ai-guide-shortcut button:focus-visible {
    outline:3px solid rgba(201,168,76,.32);
    outline-offset:2px;
}

@keyframes epsAiOpen {
    from {
        opacity:0;
        transform:translateY(10px) scale(.975);
    }
    to {
        opacity:1;
        transform:none;
    }
}

@keyframes epsAiMessage {
    from {
        opacity:0;
        transform:translateY(5px);
    }
    to {
        opacity:1;
        transform:none;
    }
}

@keyframes epsAiDot {
    0%,60%,100% {
        transform:translateY(0);
        opacity:.38;
    }
    30% {
        transform:translateY(-4px);
        opacity:1;
    }
}

@media(max-width:700px) {
    .eps-ai-root,
    .eps-ai-root.eps-ai-left {
        right:12px;
        left:auto;
        bottom:max(12px,env(safe-area-inset-bottom));
    }

    .eps-ai-launcher {
        min-width:148px;
        min-height:54px;
        padding:6px 12px 6px 6px;
    }

    .eps-ai-launcher-mark {
        width:42px;
        height:42px;
    }

    .eps-ai-panel,
    .eps-ai-left .eps-ai-panel {
        position:fixed;
        inset:var(--eps-ai-vtop,0px) 0 auto 0;
        width:100vw;
        max-width:none;
        height:var(--eps-ai-vh,100dvh);
        max-height:none;
        border:0;
        border-radius:0;
        box-shadow:none;
        transform-origin:center;
    }

    .eps-ai-header {
        min-height:calc(66px + env(safe-area-inset-top));
        grid-template-columns:40px minmax(0,1fr) 38px 38px;
        padding:
            calc(10px + env(safe-area-inset-top))
            11px
            10px;
    }

    .eps-ai-avatar {
        width:40px;
        height:40px;
    }

    .eps-ai-body {
        padding:14px 13px 18px;
        -webkit-overflow-scrolling:touch;
    }

    .eps-ai-message-bubble {
        max-width:86%;
        font-size:13px;
    }

    .eps-ai-composer {
        min-height:calc(74px + env(safe-area-inset-bottom));
        grid-template-columns:minmax(0,1fr) 44px;
        padding:
            9px
            11px
            calc(7px + env(safe-area-inset-bottom));
    }

    .eps-ai-composer textarea {
        height:44px;
        font-size:16px;
    }

    .eps-ai-composer > button {
        width:44px;
        height:44px;
    }

    html.eps-ai-keyboard-open .eps-ai-header {
        min-height:58px;
        padding-top:8px;
        padding-bottom:8px;
    }

    html.eps-ai-keyboard-open .eps-ai-body {
        padding-top:10px;
        padding-bottom:10px;
    }

    html.eps-ai-keyboard-open .eps-ai-composer small {
        display:none;
    }
}

@media(max-width:380px) {
    .eps-ai-launcher {
        min-width:132px;
        padding-right:10px;
    }

    .eps-ai-launcher-label {
        font-size:11px;
    }

    .eps-ai-header {
        grid-template-columns:38px minmax(0,1fr) 36px 36px;
        padding-left:9px;
        padding-right:9px;
    }
}

@media(prefers-reduced-motion:reduce) {
    .eps-ai-root * {
        animation:none!important;
        transition:none!important;
    }
}

[dir="rtl"] .eps-ai-root {
    right:auto;
    left:22px;
}

[dir="rtl"] .eps-ai-panel {
    right:auto;
    left:0;
}

[dir="rtl"] .eps-ai-message-user {
    justify-content:flex-start;
}

[dir="rtl"] .eps-ai-message-assistant {
    justify-content:flex-end;
}

@media(max-width:700px) {
    [dir="rtl"] .eps-ai-root,
    [dir="rtl"] .eps-ai-root.eps-ai-left {
        right:auto;
        left:12px;
    }
}


/* ==========================================================================
   RC.3.1 — COMPACT COMPOSER AND CONVERSATION VISIBILITY
========================================================================== */

.eps-ai-body {
    scroll-padding-top:14px;
    scroll-padding-bottom:18px;
}

.eps-ai-messages {
    padding-bottom:4px;
}

.eps-ai-composer {
    min-height:auto!important;
    align-items:end;
    grid-template-columns:minmax(0,1fr) 43px;
    padding:9px 11px 7px;
}

.eps-ai-composer textarea {
    height:var(--eps-ai-input-height,44px)!important;
    min-height:44px!important;
    max-height:112px!important;
    overflow-y:auto;
    padding:10px 12px!important;
    transition:height .12s ease,border-color .16s ease,box-shadow .16s ease;
}

.eps-ai-composer textarea:not(.is-expanded) {
    overflow-y:hidden;
}

.eps-ai-composer > button {
    align-self:end;
}

.eps-ai-composer small {
    margin-top:-1px;
}

@media(max-width:700px) {
    .eps-ai-composer {
        min-height:auto!important;
        padding:
            8px
            10px
            calc(6px + env(safe-area-inset-bottom));
    }

    .eps-ai-composer textarea {
        height:var(--eps-ai-input-height,44px)!important;
        min-height:44px!important;
        max-height:108px!important;
        font-size:16px;
    }

    .eps-ai-body {
        scroll-padding-bottom:14px;
    }
}
