/* ============================================
   FusionWear AI Chatbot Widget
   Light theme — synced with site design
   ============================================ */

/* ---------- Variables ---------- */
:root {
    --cb-primary: #31363F;
    --cb-primary-hover: #222831;
    --cb-accent: #7c3aed;
    --cb-bg: #ffffff;
    --cb-bg-secondary: #f5f5f5;
    --cb-bg-msg-bot: #f5f5f5;
    --cb-bg-msg-user: #31363F;
    --cb-text: #1c1c1c;
    --cb-text-secondary: #6f6f6f;
    --cb-text-light: #999999;
    --cb-border: #ebebeb;
    --cb-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    --cb-radius: 16px;
    --cb-width: 380px;
    --cb-height: 540px;
}

/* ---------- Toggle Button ---------- */
.chatbot-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--cb-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(49, 54, 63, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: cb-pulse 3s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    background: var(--cb-primary-hover);
    box-shadow: 0 6px 28px rgba(49, 54, 63, 0.45);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

@keyframes cb-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(49, 54, 63, 0.35),
            0 0 0 0 rgba(49, 54, 63, 0.2);
    }

    50% {
        box-shadow: 0 4px 20px rgba(49, 54, 63, 0.35),
            0 0 0 10px rgba(49, 54, 63, 0);
    }
}

.chatbot-toggle.active {
    animation: none;
    background: #dc3545;
}

.chatbot-toggle.active:hover {
    background: #c82333;
}

.chatbot-toggle__badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ---------- Chat Panel ---------- */
.chatbot-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    z-index: 99998;
    width: var(--cb-width);
    height: var(--cb-height);
    border-radius: var(--cb-radius);
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: cb-slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cb-slideUp {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(16px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chatbot-panel.closing {
    animation: cb-slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cb-slideDown {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.9) translateY(16px);
    }
}

/* ---------- Header ---------- */
.chatbot-header {
    background: var(--cb-primary);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.chatbot-header__name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.chatbot-header__status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.chatbot-header__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
    animation: cb-dotPulse 2s infinite;
}

@keyframes cb-dotPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.chatbot-header__actions {
    display: flex;
    gap: 4px;
}

.chatbot-header__btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-header__btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ---------- Messages ---------- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--cb-bg);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--cb-border);
    border-radius: 10px;
}

/* ---------- Message Bubble ---------- */
.chatbot-msg {
    display: flex;
    gap: 8px;
    animation: cb-msgFade 0.25s ease;
    max-width: 88%;
}

@keyframes cb-msgFade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg--bot {
    align-self: flex-start;
}

.chatbot-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg__avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatbot-msg--bot .chatbot-msg__avatar {
    background: var(--cb-primary);
    color: #fff;
}

.chatbot-msg--user .chatbot-msg__avatar {
    background: var(--cb-bg-secondary);
    color: var(--cb-text-secondary);
}

.chatbot-msg__bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.chatbot-msg--bot .chatbot-msg__bubble {
    background: var(--cb-bg-msg-bot);
    color: var(--cb-text);
    border: 1px solid var(--cb-border);
    border-bottom-left-radius: 4px;
}

.chatbot-msg--user .chatbot-msg__bubble {
    background: var(--cb-bg-msg-user);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chatbot-msg__bubble strong {
    font-weight: 700;
}

.chatbot-msg--bot .chatbot-msg__bubble strong {
    color: var(--cb-primary);
}

.chatbot-msg__bubble ul,
.chatbot-msg__bubble ol {
    padding-left: 18px;
    margin: 6px 0 2px;
}

.chatbot-msg__bubble li {
    list-style: disc;
    margin-bottom: 3px;
    font-size: 13px;
}

/* ---------- Links ---------- */
.chatbot-link {
    color: var(--cb-primary) !important;
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s;
    cursor: pointer;
}

.chatbot-link:hover {
    opacity: 0.7;
    color: var(--cb-primary-hover) !important;
}

/* ---------- Typing Indicator ---------- */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 6px 2px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cb-text-light);
    animation: cb-bounce 1.4s infinite both;
}

.chatbot-typing span:nth-child(1) {
    animation-delay: 0s;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes cb-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ---------- Input ---------- */
.chatbot-input {
    padding: 10px 12px 8px;
    background: var(--cb-bg);
    border-top: 1px solid var(--cb-border);
    flex-shrink: 0;
}

.chatbot-input__wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cb-bg-secondary);
    border-radius: 12px;
    padding: 4px 5px 4px 14px;
    border: 1px solid var(--cb-border);
    transition: border-color 0.2s;
}

.chatbot-input__wrapper:focus-within {
    border-color: var(--cb-primary);
}

.chatbot-input__field {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--cb-text);
    font-size: 13.5px;
    padding: 9px 0;
    font-family: "Quicksand", "Cairo", sans-serif;
}

.chatbot-input__field::placeholder {
    color: var(--cb-text-light);
}

.chatbot-input__send {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    border: none;
    background: var(--cb-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.4;
}

.chatbot-input__send:not(:disabled) {
    opacity: 1;
}

.chatbot-input__send:not(:disabled):hover {
    background: var(--cb-primary-hover);
    transform: scale(1.04);
}

.chatbot-input__send:disabled {
    cursor: not-allowed;
}

.chatbot-input__hint {
    text-align: center;
    font-size: 11px;
    color: var(--cb-text-light);
    margin-top: 5px;
    opacity: 0.6;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .chatbot-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 110px);
        bottom: 86px;
        right: 10px;
        border-radius: 14px;
    }

    .chatbot-toggle {
        bottom: 18px;
        right: 18px;
        width: 50px;
        height: 50px;
    }
}