/* Care Chat standalone page, aligned with the hospital design system. */
:root {
    --chat-primary: #0f766e;
    --chat-primary-light: #14b8a6;
    --chat-primary-dark: #115e59;
    --chat-blue: #0ea5e9;
    --chat-green: #10b981;
    --chat-amber: #f59e0b;
    --chat-rose: #f43f5e;
    --chat-ink: #0f172a;
    --chat-text: #1e293b;
    --chat-muted: #64748b;
    --chat-line: #dbe8ee;
    --chat-soft: #ecfeff;
    --chat-soft-green: #ecfdf5;
    --chat-bg: #f8fafc;
    --chat-card: #ffffff;
    --chat-radius: 18px;
    --chat-radius-sm: 12px;
    --chat-shadow-sm: 0 10px 28px rgba(15, 23, 42, .06);
    --chat-shadow-md: 0 18px 48px rgba(15, 23, 42, .09);
}

body.chatbot-standalone-body {
    background:
        linear-gradient(180deg, #f8fafc 0%, #f0f9ff 42%, #f8fafc 100%);
}

.chatbot-page {
    min-height: 100vh;
    color: var(--chat-text);
}

.chatbot-page * {
    box-sizing: border-box;
}

.chatbot-hero {
    padding: 132px 0 34px;
    background:
        linear-gradient(90deg, rgba(236, 254, 255, .92), rgba(255, 255, 255, .98) 56%, rgba(240, 253, 250, .88));
    border-bottom: 1px solid var(--chat-line);
}

.chatbot-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
    gap: 28px;
    align-items: end;
}

.chatbot-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--chat-primary-dark);
    background: #ffffff;
    border: 1px solid color-mix(in srgb, var(--chat-primary-light) 32%, var(--chat-line));
    font-size: .84rem;
    font-weight: 900;
    letter-spacing: .03em;
}

.chatbot-eyebrow i {
    color: var(--chat-primary);
}

.chatbot-hero h1 {
    max-width: 820px;
    margin: 16px 0 12px;
    color: var(--chat-ink);
    font-size: clamp(2rem, 3.2vw, 3.25rem);
    font-weight: 950;
    line-height: 1.08;
    letter-spacing: 0;
}

.chatbot-hero h1 span {
    color: var(--chat-primary);
}

.chatbot-hero p {
    max-width: 850px;
    margin: 0;
    color: var(--chat-muted);
    font-size: 1rem;
    line-height: 1.78;
}

.chatbot-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.chatbot-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: .94rem;
    font-weight: 900;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.chatbot-hero-btn.primary {
    color: #ffffff;
    background: var(--chat-primary);
    box-shadow: 0 12px 24px rgba(15, 118, 110, .18);
}

.chatbot-hero-btn.secondary {
    color: var(--chat-primary-dark);
    background: #ffffff;
    border-color: color-mix(in srgb, var(--chat-primary-light) 26%, var(--chat-line));
}

.chatbot-hero-btn:hover {
    transform: translateY(-1px);
}

.chatbot-guidance-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 22px;
}

.chatbot-guidance-strip > div {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: var(--chat-radius-sm);
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--chat-line);
}

.chatbot-guidance-strip i,
.chatbot-help-row i,
.chatbot-info-card h3 i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--chat-primary);
    background: color-mix(in srgb, var(--chat-primary) 10%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--chat-primary) 18%, var(--chat-line));
}

.chatbot-guidance-strip strong,
.chatbot-help-row strong {
    display: block;
    color: var(--chat-ink);
    font-size: .88rem;
    font-weight: 900;
    line-height: 1.35;
}

.chatbot-guidance-strip span,
.chatbot-help-row span {
    display: block;
    margin-top: 3px;
    color: var(--chat-muted);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.45;
}

.chatbot-help-rail {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--chat-radius);
    background: #ffffff;
    border: 1px solid var(--chat-line);
    box-shadow: var(--chat-shadow-sm);
}

.chatbot-help-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 11px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #edf2f6;
}

