/* Restrict chat area to main container - always within parent */
#chatarea.card {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    box-sizing: border-box;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 16px 0 #0001;
    padding: 16px;
    overflow-x: hidden;
}

/* All rows and bubbles must fit within parent container */
.bubble-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 0 4px;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 4px;
    flex-wrap: wrap;
}

/* Responsive breakpoints */
@media (max-width: 700px) {
    #chatarea.card {
        border-radius: 8px;
        padding: 12px 8px;
    }

    .bubble-row {
        padding: 0 2px;
    }

    .chat-input-row {
        flex-wrap: wrap;
        padding: 8px 2px;
    }

    .chat-bubble {
        padding: 10px 12px;
        font-size: 0.98rem;
    }

    .avatar {
        width: 36px;
        height: 36px;
        margin: 0 4px;
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    #chatarea.card {
        border-radius: 0;
        padding: 10px 6px;
    }

    .bubble-row {
        padding: 0;
    }

    .chat-input-row {
        padding: 6px 0;
    }

    .avatar {
        width: 32px;
        height: 32px;
        margin: 0 3px;
        font-size: 1.5rem;
    }

    .chat-bubble {
        padding: 8px 10px;
        font-size: 0.95rem;
    }
}

/* Chat photo preview in bubble */
.chat-photo-preview {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    box-shadow: 0 2px 8px #0002;
    display: block;
    box-sizing: border-box;
    height: auto;
}

@media (max-width: 600px) {
    .chat-photo-preview {
        max-height: 180px;
    }
}

/* Downsizer prompt and warning */
.downsizer-prompt {
    margin-top: 10px;
    margin-bottom: 10px;
}

.downsizer-warning {
    margin-bottom: 8px;
    color: #d00;
    font-weight: 500;
}

