body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background-color: #8A1538;
}

/* Wrapper */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 420px;
    margin: auto;
    background-color: #8A1538;
    padding: 0 10px 10px;
    border-radius: 20px;
    overflow: hidden;
}

/* Header */
.chat-header {
    background-color: #8A1538;
    color: white;
    padding: 25px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.right-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-title {
    font-size: 17px;
    color: white;
    line-height: 1;
    margin-top: 2px;
}

.header-avatar {
    width: 42px;
    height: 48px;
    border-radius: 10px; /* Appears rounded-square in screenshot */
    border: 2px solid #8A1538; /* Based on the image */
    background: #e2e8f0; /* Soft background */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Optional: add a slight drop shadow if needed */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}




/* Body (white curved container) */
.chat-body {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Scrollable messages area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px 5px;
    gap: 12px;
}

/* Footer inside body */
.inside-footer {
    background: #fff;
    padding: 10px 0;
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.inside-footer input {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #D3BBC2;
    background: #faf7f9;
    outline: none;
}

.send-btn {
    background: #8A1538;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* Flip the send icon in English (LTR) mode */
[dir="ltr"] .send-btn svg {
    transform: scaleX(-1);
}

/* ------------------------------------------------------------------ */
/* MESSAGES */
/* ------------------------------------------------------------------ */

.message {
    max-width: 85%;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
}

/* USER MESSAGE */
[dir="rtl"] .message.user {
    align-self: flex-start;
}

[dir="ltr"] .message.user {
    align-self: flex-end;
}

.user-bubble {
    position: relative;
    background: #8A1538;
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    border-end-start-radius: 5px;
    /* pointer side (edge) */
}

/* Bottom-end tail for user bubble */
.user-bubble::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #8A1538;
    bottom: 6px;
    transform: rotate(45deg);
    z-index: -1;
}

[dir="rtl"] .user-bubble::after {
    inset-inline-start: -5px;
}

[dir="ltr"] .user-bubble::after {
    inset-inline-end: -5px;
}



/* ------------------------------------------------------------------ */
/* NEW ASSISTANT MESSAGE (square + bubble) */
/* ------------------------------------------------------------------ */

[dir="rtl"] .message.assistant {
    align-self: flex-end;
}

[dir="ltr"] .message.assistant {
    align-self: flex-start;
}

.assistant-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

[dir="rtl"] .assistant-row {
    flex-direction: row-reverse;
}

[dir="ltr"] .assistant-row {
    flex-direction: row;
}

/* The red square */
.assistant-square {
    width: 30px;
    height: 30px;
    background: #8A1538;
    border-radius: 6px;
    margin-top: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}



/* bubble */
.assistant-bubble {
    position: relative;
    background: #FCF9FA;
    border: 1px solid #D3BBC2;
    padding: 14px;
    border-radius: 14px;
    border-end-end-radius: 5px;
    /* pointer side (icon) */
    font-size: 15px;
    line-height: 1.7;
}

/* Bottom-right solid angled pointer */
/*.assistant-bubble::after {
        content: "";
        position: absolute;
        width: 0;
        height: 0;*/
/* This draws the filled pointer shape */
/*border-style: solid;
        border-width: 10px 0 0 10px;*/
/* size + diagonal angle */
/*border-color: transparent transparent transparent #D3BBC2;
        bottom: 1px;*/
/* slight overlap to blend with border */
/*right: -3.5%;*/
/* aligns with bubble edge */

/*transform: translateY(5px) rotate(28deg);*/
/* fine-tune vertical positioning */
/*}*/
.assistant-bubble::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: #FCF9FA;
    bottom: 9px;
    transform: rotate(45deg);
    z-index: 1;
}

/* User -> Right edge corners */
[dir="rtl"] .user-bubble {
    border-end-start-radius: 5px;
    border-end-end-radius: 14px;
}

[dir="ltr"] .user-bubble {
    border-end-end-radius: 5px;
    border-end-start-radius: 14px;
}

/* Bot -> Left edge corners */
[dir="rtl"] .assistant-bubble {
    border-end-end-radius: 5px;
    border-end-start-radius: 14px;
}

[dir="ltr"] .assistant-bubble {
    border-end-start-radius: 5px;
    border-end-end-radius: 14px;
}

/* Bot Tail Position and Borders */
[dir="rtl"] .assistant-bubble::after {
    inset-inline-end: -4px;
    border-inline-end: 1px solid #D3BBC2;
    border-bottom: 1px solid #D3BBC2;
}

[dir="ltr"] .assistant-bubble::after {
    inset-inline-start: -4px;
    border-inline-start: 1px solid #D3BBC2;
    border-bottom: 1px solid #D3BBC2;
}


/* Remove old bot arrow + bubble */
.message.bot,
.message.bot::after,
.message.bot::before {
    display: none !important;
}

/* Quick replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.quick-replies button {
    padding: 9px 12px;
    border: 1px solid #8A1538;
    border-radius: 10px;
    background: white;
    color: #8A1538;
    cursor: pointer;
}

.quick-replies button:hover {
    background: #8A1538;
    color: white;
}

/* Scrollbar */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* FOCUS INDICATORS (WCAG 2.4.7 — Focus Visible)                     */
/* ------------------------------------------------------------------ */

/* All interactive elements */
button:focus-visible,
input:focus-visible,
a:focus-visible,
.quick-replies button:focus-visible {
    outline: 2px solid #8A1538;
    outline-offset: 2px;
}

/* Send button — use white outline against maroon background */
.send-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Input field — custom border highlight */
.inside-footer input:focus-visible {
    border-color: #8A1538;
    box-shadow: 0 0 0 2px rgba(138, 21, 56, 0.25);
}