/* Echo — WZH Portal súgó (önálló CSS a megbízható megjelenéshez) */

.echo-float {
    position: fixed !important;
    left: max(0.85rem, env(safe-area-inset-left, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    z-index: 10090;
    width: auto;
    max-width: calc(100vw - 1.5rem);
    pointer-events: none;
    font-family: inherit;
}

.echo-float[hidden],
.echo-float.is-disabled {
    display: none !important;
}

.echo-float * {
    box-sizing: border-box;
}

.echo-float-launcher,
.echo-float-panel,
.echo-bubble,
.echo-float-toggle {
    pointer-events: auto;
}

.echo-float-launcher {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Buborék */
.echo-bubble {
    position: relative;
    max-width: min(210px, 68vw);
    margin: 0 0 0 0.25rem;
    padding: 0.5rem 1.65rem 0.5rem 0.7rem;
    background: #161a24;
    border: 1px solid rgba(255, 107, 53, 0.5);
    border-radius: 14px 14px 14px 4px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    animation: echo-bubble-in 0.4s ease both;
}

.echo-bubble[hidden] {
    display: none !important;
}

.echo-bubble-text {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.25;
    color: #f2f4f8;
}

.echo-bubble-dismiss {
    position: absolute;
    top: 0.1rem;
    right: 0.2rem;
    width: 1.35rem;
    height: 1.35rem;
    border: 0;
    padding: 0;
    background: transparent;
    color: #9aa3b5;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.echo-bubble-dismiss:hover {
    color: #ff6b35;
}

.echo-bubble::after {
    content: '';
    position: absolute;
    left: 1.35rem;
    bottom: -6px;
    width: 11px;
    height: 11px;
    background: #161a24;
    border-right: 1px solid rgba(255, 107, 53, 0.5);
    border-bottom: 1px solid rgba(255, 107, 53, 0.5);
    transform: rotate(45deg);
}

@keyframes echo-bubble-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Launcher avatar */
.echo-float-toggle {
    position: relative;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid rgba(255, 107, 53, 0.65);
    border-radius: 50%;
    background: #0a0a0c;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.echo-float-toggle:hover {
    border-color: #ff6b35;
    transform: scale(1.04);
}

.echo-float-toggle img,
.echo-float-avatar {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center 15%;
    display: block;
}

.echo-float-pulse {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255, 107, 53, 0.35);
    animation: echo-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes echo-pulse {
    0% { transform: scale(0.95); opacity: 0.65; }
    70% { transform: scale(1.15); opacity: 0; }
    100% { opacity: 0; }
}

/* Chat panel — fixed card, nem a flex flow része */
.echo-float-panel {
    position: fixed !important;
    left: max(0.85rem, env(safe-area-inset-left, 0px));
    bottom: max(6.25rem, calc(env(safe-area-inset-bottom, 0px) + 5.5rem));
    z-index: 10091;
    width: min(360px, calc(100vw - 1.5rem));
    max-height: min(70vh, 540px);
    display: flex !important;
    flex-direction: column;
    background: #141821;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    animation: echo-panel-in 0.2s ease;
}

.echo-float-panel[hidden] {
    display: none !important;
}

@keyframes echo-panel-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.echo-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 107, 53, 0.08);
    flex-shrink: 0;
}

.echo-float-header-person {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.echo-float-header-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 15%;
    border: 1px solid rgba(255, 107, 53, 0.45);
    flex-shrink: 0;
}

.echo-float-header-person strong {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-size: 1.05rem;
    line-height: 1.15;
    color: #f2f4f8;
}

.echo-float-sub {
    display: block;
    font-size: 0.75rem;
    color: #9aa3b5;
}

.echo-float-close {
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    color: #c5cad6;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.echo-float-close:hover {
    color: #ff6b35;
    border-color: rgba(255, 107, 53, 0.45);
}

.echo-float-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 140px;
    max-height: 240px;
}

.echo-msg {
    max-width: 94%;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: #e8ebf2;
}

.echo-msg p {
    margin: 0;
}

.echo-msg-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.echo-msg-user {
    align-self: flex-end;
    background: rgba(255, 107, 53, 0.18);
    border: 1px solid rgba(255, 107, 53, 0.35);
}

.echo-msg-typing {
    opacity: 0.7;
    font-style: italic;
}

.echo-msg-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.echo-msg-link {
    display: inline-flex;
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    color: #f2f4f8;
    background: rgba(255, 107, 53, 0.14);
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 999px;
}

.echo-msg-link:hover {
    background: rgba(255, 107, 53, 0.28);
    color: #fff;
}

.echo-float-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 0.75rem 0.55rem;
    flex-shrink: 0;
}

.echo-suggestion {
    padding: 0.32rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: #b7bfcf;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    cursor: pointer;
    text-align: left;
}

.echo-suggestion:hover {
    color: #ff6b35;
    border-color: rgba(255, 107, 53, 0.45);
}

.echo-float-form {
    display: flex;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.echo-float-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #f2f4f8;
    font: inherit;
    font-size: 0.9rem;
}

.echo-float-input::placeholder {
    color: #8b93a5;
    opacity: 1;
}

.echo-float-input:focus {
    outline: none;
    border-color: rgba(255, 107, 53, 0.55);
}

.echo-float-send {
    flex-shrink: 0;
    padding: 0.55rem 0.85rem;
    border: 0;
    border-radius: 10px;
    background: #ff6b35;
    color: #111;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.echo-float-send:hover {
    filter: brightness(1.08);
}

.echo-float-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.echo-float-hide {
    border: 0;
    background: none;
    color: #8b93a5;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.echo-float-hide:hover {
    color: #ff6b35;
}

/* Footer restore chip */
.echo-restore {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.5rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f2f4f8;
    text-decoration: none;
    background: rgba(255, 107, 53, 0.15);
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 999px;
    cursor: pointer;
}

.echo-restore[hidden] {
    display: none !important;
}

.echo-restore:hover {
    background: rgba(255, 107, 53, 0.28);
}

[data-theme="light"] .echo-bubble,
[data-theme="light"] .echo-bubble::after,
[data-theme="light"] .echo-float-panel {
    background: #fff;
}

[data-theme="light"] .echo-bubble-text,
[data-theme="light"] .echo-float-header-person strong,
[data-theme="light"] .echo-msg,
[data-theme="light"] .echo-float-input {
    color: #1a1d26;
}

[data-theme="light"] .echo-msg-bot {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .echo-float-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .echo-float-sub,
[data-theme="light"] .echo-suggestion,
[data-theme="light"] .echo-float-hide {
    color: #5c6578;
}

@media (max-width: 720px) {
    body.has-messenger-float .echo-float {
        bottom: max(5.25rem, calc(env(safe-area-inset-bottom, 0px) + 4.25rem));
    }

    .echo-float-panel {
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        bottom: max(6.75rem, calc(env(safe-area-inset-bottom, 0px) + 5.75rem));
        max-height: min(65vh, 480px);
    }

    body.has-messenger-float .echo-float-panel {
        bottom: max(7.75rem, calc(env(safe-area-inset-bottom, 0px) + 6.75rem));
    }
}
