/* Blessed Sky Pharmacy AI Chatbot Widget */
:root {
    --blessed-primary: #1a7a4c;
    --blessed-primary-dark: #145c3a;
    --blessed-accent: #f0a500;
    --blessed-bg: #ffffff;
    --blessed-text: #1a1a2e;
    --blessed-muted: #6c757d;
    --blessed-border: #e8ecef;
    --blessed-bot-bg: #f0f7f4;
    --blessed-user-bg: #1a7a4c;
    --blessed-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.blessed-chat-dark {
    --blessed-bg: #1a1a2e;
    --blessed-text: #e8ecef;
    --blessed-muted: #adb5bd;
    --blessed-border: #2d2d44;
    --blessed-bot-bg: #252540;
}

#blessed-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Roboto', sans-serif;
}

#blessed-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blessed-primary), var(--blessed-primary-dark));
    border: none;
    cursor: pointer;
    box-shadow: var(--blessed-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

#blessed-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(26,122,76,0.4);
}

#blessed-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#blessed-chat-toggle .blessed-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--blessed-accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

#blessed-chat-panel {
    display: none;
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--blessed-bg);
    border-radius: 16px;
    box-shadow: var(--blessed-shadow);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--blessed-border);
    animation: blessedSlideUp 0.3s ease;
}

#blessed-chat-panel.open {
    display: flex;
}

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

.blessed-chat-header {
    background: linear-gradient(135deg, var(--blessed-primary), var(--blessed-primary-dark));
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.blessed-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.blessed-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.blessed-chat-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.blessed-chat-header p {
    margin: 0;
    font-size: 11px;
    opacity: 0.85;
}

.blessed-chat-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Language dropdown */
.blessed-lang-dropdown {
    position: relative;
}

#blessed-chat-widget .blessed-lang-toggle {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 48px;
    justify-content: center;
    transition: background 0.2s;
}

#blessed-chat-widget .blessed-lang-toggle:hover,
#blessed-chat-widget .blessed-lang-dropdown.open .blessed-lang-toggle {
    background: rgba(0, 0, 0, 0.45) !important;
    color: #ffffff !important;
}

#blessed-chat-widget .blessed-lang-toggle #blessed-lang-label,
#blessed-chat-widget .blessed-lang-toggle .blessed-lang-caret {
    color: #ffffff !important;
}

.blessed-lang-caret {
    font-size: 9px;
    opacity: 0.85;
}

.blessed-lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #ffffff !important;
    color: #1a1a2e !important;
    border: 1px solid #b8c4ce;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    z-index: 100001;
    overflow: hidden;
}

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

.blessed-lang-menu li {
    margin: 0;
    padding: 0;
}

#blessed-chat-widget .blessed-chat-header .blessed-lang-menu button {
    width: 100%;
    border: none;
    background-color: #ffffff !important;
    color: #1a1a2e !important;
    text-align: left;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: block;
    line-height: 1.3;
}

#blessed-chat-widget .blessed-chat-header .blessed-lang-menu button:hover {
    background-color: #e8f5ee !important;
    color: #145c3a !important;
}

#blessed-chat-widget .blessed-chat-header .blessed-lang-menu button.active {
    background-color: #1a7a4c !important;
    color: #ffffff !important;
    font-weight: 600;
}

/* Dark mode language menu */
.blessed-chat-dark .blessed-lang-menu {
    background: #252540 !important;
    border-color: #3d3d5c;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#blessed-chat-widget.blessed-chat-dark .blessed-chat-header .blessed-lang-menu button,
.blessed-chat-dark .blessed-lang-menu button {
    background-color: #252540 !important;
    color: #e8ecef !important;
}

#blessed-chat-widget.blessed-chat-dark .blessed-chat-header .blessed-lang-menu button:hover,
.blessed-chat-dark .blessed-lang-menu button:hover {
    background-color: #32325a !important;
    color: #ffffff !important;
}

#blessed-chat-widget.blessed-chat-dark .blessed-chat-header .blessed-lang-menu button.active,
.blessed-chat-dark .blessed-lang-menu button.active {
    background-color: #1a7a4c !important;
    color: #ffffff !important;
}

.blessed-chat-header-actions button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.blessed-chat-header-actions button:hover {
    background: rgba(255,255,255,0.3);
}

.blessed-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--blessed-bg);
}

