/* Modern ChatBot CSS */

html {
    font-size: 14px;
}

* {
    font-family: 'Gotham', sans-serif;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

p {
    margin-bottom: 0em;
}

/* #region Font Declarations */
@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-BoldItalic.otf') format('opentype');
    font-weight: 700;
    font-style: italic;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-Book.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-BookItalic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-LightItalic.otf') format('opentype');
    font-weight: 300;
    font-style: italic;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-MediumItalic.otf') format('opentype');
    font-weight: 500;
    font-style: italic;
}

@font-face {
    font-family: 'Gotham';
    src: url('../fonts/Gotham-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}
/* #endregion Font Declarations */

:root {
    --eblue: #005cb9;
    --egold: #e7b925;
    --e-dark-blue: #003B76;
    --chat-bg: #f8f9fa;
    --shadow-light: rgba(0, 20, 56, 0.08);
    --shadow-medium: rgba(0, 20, 56, 0.15);
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--chat-bg);
}

.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;
}

/* Main Layout */
.flex-body {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 0;
    top: 0;
}

.chat-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    flex: 1;
    height: 100%;
}

.chat-window {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Header */
.chat-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95em;
    width: 100%;
    padding: 0.875em 1em;
    background: linear-gradient(135deg, var(--e-dark-blue) 0%, var(--eblue) 100%);
    color: #FFFFFF;
    letter-spacing: 0.02em;
}

#minimize-chat-button {
    width: 1.75em;
    height: 1.75em;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    background-image: url('images/keyboard_arrow_down_24dp_FFFFFF_FILL0_wght700_GRAD200_opsz24.svg');
    background-repeat: no-repeat;
    background-size: 1.25em;
    background-position: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#minimize-chat-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Chat Body */
.chat-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--chat-bg);
    padding: 1em;
    flex: 1;
    gap: 0.25em;
}

/* Message Names */
.bot-name,
.user-name {
    font-weight: 600;
    font-size: 0.75em;
    color: var(--e-dark-blue);
    padding: 0 0.5em;
    margin-bottom: 0.25em;
    opacity: 0.8;
}

.bot-name {
    margin-right: auto;
}

.user-name {
    margin-left: auto;
    text-align: right;
}

/* Message Bubbles */
.bot-message {
    max-width: 88%;
    padding: 0.875em 1em;
    margin-bottom: 0.75em;
    width: fit-content;
    background: #ffffff;
    border-radius: 1em;
    border-top-left-radius: 0.25em;
    box-shadow: 0 1px 3px var(--shadow-light), 0 1px 2px var(--shadow-medium);
    line-height: 1.5;
    font-size: 0.9em;
}

.bot-message a {
    color: var(--eblue);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.bot-message a:hover {
    border-bottom-color: var(--eblue);
}

.user-message {
    max-width: 88%;
    padding: 0.875em 1em;
    margin-bottom: 0.75em;
    width: fit-content;
    margin-left: auto;
    background: rgba(0, 92, 185, 0.15);
    color: var(--e-dark-blue);
    border-radius: 1em;
    border-top-right-radius: 0.25em;
    box-shadow: 0 1px 3px var(--shadow-light);
    line-height: 1.5;
    font-size: 0.9em;
}

/* Footer / Input Area */
.chat-footer {
    width: 100%;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.75em;
    gap: 0.5em;
}

#userInput {
    flex: 1;
    padding: 0.5em 0.75em;
    border-radius: 5px;
    font-family: 'Gotham', sans-serif;
    font-weight: 400;
    font-size: 0.9em;
    border: 1px solid #ccc;
    transition: border-color 0.2s ease;
}

#userInput:focus {
    border-color: var(--egold);
    outline: none;
}

#userInput::placeholder {
    color: #999;
}

#sendButton {
    padding: 0.5em 0.75em;
    border-radius: 5px;
    background: var(--eblue);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    box-shadow: 0.25em 0.25em 0.25em 0 rgba(0, 20, 56, 0.25);
    transition: background-color 0.2s ease;
}

#sendButton:hover {
    background: var(--e-dark-blue);
}

#sendButton:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* AI Disclaimer */
.ai-disclaimer {
    text-align: center;
    font-size: 0.65em;
    color: #999;
    padding: 0.4em;
    background: #ffffff;
}

/* Confirm Dialog Overlay */
#chat-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

#chat-confirm-overlay.show {
    display: flex;
}

.confirm-box {
    background: white;
    padding: 1.5em 2em;
    border-radius: 1em;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    width: 280px;
}

