/* ===== CANDY AI ASSISTANT WIDGET STYLES ===== */
:root {
    --candy-primary: #15803d;
    --candy-primary-dark: #0f5127;
    --candy-accent: #22c55e;
    --candy-bg: #ffffff;
    --candy-text: #1a2332;
    --candy-gray-light: #f3f6f3;
    --candy-border: #e2ebe2;
}

/* Floating Launcher Trigger */
.candy-launcher {
    position: fixed;
    bottom: 95px;
    right: 25px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    filter: drop-shadow(0 6px 20px rgba(21, 128, 61, 0.28));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}
.candy-launcher:hover {
    transform: translateY(-3px) scale(1.02);
}

/* Teaser Bubble */
.candy-teaser {
    background: #ffffff;
    color: #1a2332;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--candy-border);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    animation: candyBounce 3s ease-in-out infinite;
}
.candy-teaser-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 4px;
    padding: 0;
}
.candy-teaser-close:hover {
    color: #4b5563;
}

/* Launcher Button */
.candy-launcher-btn {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #15803d);
    border: 3px solid #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}
.candy-launcher-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.candy-status-pulse {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.7);
    animation: candyPulse 2s infinite;
}

/* Chat Window Modal */
.candy-modal {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 390px;
    max-width: calc(100vw - 30px);
    height: 590px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--candy-border);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: candyFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.candy-modal.open {
    display: flex;
}

/* Modal Header */
.candy-header {
    background: linear-gradient(135deg, #0e3f1c 0%, #15803d 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.candy-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.candy-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
}
.candy-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
}
.candy-header-title h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.candy-badge {
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.candy-header-title p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    color: #bbf7d0;
    display: flex;
    align-items: center;
    gap: 5px;
}
.candy-dot-live {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}
.candy-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.candy-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}
.candy-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Quick Action Chips Bar */
.candy-chips-container {
    background: #f8faf8;
    padding: 10px 14px;
    border-bottom: 1px solid #edf2ee;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.candy-chips-container::-webkit-scrollbar {
    display: none;
}
.candy-quick-chip {
    background: #ffffff;
    border: 1px solid #d8e5d9;
    color: #1a4d25;
    padding: 5px 11px;
    border-radius: 14px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.candy-quick-chip:hover {
    background: #e8f5e9;
    border-color: #a5d6a7;
    transform: translateY(-1px);
}

/* Messages Area */
.candy-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fbfdfb;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.candy-msg {
    display: flex;
    gap: 10px;
    max-width: 86%;
    animation: candyMsgIn 0.25s ease-out;
}
.candy-msg.bot {
    align-self: flex-start;
}
.candy-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.candy-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}
.candy-msg-bubble {
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}
.candy-msg.bot .candy-msg-bubble {
    background: #ffffff;
    color: #1a2332;
    border: 1px solid #e3ede4;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.candy-msg.user .candy-msg-bubble {
    background: linear-gradient(135deg, #15803d, #166534);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25);
}
.candy-msg-bubble p {
    margin: 0 0 8px;
}
.candy-msg-bubble p:last-child {
    margin-bottom: 0;
}
.candy-msg-bubble ul, .candy-msg-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}
.candy-msg-bubble li {
    margin-bottom: 4px;
}
.candy-msg-bubble a {
    color: #15803d;
    font-weight: 600;
    text-decoration: underline;
}
.candy-msg.user .candy-msg-bubble a {
    color: #bbf7d0;
}
.candy-msg-time {
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 4px;
    display: block;
}
.candy-msg.user .candy-msg-time {
    text-align: right;
}

/* Typing Indicator */
.candy-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e3ede4;
    border-radius: 16px;
    width: fit-content;
}
.candy-dot {
    width: 6px;
    height: 6px;
    background: #15803d;
    border-radius: 50%;
    animation: candyDot 1.4s infinite ease-in-out both;
}
.candy-dot:nth-child(1) { animation-delay: -0.32s; }
.candy-dot:nth-child(2) { animation-delay: -0.16s; }

/* Input Footer */
.candy-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid var(--candy-border);
}
.candy-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f4f7f4;
    border: 1.5px solid #d9e5da;
    border-radius: 25px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s;
}
.candy-input-form:focus-within {
    border-color: var(--candy-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}
.candy-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.88rem;
    font-family: inherit;
    color: #1a2332;
    padding: 8px 0;
    outline: none;
    max-height: 80px;
    resize: none;
}
.candy-input::placeholder {
    color: #8c9e90;
}
.candy-voice-btn, .candy-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.candy-voice-btn {
    background: transparent;
    color: #556658;
}
.candy-voice-btn:hover {
    color: var(--candy-primary);
    background: rgba(21, 128, 61, 0.1);
}
.candy-voice-btn.recording {
    color: #dc2626;
    animation: candyPulse 1.2s infinite;
}
.candy-send-btn {
    background: var(--candy-primary);
    color: #ffffff;
}
.candy-send-btn:hover {
    background: var(--candy-primary-dark);
    transform: scale(1.05);
}
.candy-footer-sub {
    text-align: center;
    font-size: 0.68rem;
    color: #8c9e90;
    margin-top: 6px;
}

/* Animations */
@keyframes candyPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes candyFadeUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes candyMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes candyBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
@keyframes candyDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .candy-modal {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .candy-launcher {
        bottom: 85px;
        right: 15px;
    }
    .candy-teaser {
        display: none;
    }
}