.blessed-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    color: var(--blessed-text);
}

.blessed-msg.bot {
    background: var(--blessed-bot-bg);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.blessed-chat-dark .blessed-msg.bot {
    background: #2d2d4a !important;
    color: #e8ecef !important;
}

.blessed-chat-dark .blessed-msg.bot strong,
.blessed-chat-dark .blessed-msg.bot p,
.blessed-chat-dark .blessed-msg.bot span,
.blessed-chat-dark .blessed-msg.bot br {
    color: #e8ecef !important;
    background: transparent !important;
}

.blessed-msg.bot * {
    background-color: transparent !important;
}

.blessed-msg.user {
    background: var(--blessed-user-bg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.blessed-msg strong {
    font-weight: 600;
}

.blessed-msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.blessed-action-btn {
    display: inline-block;
    padding: 5px 12px;
    background: var(--blessed-primary);
    color: white !important;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none !important;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.blessed-action-btn:hover {
    background: var(--blessed-primary-dark);
    color: white !important;
}

.blessed-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--blessed-bot-bg);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.blessed-typing.active {
    display: flex;
    gap: 4px;
    align-items: center;
}

.blessed-typing span {
    width: 7px;
    height: 7px;
    background: var(--blessed-muted);
    border-radius: 50%;
    animation: blessedBounce 1.4s infinite;
}

.blessed-typing span:nth-child(2) { animation-delay: 0.2s; }
.blessed-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blessedBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.blessed-chat-input-area {
    padding: 12px;
    border-top: 1px solid var(--blessed-border);
    background: var(--blessed-bg);
    flex-shrink: 0;
}

.blessed-quick-actions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.blessed-quick-actions::-webkit-scrollbar { display: none; }

.blessed-quick-btn {
    white-space: nowrap;
    padding: 4px 10px;
    background: var(--blessed-bot-bg);
    border: 1px solid var(--blessed-border);
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    color: var(--blessed-text);
    transition: all 0.2s;
}

.blessed-quick-btn:hover {
    background: var(--blessed-primary);
    color: white;
    border-color: var(--blessed-primary);
}

.blessed-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.blessed-input-row textarea {
    flex: 1;
    border: 1px solid var(--blessed-border);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13.5px;
    resize: none;
    max-height: 80px;
    outline: none;
    background: var(--blessed-bg);
    color: var(--blessed-text);
    font-family: inherit;
    line-height: 1.4;
}

.blessed-input-row textarea:focus {
    border-color: var(--blessed-primary);
}

.blessed-input-tools {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.blessed-input-tools button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--blessed-border);
    background: var(--blessed-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--blessed-muted);
    transition: all 0.2s;
}

.blessed-input-tools button:hover {
    background: var(--blessed-bot-bg);
    color: var(--blessed-primary);
}

.blessed-input-tools button.recording {
    background: #ff4444;
    color: white;
    border-color: #ff4444;
    animation: blessedPulse 1s infinite;
}

@keyframes blessedPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,68,68,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255,68,68,0); }
}

#blessed-send-btn {
    background: var(--blessed-primary) !important;
    color: white !important;
    border-color: var(--blessed-primary) !important;
}

#blessed-prescription-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

#blessed-prescription-modal.open {
    display: flex;
}

.blessed-modal-content {
    background: var(--blessed-bg);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    color: var(--blessed-text);
}

.blessed-modal-content h5 {
    margin-bottom: 16px;
    color: var(--blessed-primary);
}

.blessed-modal-content input,
.blessed-modal-content input[type="file"] {
    width: 100%;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--blessed-border);
    border-radius: 8px;
    background: var(--blessed-bg);
    color: var(--blessed-text);
}

.blessed-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

@media (max-width: 480px) {
    #blessed-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    #blessed-chat-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 68px;
        right: 0;
    }
}