.confirm-box p {
    margin-bottom: 1.25em;
    font-weight: 600;
    color: var(--e-dark-blue);
}

.confirm-box button {
    display: block;
    width: 100%;
    padding: 0.625em 1em;
    margin: 0.5em 0;
    border-radius: 0.5em;
    background: var(--eblue);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.confirm-box button:hover {
    background: var(--e-dark-blue);
}

.confirm-box button#confirm-cancel {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.confirm-box button#confirm-cancel:hover {
    background: #f5f5f5;
    color: #333;
}

/* Survey Confirm Overlay */
#survey-confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
}

#survey-confirm-overlay.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

#survey-popup {
    background: white;
    display: none;
    flex-direction: column;
    padding: 1.5em 2em;
    border-radius: 1em;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    width: 280px;
}

#survey-popup.show {
    display: flex;
}

#survey-popup p {
    margin-bottom: 1em;
    font-weight: 600;
    color: var(--e-dark-blue);
}

/* Survey Modal */
#survey-modal {
    position: fixed;
    display: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#survey-modal.show {
    display: flex;
}

#survey-content {
    background: white;
    display: flex;
    flex-direction: column;
    padding: 1.5em;
    border-radius: 1em;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#survey-content h3 {
    margin: 0 0 1em 0;
    color: var(--e-dark-blue);
    font-weight: 700;
    font-size: 1.1em;
}

#survey-content p {
    margin-bottom: 0.5em;
    font-weight: 500;
    font-size: 0.9em;
}

.rating-group {
    margin-bottom: 1.25em;
    display: flex;
    gap: 0.75em;
    justify-content: flex-start;
}

.rating-group label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25em;
    height: 2.25em;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.rating-group label:hover {
    border-color: var(--eblue);
    background: rgba(0, 92, 185, 0.05);
}

.rating-group input[type="radio"] {
    display: none;
}

.rating-group input[type="radio"]:checked + label,
.rating-group label:has(input[type="radio"]:checked) {
    background: var(--eblue);
    color: white;
    border-color: var(--eblue);
}

.y-or-n {
    display: flex;
    gap: 0.75em;
    padding-top: 0.5em;
}

.survey-buttons {
    flex: 1;
    padding: 0.625em 1em;
    border-radius: 0.5em;
    background: var(--eblue);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.survey-buttons:hover {
    background: var(--e-dark-blue);
}

#skip-survey,
#take-survey-no {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

#skip-survey:hover,
#take-survey-no:hover {
    background: #f5f5f5;
    color: #333;
}

#survey-content textarea {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 0.5em;
    resize: vertical;
    min-height: 70px;
    font-family: 'Gotham', sans-serif;
    font-size: 0.9em;
    margin-bottom: 0.75em;
    transition: border-color 0.2s ease;
}

#survey-content textarea:focus {
    border-color: var(--eblue);
    outline: none;
}

.hidden {
    display: none;
}

/* Thank You Modal */
#thank-you-modal {
    position: fixed;
    display: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#thank-you-modal.show {
    display: flex;
}

#thank-you-content {
    background: white;
    padding: 2em 2.5em;
    border-radius: 1em;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

#thank-you-content p {
    margin: 0;
    font-weight: 600;
    font-size: 1.1em;
    color: var(--e-dark-blue);
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.6em 0.9em;
    margin-bottom: 0.75em;
    background: #ffffff;
    border-radius: 1em;
    border-top-left-radius: 0.25em;
    box-shadow: 0 1px 3px var(--shadow-light), 0 1px 2px var(--shadow-medium);
    width: fit-content;
    font-size: 0.85em;
    color: #666;
}

.thinking-text {
    font-style: italic;
}

/* Loading state shown inside the bot bubble until the reply starts streaming in. */
.bot-message.loading {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.spinner {
    width: 1em;
    height: 1em;
    border: 2px solid rgba(0, 92, 185, 0.2);
    border-top-color: var(--eblue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message content formatting */
.bot-message ul,
.bot-message ol {
    margin: 0.5em 0;
    padding-left: 1.25em;
}

.bot-message li {
    margin-bottom: 0.25em;
}

.bot-message p {
    margin-bottom: 0.5em;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.bot-message code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 0.25em;
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
}

.bot-message pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.75em;
    border-radius: 0.5em;
    overflow-x: auto;
    margin: 0.5em 0;
}

.bot-message pre code {
    background: none;
    padding: 0;
}

/* Form elements */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}