.chatbot-help-row i {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.chatbot-help-row.is-ready i {
    color: var(--chat-green);
    background: color-mix(in srgb, var(--chat-green) 10%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-green) 20%, var(--chat-line));
}

.chatbot-help-row.is-emergency i {
    color: var(--chat-rose);
    background: color-mix(in srgb, var(--chat-rose) 9%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-rose) 18%, var(--chat-line));
}

.chatbot-panel-section {
    padding: 28px 0 72px;
}

.chatbot-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px;
    align-items: start;
}

.chatbot-shell,
.chatbot-info-card {
    border-radius: var(--chat-radius);
    background: var(--chat-card);
    border: 1px solid var(--chat-line);
    box-shadow: var(--chat-shadow-sm);
}

.chatbot-shell {
    overflow: hidden;
}

.chatbot-shell-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(90deg, #ecfeff, #ffffff);
    border-bottom: 1px solid var(--chat-line);
}

.chatbot-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chatbot-agent-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: var(--chat-primary);
    background: color-mix(in srgb, var(--chat-primary) 10%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--chat-primary) 18%, var(--chat-line));
}

.chatbot-agent h2 {
    margin: 0;
    color: var(--chat-ink);
    font-size: 1.1rem;
    font-weight: 900;
}

.chatbot-agent p {
    margin: 3px 0 0;
    color: var(--chat-muted);
    font-size: .86rem;
    line-height: 1.45;
}

.chatbot-shell-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    font-size: .82rem;
    font-weight: 900;
}

.chatbot-shell-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--chat-green);
}

.chatbot-messages {
    min-height: 430px;
    max-height: 58vh;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.chatbot-message {
    display: flex;
    margin: 0 0 12px;
    animation: chatbotBubbleIn .2s ease both;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-bubble {
    max-width: min(76%, 720px);
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--chat-text);
    background: #ffffff;
    border: 1px solid var(--chat-line);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .045);
    line-height: 1.7;
    white-space: pre-wrap;
}

.chatbot-message.user .chatbot-bubble {
    color: #ffffff;
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    border-bottom-right-radius: 6px;
}

.chatbot-message.bot .chatbot-bubble {
    border-bottom-left-radius: 6px;
}

.chatbot-message.emergency .chatbot-bubble {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #7c2d12;
}

.chatbot-message.fallback .chatbot-bubble {
    background: #ffffff;
    border-color: #e2e8f0;
}

.chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chatbot-action-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--chat-primary-dark);
    background: #ecfeff;
    border: 1px solid #bae6fd;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 900;
}

.chatbot-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--chat-primary);
    animation: chatbotTyping 1s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: .14s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: .28s;
}

.chatbot-compose {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid var(--chat-line);
}

.chatbot-quick {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.chatbot-quick-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

.chatbot-quick-head span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--chat-ink);
    font-size: .9rem;
    font-weight: 900;
}

.chatbot-quick-head i {
    color: var(--chat-primary);
}

.chatbot-quick-head small {
    color: var(--chat-muted);
    font-size: .76rem;
    font-weight: 700;
}

.chatbot-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chatbot-quick button,
.chatbot-topic-picker button {
    border: 1px solid color-mix(in srgb, var(--chat-primary) 18%, var(--chat-line));
    color: var(--chat-primary-dark);
    background: #ffffff;
    border-radius: 999px;
    min-height: 36px;
    padding: 7px 11px;
    font-size: .84rem;
    font-weight: 900;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.chatbot-quick button:hover,
.chatbot-quick button:focus-visible,
.chatbot-topic-picker button:hover,
.chatbot-topic-picker button:focus-visible {
    transform: translateY(-1px);
    background: #ecfeff;
    border-color: color-mix(in srgb, var(--chat-primary) 34%, var(--chat-line));
}

.chatbot-topic-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.chatbot-topic-picker select,
.chatbot-form input {
    width: 100%;
    border: 1px solid var(--chat-line);
    border-radius: 12px;
    color: var(--chat-text);
    background: #ffffff;
    font: inherit;
    outline: none;
}

.chatbot-topic-picker select {
    min-height: 38px;
    padding: 0 10px;
    font-size: .86rem;
}

.chatbot-topic-picker select:focus,
.chatbot-form input:focus {
    border-color: color-mix(in srgb, var(--chat-primary) 55%, var(--chat-line));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--chat-primary) 11%, transparent);
}

