/* Horizon Chat — AI EDIH / Input Program child (aiedih.hu) visual alignment */

.horizon-chat-widget {
    --hc-cyan: #4ec7ff;
    --hc-cyan-hover: #3db8f0;
    --hc-purple: #db95ff;
    --hc-black: #000000;
    --hc-text: #2a2927;
    --hc-text-muted: #666666;
    --hc-border: #ececec;
    --hc-page-bg: #f1f1f1;
    --hc-card: #ffffff;
    --hc-error: #cf2e2e;

    --primary: var(--hc-cyan);
    --primary-hover: var(--hc-cyan-hover);
    --bg: var(--hc-page-bg);
    --card: var(--hc-card);
    --text: var(--hc-text);
    --text-secondary: var(--hc-text-muted);
    --border: var(--hc-border);
    --error: var(--hc-error);
    --user-bg: var(--hc-cyan);
    --user-text: #ffffff;
    --bot-bg: var(--hc-card);

    font-family: "Darker Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12), 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: height 0.35s ease, box-shadow 0.25s ease;
    border: 1px solid var(--border);
    border-bottom: none;
}

.horizon-chat-widget[data-position="bottom-right"],
.horizon-chat-widget[data-position="bottom-left"] {
    border-radius: 0;
    border: 1px solid var(--border);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Corner positions */
.horizon-chat-widget[data-position="bottom-right"] {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.horizon-chat-widget[data-position="bottom-left"] {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
}

/* Full-width dock — lap alja */
.horizon-chat-widget[data-position="bottom"] {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 100%;
    z-index: 9998;
    border-radius: 0;
    height: min(520px, 58vh);
    max-height: calc(100vh - 48px);
}

.horizon-chat-widget[data-position="bottom"] .horizon-chat-messages,
.horizon-chat-widget[data-position="bottom"] .horizon-chat-input-container,
.horizon-chat-widget[data-position="bottom"] .horizon-chat-cta {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

.horizon-chat-widget[data-position="bottom"] .horizon-chat-header {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.horizon-chat-widget.minimized {
    height: 52px !important;
    max-height: none;
    overflow: hidden;
}

.horizon-chat-widget[data-position="bottom"].minimized {
    border-radius: 0;
    height: 48px !important;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.horizon-chat-widget[data-position="bottom-right"].minimized,
.horizon-chat-widget[data-position="bottom-left"].minimized {
    height: 56px !important;
}

.horizon-chat-widget.minimized .horizon-chat-messages,
.horizon-chat-widget.minimized .horizon-chat-input-container,
.horizon-chat-widget.minimized .horizon-chat-cta {
    display: none;
}

/* Header — fekete sáv + cián aláhúzás (Input Program top bar / greenline) */
.horizon-chat-header {
    flex-shrink: 0;
    background: var(--hc-black);
    color: #fff;
    padding: 12px 20px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 4px solid var(--hc-cyan);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.horizon-chat-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.horizon-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.horizon-chat-token-usage {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.65);
    padding: 2px 8px;
    border-radius: 0;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-family: Roboto, sans-serif;
}

.horizon-chat-token-usage:empty {
    display: none;
}

.horizon-chat-token-usage.warning {
    color: #ffe08a;
}

.horizon-chat-token-usage.critical {
    background: rgba(207, 46, 46, 0.35);
    color: #fecaca;
}

.horizon-chat-counter {
    font-size: 0.7rem;
    color: #fff;
    background: rgba(78, 199, 255, 0.25);
    border: 1px solid rgba(78, 199, 255, 0.5);
    padding: 4px 10px;
    border-radius: 0;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-family: Roboto, sans-serif;
}

.horizon-chat-counter.limit-reached {
    background: rgba(207, 46, 46, 0.35);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fecaca;
}

.horizon-chat-minimize {
    background: transparent;
    border: 2px solid var(--hc-cyan);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.horizon-chat-minimize:hover {
    background: var(--hc-purple);
    color: #fff;
    border-color: var(--hc-purple);
}

/* Messages */
.horizon-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg);
}

.horizon-chat-welcome {
    background: #fff;
    border: 1px solid var(--hc-border);
    border-left: 4px solid var(--hc-cyan);
    border-radius: 0;
    padding: 16px 18px;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text);
    font-family: Roboto, sans-serif;
    font-weight: 400;
}

.horizon-chat-message {
    max-width: 88%;
    animation: hcFadeIn 0.3s ease;
}

@keyframes hcFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.horizon-chat-message-content {
    padding: 12px 16px;
    border-radius: 0;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 0.95rem;
    font-family: Roboto, sans-serif;
}

.horizon-chat-message-user {
    align-self: flex-end;
}

.horizon-chat-message-user .horizon-chat-message-content {
    background: var(--user-bg);
    color: var(--user-text);
    border: 2px solid transparent;
}

.horizon-chat-message-bot {
    align-self: flex-start;
}

.horizon-chat-message-bot .horizon-chat-message-content {
    background: var(--bot-bg);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.horizon-chat-message-bot.streaming .horizon-chat-message-content::after {
    content: '▌';
    animation: hcBlink 1s infinite;
    color: var(--hc-cyan);
    margin-left: 2px;
}

@keyframes hcBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.horizon-topic-id {
    color: var(--hc-cyan);
    font-weight: 700;
    font-family: "Courier New", monospace;
    font-size: 0.9em;
}

.horizon-chat-message-bot a {
    color: var(--hc-cyan);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.horizon-chat-message-bot a:hover {
    color: var(--hc-purple);
}

.horizon-chat-error {
    color: var(--error);
}

/* Tool call placeholder ("Máris válaszolok..." amíg a file_search/web_search fut) */
.horizon-chat-status {
    display: inline-block;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.95em;
    opacity: 0.85;
    animation: hcStatusPulse 1.6s ease-in-out infinite;
}

@keyframes hcStatusPulse {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}

/* Input */
.horizon-chat-input-container {
    flex-shrink: 0;
    padding: 14px 20px 18px;
    background: var(--card);
    border-top: 1px solid var(--border);
}

.horizon-chat-file-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.horizon-chat-attach-btn {
    width: 38px;
    height: 38px;
    border-radius: 0;
    border: 2px solid var(--hc-cyan);
    background: var(--card);
    color: var(--hc-cyan);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.horizon-chat-attach-btn:hover {
    background: var(--hc-purple);
    color: #fff;
    border-color: var(--hc-purple);
}

.horizon-chat-filename {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: Roboto, sans-serif;
}

.horizon-chat-filename.has-file {
    color: var(--hc-cyan);
    font-weight: 600;
}

.horizon-chat-clear-file {
    background: var(--error);
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.horizon-chat-clear-file:hover {
    opacity: 0.85;
}

.horizon-chat-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.horizon-chat-input {
    order: 1;
    flex: 1 1 auto;
    min-width: 120px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 0;
    font-size: 0.95rem;
    font-family: Roboto, sans-serif;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    min-height: 46px;
    max-height: 120px;
    color: var(--text);
}

.horizon-chat-input:focus {
    border-color: var(--hc-cyan);
}

.horizon-chat-input::placeholder {
    color: #8a8a8a;
}

.horizon-chat-send-button {
    order: 2;
    width: 46px;
    height: 46px;
    background: var(--hc-black);
    color: #fff;
    border: 2px solid var(--hc-cyan);
    border-radius: 0;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.horizon-chat-send-button:hover {
    background: var(--hc-purple);
    color: #fff;
    border-color: var(--hc-purple);
}

.horizon-chat-send-button:disabled {
    background: #95a5a6;
    border-color: #95a5a6;
    color: #fff;
    cursor: not-allowed;
}

/* Stop állapot — streaming közben a küldés gomb átalakul stop gombbá */
.horizon-chat-send-button--stop {
    background: var(--error, #c0392b);
    border-color: var(--error, #c0392b);
}

.horizon-chat-send-button--stop:hover {
    background: #8e1f12;
    border-color: #8e1f12;
}

.horizon-chat-char-count {
    order: 3;
    flex: 1 0 100%;
    font-size: 0.65rem;
    color: rgba(42, 41, 39, 0.45);
    text-align: right;
    padding: 0 4px 0 0;
    display: block;
    min-height: 14px;
    font-family: Roboto, sans-serif;
}

.horizon-chat-char-count:empty {
    display: none;
}

.horizon-chat-char-count.warning {
    color: var(--error);
    font-weight: 600;
}

/* CTA */
.horizon-chat-cta {
    padding: 22px 20px;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.horizon-chat-cta-message {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.55;
    font-family: Roboto, sans-serif;
}

.horizon-chat-cta-button {
    display: inline-block;
    padding: 14px 28px;
    background: transparent;
    color: var(--hc-cyan);
    border: 2px solid var(--hc-cyan);
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    font-family: "Darker Grotesque", sans-serif;
}

.horizon-chat-cta-button:hover {
    background: var(--hc-purple);
    color: #fff;
    border-color: var(--hc-purple);
    transform: translateY(-1px);
    text-decoration: none;
}

/* Inline — beágyazott mód (shortcode-ban) */
.horizon-chat-widget[data-position="inline"] {
    position: relative;
    border-radius: 0;
    border: 1px solid var(--border);
    border-top: 4px solid var(--hc-cyan);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
}

/* Scrollbar */
.horizon-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.horizon-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.horizon-chat-messages::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 0;
}

.horizon-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* GDPR */
.horizon-gdpr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.horizon-gdpr-modal {
    background: var(--card);
    border-radius: 0;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    border: 1px solid var(--border);
    border-top: 4px solid var(--hc-cyan);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    max-height: 90%;
    overflow-y: auto;
}

.horizon-gdpr-modal h3 {
    margin: 0 0 14px 0;
    color: var(--error);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.horizon-gdpr-body {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
    font-family: Roboto, sans-serif;
}

.horizon-gdpr-body ul {
    padding-left: 20px;
    margin: 12px 0;
}

.horizon-gdpr-body li {
    margin-bottom: 8px;
}

.horizon-gdpr-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.horizon-gdpr-btn {
    padding: 11px 22px;
    border: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    font-family: "Darker Grotesque", sans-serif;
    transition: opacity 0.2s, background 0.2s;
}

.horizon-gdpr-btn:hover {
    opacity: 0.92;
}

.horizon-gdpr-cancel {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.horizon-gdpr-accept {
    background: var(--hc-cyan);
    color: var(--hc-black);
    border-color: var(--hc-cyan);
}

/* Mobile */
@media (max-width: 768px) {
    .horizon-chat-widget[data-position="bottom-right"],
    .horizon-chat-widget[data-position="bottom-left"] {
        width: calc(100% - 16px) !important;
        height: min(85vh, 640px) !important;
        bottom: 8px !important;
        right: 8px !important;
        left: 8px !important;
        border-radius: 0;
    }

    .horizon-chat-widget[data-position="bottom"] {
        height: min(72vh, 560px) !important;
        max-height: calc(100vh - 40px);
        border-radius: 0;
    }

    .horizon-chat-widget[data-position="bottom"].minimized {
        height: 48px !important;
    }

    .horizon-chat-message {
        max-width: 92%;
    }

    .horizon-chat-header {
        padding-left: 14px;
        padding-right: 14px;
    }

    .horizon-chat-title {
        font-size: 0.9rem;
    }
}
