#clinicassist-widget-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ca-primary: var(--ca-primary-color, #003c84);
    --ca-bg: #ffffff;
    --ca-text: #1e293b;
    --ca-border: #e2e8f0;
}

#clinicassist-toggle-btn {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-color: var(--ca-primary);
    color: #ffffff;
    border: 3px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    outline: none;
    position: relative;
    z-index: 1000;
    animation: caFloatZoom 2.8s ease-in-out infinite;
}

#clinicassist-toggle-btn:hover {
    animation-play-state: paused;
    transform: translateY(-4px) scale(1.12);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

#clinicassist-widget-root.ca-open #clinicassist-toggle-btn {
    animation: none;
    transform: none;
}

.ca-greeting-bubble {
    display: none;
    position: absolute;
    bottom: 96px;
    right: 0;
    background: #ffffff;
    color: #0f172a;
    padding: 10px 18px;
    border-radius: 20px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    z-index: 999;
}

.ca-greeting-bubble.ca-bubble-visible {
    display: block !important;
    animation: caBubblePopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), caFloatBubble 2.8s ease-in-out 0.35s infinite;
}

.ca-greeting-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 32px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

@keyframes caBubblePopIn {
    0% { transform: scale(0.4) translateY(18px); opacity: 0; }
    80% { transform: scale(1.08) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes caFloatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes caFloatZoom {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
    }
    50% {
        transform: translateY(-8px) scale(1.09);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
    }
}

.ca-typing-cursor {
    display: inline-block;
    font-weight: 700;
    color: var(--ca-primary);
    animation: caBlink 0.7s infinite;
    margin-left: 2px;
}

@keyframes caBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.ca-toggle-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
}

#clinicassist-toggle-btn svg {
    width: 32px;
    height: 32px;
    pointer-events: none;
}

#clinicassist-chat-box {
    position: absolute;
    bottom: 100px;
    right: 0;
    width: 480px;
    max-width: calc(100vw - 32px);
    height: 680px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1001;
}

#clinicassist-chat-box.ca-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.96);
}

.ca-header {
    background: linear-gradient(135deg, var(--ca-primary) 0%, #002654 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.ca-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ca-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

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

.ca-title {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.ca-subtitle {
    font-size: 11px;
    opacity: 0.92;
}

#clinicassist-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

#clinicassist-close-btn:hover {
    opacity: 1;
}

.ca-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.ca-msg {
    max-width: 90%;
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.ca-msg-bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.ca-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--ca-primary) 0%, #002d62 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.ca-msg-emergency {
    align-self: center;
    width: 92%;
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.ca-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ca-opt-btn {
    background: #ffffff;
    border: 1.5px solid var(--ca-primary);
    color: var(--ca-primary);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 60, 132, 0.05);
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    overflow: hidden !important;
    line-height: 1.35;
}

.ca-opt-btn:hover {
    background: var(--ca-primary);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 60, 132, 0.25);
}

.ca-confirm-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--ca-primary);
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ca-confirm-card div {
    margin-bottom: 6px;
    color: #334155;
}

.ca-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.ca-confirm-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border: none;
    transition: all 0.2s ease;
}

.ca-confirm-btn-accept {
    background: linear-gradient(135deg, var(--ca-primary) 0%, #002d62 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 60, 132, 0.2);
}

.ca-confirm-btn-accept:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 60, 132, 0.3);
}

.ca-confirm-btn-edit {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.ca-confirm-btn-edit:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.ca-input-container {
    display: flex;
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    gap: 10px;
    align-items: center;
}

#clinicassist-user-input {
    flex: 1;
    border: 1.5px solid #cbd5e1;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

#clinicassist-user-input:focus {
    border-color: var(--ca-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 60, 132, 0.12);
}

#clinicassist-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ca-primary) 0%, #002d62 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 60, 132, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#clinicassist-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 10px rgba(0, 60, 132, 0.35);
}

#clinicassist-send-btn svg {
    width: 17px;
    height: 17px;
}

.ca-footer-branding {
    text-align: center;
    font-size: 10.5px;
    color: #94a3b8;
    padding-bottom: 8px;
    background: #ffffff;
    font-weight: 500;
}

/* Live Status Bar */
.ca-live-bar {
    background: #ecfdf5;
    color: #065f46;
    border-bottom: 1px solid #a7f3d0;
    padding: 7px 14px;
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.02);
}

.ca-live-bar.ca-hidden {
    display: none !important;
}

.ca-live-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: ca-pulse 1.8s infinite;
}

@keyframes ca-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Message Headers with Avatars & Timestamps */
.ca-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 10.5px;
    opacity: 0.9;
}

.ca-msg-header-user {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.95);
}

.ca-msg-header-bot {
    justify-content: flex-start;
    color: #475569;
}

.ca-avatar-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ca-msg-bot .ca-avatar-circle {
    background: var(--ca-primary);
    color: #ffffff;
}

.ca-avatar-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.ca-msg-sender-name {
    font-weight: 600;
}

.ca-msg-time {
    font-size: 9.5px;
    opacity: 0.75;
}

