﻿html {
    font-size: 14px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f5;
    /* height: 100vh;*/
    margin: 0;
}

html, body {
    margin: 0;
    padding: 0;
}

.site-main {
    display: grid;
    place-items: center; 
    min-block-size: 80%;
    padding: 16px;
}

.chat-window-header {
    background-color: #fff;
    color: #000000;
    height: 48px;
    min-height: 48px;
    border-bottom: 1px solid #d8d8d8;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 16px;
}

    .chat-window-header .header-title {
        font-size: 14px;
        font-weight: 600;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .chat-window-header .brand-mark {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        object-fit: contain;
        border-radius: 50%;
    }

.chat-container {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 98%;
    max-width: 950px;
    height: 80%;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    margin: 0 auto; /* horizontal centering fallback */
    inline-size: clamp(280px, 90vw, 800px);
    block-size: clamp(420px, 90vh, 700px);
}

.messages-section {
    overflow-y: auto;
    background-color: #f9f9f9;
    flex-grow: 1;
}

.disclaimer {
    flex-shrink: 0;
    font-size: 0.75rem;
    text-align: center;
}

.border {
    border: 1px solid lightgrey !important;
}

.shadow {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.conversation-starters {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    text-align: center;
}

    .conversation-starters h2 {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 16px;
        color: #333;
    }

    .conversation-starters button {
        background-color: #317529;
        color: #fff;
        font-size: 14px;
        font-weight: 500;
        padding: 12px 16px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        width: 100%; 
        max-width: 320px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        transition: background-color 0.2s;
    }

        .conversation-starters button:hover {
            background-color: #27601f;
        }

.online-help-link {
    margin-top: 12px;
    font-size: 14px;
    color: #317529;
    text-decoration: underline;
    cursor: pointer;
}


.input-area {
    display: flex;
    align-items: flex-end; 
    gap: 8px;
}

    .input-area > div:first-child button {
        align-self: flex-end; 
    }


    .input-area input, .input-area .user-input-div {
        flex: 1;
    }

.user-input-div {
    display: flex;
    border-radius: 20px;
    border: 1px solid lightgrey;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    background: white;
    padding: 0px 6px;
    margin-top: 9px;
    align-items: center;
}


    .user-input-div textarea {
        flex: 1;
        min-height: 32px;
        max-height: 120px;
        resize: none;
        overflow-y: auto;
        padding: 13px 14px;
        border: none;
        font-size: 16px;
        font-family: inherit;
        outline: none;
        line-height: 1.5;
        background: transparent;
        align-items: center;
    }
        .user-input-div textarea:disabled {
            color: #d1d0d0; 
            cursor: not-allowed;
        }

    .user-input-div.disabled {
        opacity: 0.6;
        pointer-events: none; 
    }

    .user-input-div button {
        align-self: flex-end;
    }

textarea:focus {
    outline: none;
}
#user-message-submit-button {
    align-self: flex-end; /* ⬅️ stay at bottom */
}
    #user-message-submit-button:disabled {
        background-color: #ccc !important;
        color: #666 !important;
        cursor: not-allowed;
        box-shadow: none;
    }

.input-area button {
    padding: 0;
    margin-left: 8px;
    margin-right: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
    background-color: #317529;
    color: #fff;
    border: none;
    border-radius: 100000px;
    cursor: pointer;
    z-index: 2;
    width: 32px;
    height: 32px;
}

    .input-area button:hover {
        background-color: #005bb5;
    }

