/**
 * WhiteTip AI Chat Frontend Widget Styles
 */
#whitetip-chat-root {
    position: fixed;
    bottom: var(--whitetip-offset-bottom, 25px);
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#whitetip-chat-root.whitetip-pos-right {
    right: var(--whitetip-offset-side, 25px);
}

#whitetip-chat-root.whitetip-pos-left {
    left: var(--whitetip-offset-side, 25px);
}

/* Launcher Button */
#whitetip-chat-toggle {
    width: var(--whitetip-launcher-size, 60px);
    height: var(--whitetip-launcher-size, 60px);
    border-radius: var(--whitetip-launcher-radius, 50%) !important;
    background-color: var(--whitetip-primary, #0066cc);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#whitetip-chat-toggle svg,
#whitetip-chat-toggle img.whitetip-launcher-avatar {
    width: var(--whitetip-launcher-icon-size, 28px);
    height: var(--whitetip-launcher-icon-size, 28px);
}

#whitetip-chat-toggle:hover {
    transform: scale(1.06);
}

#whitetip-chat-toggle .whitetip-icon-close {
    display: none;
}

#whitetip-chat-toggle.whitetip-active .whitetip-icon-open {
    display: none;
}

#whitetip-chat-toggle.whitetip-active .whitetip-icon-close {
    display: block;
}

/* Chat Window */
#whitetip-chat-window {
    position: absolute;
    bottom: 75px;
    width: var(--whitetip-chat-width, 380px) !important;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background-color: var(--whitetip-bg, #ffffff);
    border-radius: var(--whitetip-chat-radius, 16px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#whitetip-chat-root.whitetip-pos-right #whitetip-chat-window {
    right: 0;
}

#whitetip-chat-root.whitetip-pos-left #whitetip-chat-window {
    left: 0;
}

.whitetip-hidden {
    display: none !important;
}

/* Header */
.whitetip-chat-header {
    background-color: var(--whitetip-primary, #0066cc);
    color: var(--whitetip-header-text, #ffffff) !important;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whitetip-chat-header-title {
    color: var(--whitetip-header-text, #ffffff) !important;
}

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

/* Custom Bot Avatar Styles */
.whitetip-launcher-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.whitetip-avatar-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.whitetip-header-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.whitetip-avatar-fallback {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.whitetip-msg-bot {
    display: flex;
    align-items: flex-start;
}

.whitetip-msg-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-right: 8px;
    margin-top: 4px;
}

.whitetip-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.whitetip-avatar-fallback-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.whitetip-status-dot {
    width: 10px;
    height: 10px;
    background-color: #2ed573;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #ffffff;
}

.whitetip-chat-header h4 {
    margin: 0;
    font-size: var(--whitetip-header-title-size, 15px) !important;
    font-weight: 600;
    color: var(--whitetip-header-text, #ffffff) !important;
}

.whitetip-online-text {
    font-size: var(--whitetip-header-subtitle-size, 11px) !important;
    color: var(--whitetip-header-text, #ffffff) !important;
    opacity: 0.85;
}

.whitetip-chat-header-actions button {
    background: none;
    border: none;
    color: var(--whitetip-header-icon-color, #ffffff) !important;
    cursor: pointer;
    opacity: 0.85;
    padding: 4px;
    transition: opacity 0.2s ease;
}

.whitetip-chat-header-actions button svg {
    stroke: var(--whitetip-header-icon-color, #ffffff) !important;
}

.whitetip-chat-header-actions button:hover {
    opacity: 1;
}

/* Messages Body */
.whitetip-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.whitetip-message {
    display: flex;
    max-width: 92%;
}

.whitetip-msg-user {
    align-self: flex-end;
    max-width: 85%;
}

.whitetip-msg-bot {
    align-self: flex-start;
    max-width: 92%;
    width: 100%;
}

.whitetip-bubble {
    padding: 10px 14px;
    border-radius: var(--whitetip-bubble-radius, 14px);
    font-size: var(--whitetip-font-size, 14px) !important;
    line-height: 1.45;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.whitetip-msg-user .whitetip-bubble {
    background-color: var(--whitetip-bubble-user, #0066cc);
    color: var(--whitetip-bubble-user-text, #ffffff) !important;
    font-size: var(--whitetip-font-size, 14px) !important;
    border-radius: var(--whitetip-bubble-radius, 14px);
}

.whitetip-msg-bot .whitetip-bubble {
    background-color: var(--whitetip-bubble-bot, #f0f4f8);
    color: var(--whitetip-bubble-bot-text, #1e293b) !important;
    font-size: var(--whitetip-font-size, 14px) !important;
    border-radius: var(--whitetip-bubble-radius, 14px);
}

.whitetip-link {
    color: var(--whitetip-link-color, #0066cc) !important;
    text-decoration: underline;
    font-weight: 600;
}

.whitetip-link:hover {
    opacity: 0.85;
}

/* Typing Animation */
.whitetip-typing {
    padding: 10px 18px;
    display: flex;
    gap: 5px;
}

.whitetip-typing span {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: whitetipBounce 1.4s infinite ease-in-out both;
}

.whitetip-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.whitetip-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes whitetipBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Footer Input */
.whitetip-chat-footer {
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background-color: #ffffff;
}

.whitetip-chat-footer input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
}

.whitetip-chat-footer input:focus {
    border-color: var(--whitetip-primary, #0066cc);
}

.whitetip-chat-footer button {
    background-color: var(--whitetip-primary, #0066cc);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}