/* Info box for info prompt type */
.info-box {
    padding: 12px 16px;
    background: #f4f7fa;
    border-radius: 8px;
    border: 1px solid #e0e6ef;
    color: #234;
    font-size: 1rem;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

/* Hint text - slightly smaller than question text with green color */
.hint-text {
    font-size: 0.92rem;
    color: #28a745;
    line-height: 1.4;
    margin-top: 6px;
    font-style: italic;
}

@media (max-width: 600px) {
    .hint-text {
        font-size: 0.88rem;
    }
}

/* Bulleted list styles to match chat bubbles */
.chat-bubble ul {
    margin: 0;
    padding-left: 24px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #234;
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
}

.chat-bubble li {
    margin-bottom: 6px;
    color: #234;
    font-size: 1.05rem;
    font-family: inherit;
    word-wrap: break-word;
}

@media (max-width: 600px) {
    .chat-bubble ul {
        padding-left: 20px;
        font-size: 0.98rem;
    }

    .chat-bubble li {
        font-size: 0.98rem;
    }
}

/* Chat bubble row and avatar alignment */
.bot-row {
    flex-direction: row;
    justify-content: flex-start;
}

.user-row {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 50%;
    margin: 0 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    align-self: flex-start;
    box-sizing: border-box;
}

.bot-avatar {
    background: #e3eaf6;
}

.user-avatar {
    background: #d1f0e8;
}

textarea {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #c6d2e1;
    font-size: 1rem;
    outline: none;
    flex: 1;
    min-width: 0;
    min-height: 60px;
    max-width: 100%;
    box-sizing: border-box;
    transition: border 0.2s;
    resize: vertical;
}

textarea:focus {
    border-color: #5b9aff;
}

select {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #c6d2e1;
    font-size: 1rem;
    outline: none;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    background: #fff;
    transition: border 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select:focus {
    border-color: #5b9aff;
}

/* Style for select dropdown options */
select option {
    padding: 8px 12px;
    font-size: 1rem;
}

/* Button options for 'action' promptype */
.chat-input-row .action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(90deg, #fbb034 0%, #ffdd00 100%);
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 0;
    margin-top: 0;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(251, 176, 52, 0.08);
}

.chat-input-row .action-btn:last-child {
    margin-right: 0;
}


/* Raised metal button style for action-btn */
.chat-input-row .action-btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1.5px solid #b0b4bb;
    background: linear-gradient(180deg, #f5f6fa 0%, #d1d5db 40%, #b0b4bb 100%);
    color: #222;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    margin: 4px 6px 4px 0;
    box-shadow: 0 3px 10px 0 rgba(80, 80, 80, 0.10), 0 1.5px 0 #fff inset;
    transition: background 0.2s, box-shadow 0.2s, border 0.2s;
    outline: none;
    text-shadow: 0 1px 0 #fff, 0 -1px 0 #b0b4bb;
    display: inline-block;
    box-sizing: border-box;
    min-width: 200px;
    max-width: calc(33.333% - 12px);
    flex: 0 1 calc(33.333% - 12px);
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
}

.chat-input-row .action-btn:last-child {
    margin-right: 0;
}

.chat-input-row .action-btn:hover,
.chat-input-row .action-btn:focus {
    background: linear-gradient(180deg, #e2e4ea 0%, #c1c5cc 60%, #a0a4ab 100%);
    border-color: #888c94;
    box-shadow: 0 4px 16px 0 rgba(80, 80, 80, 0.18), 0 1.5px 0 #fff inset;
}

/* Action buttons wrapping on small screens */
@media (max-width: 700px) {
    .chat-input-row .action-btn {
        flex: 1 1 auto;
        min-width: calc(50% - 8px);
        max-width: 100%;
        margin: 4px 4px;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .chat-input-row .action-btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 100%;
        margin: 4px 0;
        padding: 12px 10px;
    }
}


/* Professional Chatbot Speech Bubbles */
.chat-bubble {
    flex: 1;
    max-width: calc(100% - 52px);
    min-width: 0;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 1.05rem;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: 0 4px 18px 0 rgba(30, 40, 80, 0.10), 0 1.5px 0 #fff inset;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
    margin: 0;
    display: block;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.bot-bubble {
    background: linear-gradient(120deg, #f4f7fa 0%, #e3eaf6 100%);
    color: #234;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border-top-right-radius: 20px;
    border-top-left-radius: 20px;
    border-bottom-right-radius: 20px;
    border: 1px solid #e0e6ef;
}

.user-bubble {
    background: linear-gradient(120deg, #e6f7f1 0%, #d1f0e8 100%);
    color: #185c3c;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border: 1px solid #cbe7db;
}

input[type="text"],
input:not([type]),
input {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #c6d2e1;
    font-size: 1rem;
    outline: none;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    transition: border 0.2s;
}

input[type="text"]:focus,
input:focus {
    border-color: #5b9aff;
}

button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(90deg, #5b9aff 0%, #4fd1c5 100%);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(91, 154, 255, 0.08);
    margin: 0;
    height: 40px;
    min-width: 60px;
    flex-shrink: 0;
    box-sizing: border-box;
}

button:hover {
    background: linear-gradient(90deg, #4fd1c5 0%, #5b9aff 100%);
}

@media (max-width: 600px) {
    .chat-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    button {
        width: 100%;
        margin: 0;
        height: 44px;
    }

    textarea,
    select,
    input[type="text"],
    input:not([type]),
    input {
        width: 100%;
        flex: none;
    }
}

/* ============================================================================
   AUTHENTICATION & WELCOME SCREEN STYLES
   ============================================================================ */

/* Main card spacing */
.bagmi-card {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Welcome screen container */
.chat-welcome {
    padding: 2rem;
    text-align: center;
}

/* Welcome message box */
.welcome-message {
    background: #f5f5f5;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.welcome-message h2 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.welcome-message p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.welcome-message p:last-of-type {
    font-size: 1rem;
    color: #666;
}

.welcome-message ul {
    list-style: none;
    padding: 1rem 0;
    font-size: 1rem;
}

.welcome-message li {
    padding: 0.5rem 0;
}

/* Login required notification */
.login-required {
    background: #fff3cd;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
    margin-bottom: 2rem;
}

.login-required p:first-child {
    color: #856404;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.login-required p:last-child {
    color: #856404;
    font-size: 1rem;
}

/* Login buttons container */
.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
}

.login-buttons .button-large {
    width: 100%;
}

.login-buttons .button-primary {
    font-size: 1.1rem;
    padding: 1rem;
}

.login-buttons .button-secondary {
    font-size: 1rem;
    padding: 0.8rem;
}

.login-buttons p {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.login-buttons a {
    color: #1976d2;
    text-decoration: underline;
}

/* Responsive adjustments for welcome screen */
@media (max-width: 600px) {
    .chat-welcome {
        padding: 1rem;
    }

    .welcome-message {
        padding: 1.5rem;
    }

    .welcome-message h2 {
        font-size: 1.3rem;
    }

    .welcome-message p {
        font-size: 1rem;
    }

    .login-required {
        padding: 1rem;
    }

    .login-buttons {
        max-width: 100%;
    }
}