.chatbot-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.chatbot-form input {
    min-height: 48px;
    padding: 0 14px;
}

.chatbot-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    background: var(--chat-primary);
    font-weight: 900;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, opacity .15s ease;
}

.chatbot-form button:hover {
    transform: translateY(-1px);
    background: var(--chat-primary-dark);
}

.chatbot-form button:disabled,
.chatbot-form input:disabled {
    opacity: .64;
    cursor: not-allowed;
}

.chatbot-side {
    display: grid;
    gap: 12px;
}

.chatbot-info-card {
    padding: 16px;
}

.chatbot-info-card.emergency {
    border-color: #fed7aa;
    background: #fffaf3;
}

.chatbot-info-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 9px;
    color: var(--chat-ink);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.35;
}

.chatbot-info-card.emergency h3 i {
    color: var(--chat-rose);
    background: color-mix(in srgb, var(--chat-rose) 9%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-rose) 18%, var(--chat-line));
}

.chatbot-info-card p {
    margin: 0;
    color: var(--chat-muted);
    font-size: .92rem;
    line-height: 1.68;
}

.chatbot-info-card a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--chat-primary-dark);
    background: #ffffff;
    border: 1px solid var(--chat-line);
    text-decoration: none;
    font-size: .86rem;
    font-weight: 900;
}

.chatbot-info-card.emergency a {
    color: #ffffff;
    background: var(--chat-rose);
    border-color: var(--chat-rose);
}

.chatbot-footer-note {
    margin: 4px 0 0;
    color: var(--chat-muted);
    font-size: .82rem;
    line-height: 1.65;
}

.chatbot-page .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes chatbotBubbleIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chatbotTyping {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .45;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 1100px) {
    .chatbot-hero-grid,
    .chatbot-workbench {
        grid-template-columns: 1fr;
    }

    .chatbot-help-rail {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .chatbot-side {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .chatbot-hero {
        padding: 108px 0 24px;
    }

    .chatbot-guidance-strip,
    .chatbot-help-rail,
    .chatbot-side {
        grid-template-columns: 1fr;
    }

    .chatbot-shell-head,
    .chatbot-quick-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .chatbot-messages {
        min-height: 360px;
        max-height: 56vh;
        padding: 16px;
    }

    .chatbot-bubble {
        max-width: 88%;
    }
}

@media (max-width: 540px) {
    .chatbot-hero-actions,
    .chatbot-form,
    .chatbot-topic-picker {
        grid-template-columns: 1fr;
    }

    .chatbot-hero-actions {
        display: grid;
    }

    .chatbot-hero-btn,
    .chatbot-form button,
    .chatbot-topic-picker button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-message,
    .chatbot-typing span,
    .chatbot-hero-btn,
    .chatbot-form button,
    .chatbot-quick button {
        animation: none !important;
        transition: none !important;
    }
}

/* Semantic icon/color pass for Care Chat. Keep calm design-system tokens, not decorative gradients. */
.chatbot-hero-btn.line {
    color: #ffffff;
    background: var(--chat-green);
    border-color: var(--chat-green);
    box-shadow: 0 12px 24px rgba(16, 185, 129, .18);
}

.chatbot-guidance-strip > div > i {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.chatbot-guidance-strip > div > strong {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.chatbot-guidance-strip > div > span {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    word-break: normal;
    overflow-wrap: break-word;
}

.chatbot-guidance-strip > div:nth-child(1) i {
    color: var(--chat-primary);
    background: color-mix(in srgb, var(--chat-primary) 10%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-primary) 22%, var(--chat-line));
}

.chatbot-guidance-strip > div:nth-child(2) i {
    color: var(--chat-blue);
    background: color-mix(in srgb, var(--chat-blue) 10%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-blue) 22%, var(--chat-line));
}

.chatbot-guidance-strip > div:nth-child(3) i {
    color: var(--chat-rose);
    background: color-mix(in srgb, var(--chat-rose) 9%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-rose) 20%, var(--chat-line));
}

.chatbot-help-row:not(.is-ready):not(.is-emergency) i,
.chatbot-info-card:not(.emergency):not(.line) h3 i {
    color: var(--chat-blue);
    background: color-mix(in srgb, var(--chat-blue) 10%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-blue) 20%, var(--chat-line));
}

