/* Basheer chatbot — Al Biruni Health
 * Brand palette: Al Biruni purple (#592263) + warm gold accent.
 * Designers: variables at the top — change them in one place.
 */

:root {
    --bsh-primary: #592263;          /* Al Biruni brand purple */
    --bsh-primary-dark: #3f1646;
    --bsh-primary-soft: #f1e7f4;
    --bsh-accent: #c9a14a;           /* warm gold */
    --bsh-bg: #ffffff;
    --bsh-bg-soft: #f6f8f7;
    --bsh-text: #1f2a26;
    --bsh-text-muted: #6b7770;
    --bsh-border: #e2e8e4;
    --bsh-bubble-user: #592263;
    --bsh-bubble-user-text: #ffffff;
    --bsh-bubble-bot: #f1f4f2;
    --bsh-bubble-bot-text: #1f2a26;
    --bsh-shadow: 0 10px 30px rgba(31, 42, 38, 0.12);
    --bsh-radius: 16px;
    --bsh-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bsh-font-ar: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Arabic UI Text", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--bsh-font);
    color: var(--bsh-text);
    background: var(--bsh-bg);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

body[dir="rtl"] { font-family: var(--bsh-font-ar); }

.bsh-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 420px;
    margin: 0 auto;
    background: var(--bsh-bg);
    border-left: 1px solid var(--bsh-border);
    border-right: 1px solid var(--bsh-border);
}

/* Header */
.bsh-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--bsh-primary) 0%, var(--bsh-primary-dark) 100%);
    color: #fff;
    flex-shrink: 0;
}

.bsh-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    color: var(--bsh-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    position: relative;
}

.bsh-avatar::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid #fff;
    position: absolute;
    bottom: -2px;
    right: -2px;
}

.bsh-header-text { flex: 1; min-width: 0; }
.bsh-header-name { font-weight: 600; font-size: 16px; }
.bsh-header-status { font-size: 12px; opacity: 0.85; }

.bsh-demo-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    vertical-align: 2px;
}

.bsh-header-actions { display: flex; gap: 6px; }

.bsh-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}
.bsh-icon-btn:hover { background: rgba(255, 255, 255, 0.28); }

/* Disclaimer */
.bsh-disclaimer {
    padding: 8px 16px;
    background: #fff8e1;
    color: #6b5510;
    font-size: 12px;
    border-bottom: 1px solid #f0e3b6;
    flex-shrink: 0;
}

/* Messages area */
.bsh-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bsh-bg-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bsh-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
    animation: bsh-fade-in 0.18s ease-out;
}

@keyframes bsh-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bsh-msg-bot {
    align-self: flex-start;
    background: var(--bsh-bubble-bot);
    color: var(--bsh-bubble-bot-text);
    border-bottom-left-radius: 4px;
}

.bsh-msg-user {
    align-self: flex-end;
    background: var(--bsh-bubble-user);
    color: var(--bsh-bubble-user-text);
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .bsh-msg-bot { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
[dir="rtl"] .bsh-msg-user { border-bottom-right-radius: 14px; border-bottom-left-radius: 4px; }

.bsh-msg p { margin: 0; }
.bsh-msg + .bsh-msg { margin-top: 0; }

.bsh-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.bsh-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--bsh-text-muted);
    animation: bsh-typing 1.2s infinite;
}
.bsh-typing span:nth-child(2) { animation-delay: 0.15s; }
.bsh-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bsh-typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* Quick-reply chips */
.bsh-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    background: var(--bsh-bg-soft);
}

.bsh-chip {
    padding: 8px 14px;
    border: 1px solid var(--bsh-primary);
    background: #fff;
    color: var(--bsh-primary);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.bsh-chip:hover {
    background: var(--bsh-primary);
    color: #fff;
}

/* Booking form (rendered as a card inside messages) */
.bsh-card {
    align-self: stretch;
    background: #fff;
    border: 1px solid var(--bsh-border);
    border-radius: var(--bsh-radius);
    padding: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.bsh-card-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--bsh-primary);
}

.bsh-field {
    display: block;
    margin-bottom: 10px;
}
.bsh-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--bsh-text-muted);
    margin-bottom: 4px;
}
.bsh-field input,
.bsh-field select,
.bsh-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--bsh-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--bsh-text);
    transition: border-color 0.15s;
}
.bsh-field input:focus,
.bsh-field select:focus,
.bsh-field textarea:focus {
    outline: none;
    border-color: var(--bsh-primary);
    box-shadow: 0 0 0 3px var(--bsh-primary-soft);
}

.bsh-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--bsh-text-muted);
    margin: 6px 0 10px;
}
.bsh-consent input { margin-top: 2px; }

.bsh-btn {
    display: inline-block;
    padding: 10px 18px;
    background: var(--bsh-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.bsh-btn:hover { background: var(--bsh-primary-dark); }
.bsh-btn:disabled {
    background: #b9a3bf;
    cursor: not-allowed;
}

.bsh-btn-secondary {
    background: #fff;
    color: var(--bsh-primary);
    border: 1px solid var(--bsh-primary);
}
.bsh-btn-secondary:hover { background: var(--bsh-primary-soft); }

/* Input bar */
.bsh-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--bsh-border);
    background: #fff;
    flex-shrink: 0;
}

.bsh-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--bsh-border);
    border-radius: 999px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bsh-bg-soft);
    color: var(--bsh-text);
}
.bsh-input:focus {
    outline: none;
    border-color: var(--bsh-primary);
    background: #fff;
}

.bsh-send {
    width: 40px; height: 40px;
    border: none;
    background: var(--bsh-primary);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s;
}
.bsh-send:hover { background: var(--bsh-primary-dark); }
.bsh-send:disabled { background: #b9a3bf; cursor: not-allowed; }

/* Footer */
.bsh-footer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: var(--bsh-text-muted);
    background: #fff;
    border-top: 1px solid var(--bsh-border);
    flex-shrink: 0;
}

/* When loaded inside the embeddable widget bubble (iframe wider use case) */
@media (max-width: 480px) {
    .bsh-app {
        max-width: 100%;
        border-left: none;
        border-right: none;
    }
}
