/* Chat page header (replaces logo) */
.chat-page-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 60px;
    min-width: 0;
}

.chat-page-title {
    font-size: 14px;
    font-weight: 600;
    color: #34495e;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.chat-page-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #7f8c8d;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Main chat container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;  /* 70% of the viewport height */
    width: 70vw;  /* 70% of the viewport width */
    max-width: 800px;
    margin: 15vh auto; /* 15% margins on all sides */
    background: white;
    border-radius: 10px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Mobile: fill the screen below the fixed header */
@media (max-width: 767px) {
    .chat-container {
        width: 100%;
        height: calc(100vh - 60px); /* fallback for older browsers */
        height: calc(100dvh - 60px); /* dvh adjusts for mobile browser address/nav bars */
        margin: 60px 0 0 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }
}

/* Messages container (top-to-bottom flow) */
.message-container {
    flex-grow: 1;
    overflow-y: auto; /* Enables scrolling */
    padding: 15px;
    background: #f7f9fb;
    display: flex;
    flex-direction: column; /* Align messages from top to bottom */
    justify-content: flex-start; /* Messages start at the top */
}

/* Generic message styling */
.message {
    padding: 10px 15px;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 14px;
    max-width: 80%;
    word-wrap: break-word;
}

/* Bot messages */
.message.bot {
    background-color: #34495e;
    color: white;
    align-self: flex-start;
}

/* User messages */
.message.user {
    background-color: #e1f5fe;
    color: black;
    align-self: flex-end;
}

/* Full-width input container */
.input-container {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px;
    background: white;
    border-top: 1px solid #ddd;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

/* Ensures textarea stretches properly */
.input-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Fully expanding textarea */
.input-container textarea {
    flex-grow: 1;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    resize: none;
    height: 50px;
    overflow-x: hidden;
    line-height: 1.4;
    box-sizing: border-box;
}

/* Send button styling */
.input-container button {
    flex-shrink: 0;
    margin-left: 10px;
    background-color: #34495e;
    color: white;
    border: none;
    border-radius: 5px;
    width: 55px;
    height: 55px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-container button:hover {
    background-color: #2c3e50;
}

/* Typing loader */
.typing-loader {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 5px 0;
}

.typing-loader .dot {
    width: 7px;
    height: 7px;
    background: #34495e;
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-loader .dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-loader .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-loader .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Styling for user messages */
.message.user, .message.bot.typing-loader {
    background-color: white;   /* White background for user messages */
    color: black;              /* Black text for readability */
    align-self: flex-start;      /* Align user messages to the right */
    margin-right: 10px;        /* Right margin for spacing */
    border-radius: 12px 12px 0 12px; /* Rounded corners on the top left and all right */
    padding: 8px 12px;         /* Padding around text */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}