/* app/web/static/css/chat.css */

/* ========== Base ========== */
:root{
    --brand: #F70759;
    --bg: #f9f9f9;
    --card: #ffffff;
    --border: rgba(0,0,0,0.10);
    --border-strong: rgba(0,0,0,0.14);
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-pop: 0 20px 60px rgba(0,0,0,0.18);
    --row-hover: rgba(0,0,0,0.04);
    --row-selected: rgba(0,0,0,0.06);
}

*,
*::before,
*::after{
    box-sizing: border-box;
}

body{
    font-family: 'Montserrat', sans-serif;
    margin: 20px;
    background-color: var(--bg);
}

/* ========== Layout ========== */
.chat-container{
    max-width: 640px;
    margin: auto;
    background: var(--card);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-radius: 10px;
}

.header-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

h2{
    font-size: 24px;
    font-weight: 700;
    color: var(--brand);
    margin: 0;
}

/* ========== Language selector (Civitatis-like) ========== */
/*
Key fixes vs your current CSS:
- Remove any browser default button styling explicitly (appearance/background)
- Ensure dropdown items don't inherit any other button styles
- Prevent "weird grey blocks" by controlling focus/active states
*/
.lang-selector{
    position: relative;
}

.lang-pill{
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 999px;

    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;

    cursor: pointer;

    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand);

    line-height: 1;
}

.lang-pill:hover{
    border-color: rgba(0,0,0,0.18);
}

.lang-pill:focus{
    outline: none;
    box-shadow: 0 0 0 3px rgba(247, 7, 89, 0.15);
}

/* when menu open — do NOT add a second shadow (this avoids the “double outline” look) */
.lang-pill.active{
    border-color: rgba(0,0,0,0.18);
    box-shadow: none;
}

.lang-pill-caret{
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--brand);
    opacity: 0.9;
}

/* dropdown */
.lang-dropdown{
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 320px;

    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;

    box-shadow: var(--shadow-pop);

    padding: 10px 0;
    display: none;
    z-index: 999; /* ensure it sits over chat */
}

.lang-dropdown.open{
    display: block;
}

/* IMPORTANT: Override ALL generic button styling explicitly */
.lang-dropdown .lang-option{
    -webkit-appearance: none;
    appearance: none;

    width: 100%;
    display: block;

    border: 0;
    border-radius: 0;

    background: transparent;
    box-shadow: none;

    padding: 14px 18px;

    text-align: left;
    cursor: pointer;

    font-family: 'Montserrat', sans-serif;
    font-size: 18px;     /* closer to your reference */
    font-weight: 600;
    color: #111;

    line-height: 1.2;
}

/* Remove focus ring background “blocks” some browsers apply */
.lang-dropdown .lang-option:focus{
    outline: none;
}

.lang-dropdown .lang-option:hover{
    background: var(--row-hover);
}

/* Selected should look like a flat grey row (not a pill) */
.lang-dropdown .lang-option.selected{
    background: var(--row-selected);
}

/* If a browser applies active styles on click, keep it consistent */
.lang-dropdown .lang-option:active{
    background: var(--row-selected);
}

/* ========== Chat box ========== */
#chatbox{
    height: 420px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 10px 8px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.message-container{
    display: flex;
    flex-direction: column;
}

.message{
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 90%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.user-message{
    background-color: #f0f0f0;
    color: #333333;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.bot-message{
    background-color: #ffeef3;
    color: var(--brand);
    margin-right: auto;
    border-bottom-left-radius: 6px;
}

/* markdown formatting */
.bot-message p{ margin: 0 0 6px; }
.bot-message p:last-child{ margin-bottom: 0; }
.bot-message ul{ padding-left: 18px; margin: 4px 0; }
.bot-message li{ margin-bottom: 3px; }
.bot-message a{ color: var(--brand); text-decoration: underline; }

/* ========== Input ========== */
#message{
    width: 100%;
    height: 70px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: none;
}

/* ========== Action buttons (scoped ONLY to button container) ========== */
.button-container{
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.button-container button{
    -webkit-appearance: none;
    appearance: none;

    flex: 1;
    padding: 9px;

    font-size: 14px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

#send-button{
    background-color: var(--brand);
    color: white;
}

#clear-button{
    background-color: #f0f0f0;
    color: #333;
}

.button-container button:hover{
    opacity: 0.9;
}

/* ========== Loader ========== */
.loader{
    display: none;
    text-align: center;
    padding: 6px;
}

.loader::after{
    content: "•••";
    animation: dots 1s steps(5, end) infinite;
}

@keyframes dots{
    0%, 20% { content: "•"; }
    40% { content: "••"; }
    60%, 100% { content: "•••"; }
}

.sr-only{
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== FORCE dropdown options to behave like simple rows (override browser states) ===== */
.lang-dropdown .lang-option,
.lang-dropdown .lang-option:visited,
.lang-dropdown .lang-option:hover,
.lang-dropdown .lang-option:focus,
.lang-dropdown .lang-option:focus-visible,
.lang-dropdown .lang-option:active {
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Hover row */
.lang-dropdown .lang-option:hover {
  background: rgba(0,0,0,0.04) !important;
}

/* Selected row (only ONE should have this class) */
.lang-dropdown .lang-option.selected {
  background: rgba(0,0,0,0.06) !important;
}

.lang-dropdown[aria-hidden="true"] {
  display: none;
  pointer-events: none;
}