.chatbot-action-link,
.chatbot-quick button,
.chatbot-topic-picker-icon {
    --semantic: var(--chat-primary);
    --semantic-bg: color-mix(in srgb, var(--semantic) 9%, #ffffff);
    --semantic-border: color-mix(in srgb, var(--semantic) 22%, var(--chat-line));
}

.chatbot-action-link {
    color: color-mix(in srgb, var(--semantic) 74%, var(--chat-ink));
    background: var(--semantic-bg);
    border-color: var(--semantic-border);
}

.chatbot-action-link i {
    color: var(--semantic);
}

.chatbot-action-link.is-phone,
.chatbot-quick button.is-phone,
.chatbot-topic-picker-icon.is-phone {
    --semantic: #0e7490;
}

.chatbot-action-link.is-hours,
.chatbot-quick button.is-hours,
.chatbot-topic-picker-icon.is-hours {
    --semantic: var(--chat-amber);
}

.chatbot-action-link.is-line,
.chatbot-quick button.is-line,
.chatbot-topic-picker-icon.is-line {
    --semantic: var(--chat-green);
}

.chatbot-action-link.is-emergency,
.chatbot-quick button.is-emergency,
.chatbot-topic-picker-icon.is-emergency {
    --semantic: var(--chat-rose);
}

.chatbot-action-link.is-appointment,
.chatbot-quick button.is-appointment,
.chatbot-topic-picker-icon.is-appointment {
    --semantic: var(--chat-amber);
}

.chatbot-action-link.is-location,
.chatbot-quick button.is-location,
.chatbot-topic-picker-icon.is-location {
    --semantic: #0e7490;
}

.chatbot-action-link.is-doctor,
.chatbot-quick button.is-doctor,
.chatbot-topic-picker-icon.is-doctor {
    --semantic: #2563eb;
}

.chatbot-action-link.is-package,
.chatbot-quick button.is-package,
.chatbot-topic-picker-icon.is-package {
    --semantic: #7c3aed;
}

.chatbot-action-link.is-safety,
.chatbot-quick button.is-safety,
.chatbot-topic-picker-icon.is-safety {
    --semantic: #10b981;
}

.chatbot-quick button {
    color: color-mix(in srgb, var(--semantic) 72%, var(--chat-ink));
    background: var(--semantic-bg);
    border-color: var(--semantic-border);
}

.chatbot-quick button i {
    color: var(--semantic);
}

.chatbot-topic-picker {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
}

.chatbot-topic-picker-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 38px;
    border-radius: 12px;
    color: var(--semantic);
    background: var(--semantic-bg);
    border: 1px solid var(--semantic-border);
}

.chatbot-topic-picker select {
    min-width: 0;
}

.chatbot-info-card.line {
    border-color: color-mix(in srgb, var(--chat-green) 22%, var(--chat-line));
    background: linear-gradient(180deg, #ffffff, #f0fdf4);
}

.chatbot-info-card.line h3 i {
    color: var(--chat-green);
    background: color-mix(in srgb, var(--chat-green) 10%, #ffffff);
    border-color: color-mix(in srgb, var(--chat-green) 22%, var(--chat-line));
}

.chatbot-info-card.line a {
    color: #047857;
    border-color: #bbf7d0;
    background: #ecfdf5;
}

.chatbot-line-qr {
    display: block;
    width: min(100%, 190px);
    aspect-ratio: 1;
    object-fit: contain;
    margin: 14px auto 0;
    padding: 10px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    box-shadow: var(--chat-shadow-sm);
}

@media (max-width: 540px) {
    .chatbot-topic-picker {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .chatbot-topic-picker button {
        grid-column: 1 / -1;
        width: 100%;
    }
}
