/* Code block styling */
.code-block {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(19, 20, 28, 0.95) 0%, rgba(11, 12, 20, 0.98) 100%);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.45);
}

.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #c7d2fe;
}

.code-language {
    color: #a5b4fc;
}

.copy-button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #f8fafc;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

pre {
    background-color: transparent;
    padding: 16px;
    margin: 0;
    overflow-x: auto;
}

code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    color: #f8fafc;
    display: block;
    font-size: 0.9rem;
}

.code-block pre[class*="language-"],
.code-block code[class*="language-"] {
    background: transparent !important;
}

.inline-code {
    display: inline;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    padding: 0.15em 0.35em;
    border-radius: 6px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.95em;
}

.message-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.message-container.message-user {
    align-items: flex-end;
    margin-left: auto;
    text-align: right;
    max-width: 85%;
}

.message-container.message-bot {
    align-items: flex-start;
}

.message-container.message-user h4,
.message-container.message-user .message-content {
    text-align: right;
    align-self: flex-end;
}

.message-user-content {
    margin-left: auto;
}

.message-content {
    line-height: 1.65;
    color: #0f172a;
    font-size: 1rem;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

.message-content ul {
    padding-left: 1.4em;
    margin-bottom: 1em;
}

.chat-text {
    margin-bottom: 0.75rem;
}

.chat-chart {
    width: 100%;
    min-height: 320px;
    margin: 0.75rem 0 1rem;
    max-width: 100%;
    overflow: hidden;
}

.chat-chart .js-plotly-plot,
.chat-chart .plotly,
.chat-chart .plot-container,
.chat-chart .svg-container,
.chat-chart .main-svg,
.chat-chart svg {
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 640px) {
    .chat-chart {
        min-height: 240px;
    }
}

.form-control {
    flex: 1;
    resize: none;
    outline: none;
    border: none;
    padding: 10px;
    font-size: 16px;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
}

.chat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
    border: 1px solid #d1d5db;
    padding: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    max-width: 850px;
    width: 100%;
    margin: 0 auto;     /* centers it horizontally */
}

.send-button {
    background-color: #f8f9fa;
    color: #343a40;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.send-button:disabled {
    background-color: #f8f9fa;
    color: #9ca3af;
    cursor: default;
}

.send-button svg {
    width: 20px;
    height: 20px;
}

#message-input:focus,
.send-button:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ============================
   CHAT PAGE LAYOUT
   ============================ */

/* Disable page scroll: only the messages area will scroll */
:root {
    --chatbar-safe-area: 120px; /* fallback spacing for the floating chat bar */
    --chat-top-offset: 70px;    /* approximate height of the fixed-top navbar */
}

body.chat-page {
    overflow: hidden;
    --chatbar-safe-area: 120px;
    --chat-top-offset: 70px;
}

/* Scrollable area for messages between top navbar and bottom chat bar */
#message-area-container {
    position: fixed;
    /* These two values should match your top navbar height
       and the bottom chat bar height (including its margin). */
    top: var(--chat-top-offset);
    left: 0;
    right: 0;
    bottom: var(--chatbar-safe-area);   /* adjusted dynamically via JS */
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Add some vertical padding so text is not glued under navbars */
#messages-area {
    padding-top: 8px;
    padding-bottom: 16px;
    height: auto;
    max-height: none;
    overflow-y: visible;
}

/* ============================
   EVENT LOGIN INLINE CTA
   ============================ */
.event-login-inline {
    margin-top: 8px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, #ffffff 100%);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.event-login-inline__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 6px;
}

.event-login-inline__text {
    color: #1e293b;
    margin-bottom: 8px;
}

.event-login-inline__error {
    color: #dc2626;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.event-login-inline__note {
    margin-top: 12px;
    color: #475569;
    font-size: 0.95rem;
}

.event-login-inline__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.event-login-inline__button {
    border-radius: 999px;
    border: none;
    padding: 10px 18px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    background: #f1f5f9;
    color: #0f172a;
}

.event-login-inline__button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}

.event-login-inline__button--primary {
    background: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.event-login-inline__button--secondary {
    background: #111827;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(17, 24, 39, 0.3);
}
