@font-face {
    font-family: 'Viola';
    src: url('../fonts/viola.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand-blue: #1976d2;
    --brand-blue-dark: #1565c0;
    --brand-purple: #6b3fa0;
    --brand-light: #f0f4f8;
    --text: #222;
    --white: #fff;
    --bot-bg: #eef3fa;
    --user-bg: #1976d2;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--text);
    background: var(--white);
    -webkit-text-size-adjust: 100%;
}

body.embed-mode .assistant-header,
body.embed-mode .assistant-footer-note {
    display: none;
}

body.embed-mode .assistant-shell {
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
    height: 100dvh;
}

.assistant-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fb 0%, #e8eef8 100%);
    padding: 16px;
}

.assistant-shell {
    max-width: 720px;
    margin: 0 auto;
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.12);
    overflow: hidden;
}

.assistant-header {
    padding: 14px 20px;
    background: var(--white);
    color: var(--text);
    border-bottom: 1px solid #e8edf4;
}

.assistant-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.assistant-header h1 {
    margin: 0;
    font-size: 1.25rem;
    flex: 1;
    min-width: 0;
    color: var(--brand-blue);
}

.assistant-header p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.85;
}

.context-badge {
    flex-shrink: 0;
    font-family: 'Viola', 'Segoe UI', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--brand-purple);
    text-transform: uppercase;
    white-space: nowrap;
}

.message.bot a {
    color: var(--brand-blue-dark);
    text-decoration: underline;
    word-break: break-word;
}

.message.bot a:hover {
    color: var(--brand-purple);
}

.assistant-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: url('images/forexsoft-chat-bg.jpg') center center / cover no-repeat;
}

.assistant-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    pointer-events: none;
    z-index: 0;
}

.chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px 16px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.bot {
    align-self: flex-start;
    background: rgba(238, 243, 250, 0.95);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.message.user {
    align-self: flex-end;
    background: var(--user-bg);
    color: var(--white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.message.system {
    max-width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.72);
    color: #666;
    font-size: 0.82rem;
    padding: 6px 10px;
    border-radius: 8px;
}

.quick-prompts {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px 12px;
    border-top: 1px solid rgba(232, 237, 244, 0.9);
    background: rgba(255, 255, 255, 0.55);
    position: relative;
    z-index: 1;
}

.quick-prompts button {
    border: 1px solid #c5d4ea;
    background: rgba(255, 255, 255, 0.92);
    color: var(--brand-blue-dark);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    touch-action: manipulation;
}

.quick-prompts button:hover {
    background: var(--brand-light);
}

.chat-input-row {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    border-top: 1px solid #e4eaf2;
    background: var(--white);
}

.chat-input-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid #ccd6e4;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.95rem;
}

.chat-input-row input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15);
}

.chat-input-row button {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    background: var(--brand-blue);
    color: var(--white);
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
}

.chat-input-row button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.assistant-footer-note {
    flex-shrink: 0;
    padding: 10px 16px 14px;
    font-size: 0.78rem;
    color: #667;
    text-align: center;
    line-height: 1.45;
    border-top: 1px solid #eef2f7;
    background: var(--white);
}

.footer-line {
    display: block;
}

.footer-line + .footer-line {
    margin-top: 6px;
}

.assistant-footer-note a {
    color: var(--brand-blue);
}

/* Floating widget on main site */
.forex-assistant-launcher {
    position: fixed;
    right: 1.5rem;
    bottom: 10rem;
    z-index: 998;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--brand-purple);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.forex-assistant-launcher:hover {
    background: #4b276d;
    transform: scale(1.06);
}

.forex-assistant-panel {
    position: fixed;
    right: 1.5rem;
    bottom: 12rem;
    z-index: 997;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 520px;
    max-height: calc(100vh - 9rem);
    border: none;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: none;
}

.forex-assistant-panel.open {
    display: block;
}

@media (max-width: 600px) {
    .assistant-page {
        padding: 0;
    }

    .assistant-shell {
        height: 100vh;
        height: 100dvh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .assistant-header {
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top, 0px));
    }

    .assistant-header-top {
        gap: 8px;
    }

    .assistant-header h1 {
        font-size: 1.05rem;
        line-height: 1.25;
    }

    .assistant-header p {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .context-badge {
        font-size: 1.15rem;
        max-width: 46%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-log {
        padding: 12px;
    }

    .message {
        max-width: 92%;
        font-size: 0.9rem;
        padding: 9px 12px;
    }

    .quick-prompts {
        padding: 8px 12px 10px;
        gap: 6px;
    }

    .quick-prompts button {
        font-size: 0.76rem;
        padding: 5px 10px;
    }

    .chat-input-row {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
        gap: 6px;
    }

    .chat-input-row input {
        font-size: 16px;
        padding: 10px 14px;
    }

    .chat-input-row button {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .assistant-footer-note {
        font-size: 0.72rem;
        padding: 8px 12px 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
        line-height: 1.4;
    }

    .forex-assistant-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .forex-assistant-launcher {
        bottom: 4.5rem;
        right: 1rem;
    }
}

@media (max-width: 380px) {
    .assistant-header-top {
        flex-wrap: wrap;
    }

    .context-badge {
        margin-left: auto;
        max-width: 100%;
        font-size: 1.05rem;
    }

    .chat-input-row button {
        padding: 10px 12px;
    }
}
