/* PROMEDIA AI Chatbot Widget v3 */
:root {
    --cb-primary: #1a3a5c;
    --cb-accent: #0d6efd;
    --cb-accent-hover: #0b5ed7;
    --cb-bg: #f0f4f8;
    --cb-card-bg: #ffffff;
    --cb-shadow: 0 8px 40px rgba(0,0,0,0.15);
    --cb-radius: 18px;
    --cb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-accent), #0a58ca);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(13,110,253,0.45);
    transition: transform var(--cb-transition), box-shadow var(--cb-transition);
    position: relative;
    animation: cbPulseShadow 3s ease-in-out infinite;
}

#chatbot-toggle:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 8px 32px rgba(13,110,253,0.6);
}

#chatbot-toggle svg {
    width: 26px;
    height: 26px;
    transition: transform var(--cb-transition);
}

#chatbot-toggle:hover svg {
    transform: scale(1.1);
}

@keyframes cbPulseShadow {
    0%, 100% { box-shadow: 0 6px 24px rgba(13,110,253,0.45); }
    50% { box-shadow: 0 6px 36px rgba(13,110,253,0.65); }
}

#chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(220,53,69,0.5);
    animation: cbBadgePop 0.3s ease-out;
}

@keyframes cbBadgePop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

#chatbot-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 580px;
    background: var(--cb-card-bg);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
}

#chatbot-panel.open {
    display: flex;
    animation: cbPanelIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cbPanelIn {
    0% { opacity: 0; transform: translateY(24px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cbMsgIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--cb-primary), #0d1b2a);
    color: #fff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

#chatbot-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    pointer-events: none;
}

#chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chatbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

#chatbot-header-info div strong {
    font-size: 14px;
    display: block;
    line-height: 1.3;
}

#chatbot-status {
    display: block;
    font-size: 11px;
    opacity: 0.8;
    position: relative;
    padding-left: 12px;
}

#chatbot-status::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    animation: cbStatusPulse 2s ease-in-out infinite;
}

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

#chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    z-index: 1;
}

#chatbot-clear, #chatbot-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    opacity: 0.75;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#chatbot-clear:hover, #chatbot-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.12);
}

#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    scroll-behavior: smooth;
}

.chatbot-msg {
    max-width: 88%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    animation: cbMsgIn 0.3s ease-out;
    position: relative;
}

.chatbot-msg.bot {
    background: var(--cb-card-bg);
    color: #1a1a2e;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chatbot-msg.user {
    background: linear-gradient(135deg, var(--cb-accent), #0a58ca);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-time {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 4px;
    display: block;
}

.chatbot-msg.user .chatbot-msg-time {
    text-align: right;
    opacity: 0.7;
}

#chatbot-suggestions {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 6px;
    background: #f8fafc;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.chatbot-chip {
    padding: 6px 14px;
    border-radius: 18px;
    border: 1.5px solid var(--cb-accent);
    background: var(--cb-card-bg);
    color: var(--cb-accent);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.chatbot-chip:hover {
    background: var(--cb-accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13,110,253,0.3);
}

.chatbot-chip:active {
    transform: translateY(0) scale(0.96);
}

#chatbot-typing {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    margin: 0 16px 6px;
    align-self: flex-start;
    background: var(--cb-card-bg);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    animation: cbMsgIn 0.2s ease-out;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: cbTypingBounce 1.4s ease-in-out infinite;
}

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

@keyframes cbTypingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-7px); background: var(--cb-accent); }
}

#chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 16px 14px;
    border-top: 1px solid #e2e8f0;
    background: var(--cb-card-bg);
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
}

#chatbot-input:focus {
    border-color: var(--cb-accent);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.1);
    background: #fff;
}

#chatbot-input::placeholder {
    color: #94a3b8;
}

#chatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-accent), #0a58ca);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#chatbot-send:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(13,110,253,0.35);
}

#chatbot-send:active:not(:disabled) {
    transform: scale(0.92);
}

#chatbot-send:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Scrollbar styling */
#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#chatbot-messages::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Responsive */
@media (max-width: 768px) and (min-width: 481px) {
    #chatbot-panel {
        width: calc(100vw - 48px);
        max-width: 420px;
        height: 500px;
    }
    #chatbot-container {
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    #chatbot-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 140px);
        right: -4px;
        bottom: -4px;
        border-radius: 14px;
    }
    #chatbot-container {
        bottom: 14px;
        right: 14px;
    }
    #chatbot-toggle {
        width: 52px;
        height: 52px;
    }
    #chatbot-toggle svg {
        width: 22px;
        height: 22px;
    }
    #chatbot-suggestions {
        padding: 6px 12px 4px;
        gap: 4px;
    }
    .chatbot-chip {
        font-size: 11px;
        padding: 5px 10px;
    }
    #chatbot-header {
        padding: 12px 14px;
    }
    #chatbot-messages {
        padding: 12px;
    }
    .chatbot-msg {
        max-width: 92%;
        font-size: 13px;
        padding: 8px 12px;
    }
}