.user-input-loading {
    position: relative;
}

    .user-input-loading:before, .user-input-loading:after {
        content: '';
        position: absolute;
        left: -2px;
        top: -2px;
        background: linear-gradient(45deg, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000);
        background-size: 400%;
        width: calc(100% + 4px);
        height: calc(100% + 4px);
        z-index: 0;
        animation: steam 20s linear infinite;
        border-radius: 50px;
    }

    .user-input-loading:after {
        background: -webkit-linear-gradient(45deg, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000); /* Chrome10+,Safari5.1+ */
        background: linear-gradient(45deg, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000, #fb0094, #0000ff, #00ff00,#ffff00, #ff0000);
    }

@keyframes steam {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 400% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.user-input-loading:after {
    filter: blur(10px);
}

input:active, input:focus {
    outline: none;
}

.message {
    display: flex;
    gap: 16px;
}

    .message.user {
        justify-content: end;
    }

    .message.bot {
        justify-content: start;
        margin-top: 8px;
        flex-wrap: wrap;
    }

        .message .bot p {
            display: inline;
            width: auto;
        }

        .message .bot td, .message .bot th {
            padding: 8px;
            border: 1px solid lightgray !important;
        }

        .message.bot .helpful-footer {
            display: block;
            align-self: flex-start;
            margin-top: 6px;
            width: fit-content;
        }


    .message.user p {
        background-color: #317529;
        color: #fff;
        padding: 24px;
        padding-top: 8px;
        padding-bottom: 8px;
        border-radius: 20px;
        align-items: end;
        text-align: left;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        max-width: 75%;
        word-break: break-word;
    }

.qat-message-container {
    font-size: 0px;
    visibility: hidden;
}

div.message.bot:hover > div.done-typing > .qat-message-container {
    visibility: visible;
}

.qat-message-btn {
    background-color: rgba(0, 0, 0, 0);
    color: rgba(0, 0, 0, 0.7);
    font-size: 12px;
    margin: 0;
    padding: 6px;
    border: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .qat-message-btn:hover {
        background-color: rgba(130, 130, 130, 0.1);
    }

.thinking {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    animation: thinking 1s infinite ease-in-out;
}

    .dot:nth-child(1) {
        animation-delay: 0s;
    }

    .dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.markdown-table-wrapper {
    overflow: auto;
}

    .markdown-table-wrapper table {
        border-collapse: separate;
        border-spacing: 0;
        width: 100%;
        margin-bottom: 12px;
    }

    .markdown-table-wrapper th {
        text-align: center;
    }

    .markdown-table-wrapper th,
    .markdown-table-wrapper td {
        padding: 10px;
        border: 1px solid rgba(200, 200, 200, 0.4);
        min-width: 100px;
    }

    .markdown-table-wrapper th {
        background-color: rgba(200, 200, 200, 0.2);
    }

        .markdown-table-wrapper th:first-child {
            border-top-left-radius: 8px;
        }

        .markdown-table-wrapper th:last-child {
            border-top-right-radius: 8px;
        }

        .markdown-table-wrapper th:not(:first-child), .markdown-table-wrapper td:not(:first-child) {
            border-left: none;
        }

        .markdown-table-wrapper tr:not(:first-child) td {
            border-top: none;
        }

    .markdown-table-wrapper tr:last-child td:first-child {
        border-bottom-left-radius: 8px;
    }

    .markdown-table-wrapper tr:last-child td:last-child {
        border-bottom-right-radius: 8px;
    }

    .markdown-table-wrapper tr:hover td {
        background-color: rgba(200, 200, 200, 0.1);
    }

.helpful-footer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: #333;
    background: #f6f6f6;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 8px 10px;
}

    .helpful-footer .label {
        margin-right: 6px;
        font-weight: 600;
        white-space: nowrap;
    }

.helpful-btn {
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    transition: transform .02s ease-in;
}

    .helpful-btn:active {
        transform: translateY(1px);
    }

    .helpful-btn.yes {
        background: #2e7d32;
        margin-left: 5px;
        margin-right: 5px;
    }

        .helpful-btn.yes:hover {
            background: #276b2a;
        }

    .helpful-btn.no {
        background: #c62828;
    }

        .helpful-btn.no:hover {
            background: #a82121;
        }

    .helpful-btn[disabled] {
        opacity: .55;
        cursor: default;
    }

.problem-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-top: 40px;
    color: #333;
}

    .problem-prompt h2 {
        font-size: 18px;
        font-weight: 600;
        margin: 0 0 8px;
    }

    .problem-prompt p {
        max-width: 520px;
        margin: 0;
        line-height: 1.5;
    }

    .problem-prompt .online-help-link {
        margin-top: 8px;
        color: #317529;
        text-decoration: underline;
    }

.signin-cta {
    margin-top: 8px;
}

.signin-cta-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-btn {
    flex: 1 1 240px; 
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.cta-btn--full {
    max-width: 320px;
}

.cta-btn--primary {
    background-color: #317529;
    color: #fff;
    border: none;
}

    .cta-btn--primary:hover {
        background-color: #27601f;
    }

.cta-btn--secondary {
    background-color: #fff !important;
    color: #333 !important;
    border: green 1px solid !important;
}

    .cta-btn--secondary:hover {
        background-color: #f5f5f5 !important;
    }

.bot-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

    .bot-avatar img {
        width: 45px;
        height: 45px;
    }


.input-section {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #eaeaea;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 5; 
}

.messages-section {
    padding-bottom: 16px; 
}

.helpful-footer {
    flex-wrap: wrap;
    gap: 6px;
}

.input-area button,
.conversation-starters button,
.cta-btn,
.helpful-btn {
    min-height: 30px;
}

.bot-avatar {
    width: 24px;
    height: 24px;
}

    .bot-avatar img {
        width: 36px;
        height: 36px;
    }

.markdown-table-wrapper {
    margin: 4px 0 8px;
}

    .markdown-table-wrapper table {
        min-width: 480px;
    }

.message.user p {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 16px;
}

.message.bot .done-typing {
    max-width: 92%;
}

.chat-window-header {
    height: 56px;
    min-height: 56px;
    padding: 0 12px;
}

    .chat-window-header .header-title {
        font-size: 15px;
    }

    .chat-window-header .brand-mark {
        width: 36px;
        height: 36px;
        left: 10px;
    }

.user-input-div input {
    padding: 12px 14px 12px 16px;
    font-size: 16px; 
}

.input-area button {
    width: 40px;
    height: 40px;
    margin: 6px;
}

.online-help-link {
    padding: 6px 0;
    display: inline-block;
}


/* Phones (≤ 480px) */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .site-main {
        min-block-size: 100vh;
        min-block-size: 100svh; 
        min-block-size: 100dvh;
        padding: 0; 
    }

    .chat-container {
        inline-size: 100%;
        block-size: 100vh;
        block-size: 100svh;
        block-size: 100dvh;
        border-radius: 0;
        border: none;
        max-height: none; 
    }

    .messages-section {
        padding: 12px;
    }

    .conversation-starters {
        margin-top: 24px;
        gap: 10px;
    }

        .conversation-starters h2 {
            font-size: 16px;
            margin-bottom: 10px;
        }

    .user-input-div,
    .chat-container,
    .bot-avatar {
        box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    }
    .px-4 {
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .messages-section {
        padding: 16px 18px;
    }

    .message.user p {
        max-width: 85%;
    }

    .message.bot .done-typing {
        max-width: 88%;
    }
    .px-4 {
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    html {
        font-size: 16px;
    }

    .chat-container {
        inline-size: min(96vw, 900px);
        block-size: min(96vh, 100dvh);
    }

    .messages-section {
        padding: 18px 22px;
    }

    .message.user p {
        max-width: 78%;
    }

    .message.bot .done-typing {
        max-width: 82%;
    }
}

@media (max-height: 480px) and (orientation: landscape) {
    .chat-window-header {
        position: sticky;
        top: 0;
        z-index: 6;
    }

    .messages-section {
        padding: 8px 12px;
    }

    .input-section {
        padding-top: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thinking .dot {
        animation: none;
    }

    .user-input-loading:before,
    .user-input-loading:after {
        animation: none;
    }
}

