/* ===== Claude Fly Advisor – Chat Widget v3 ===== */

#cfa-chat-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    background: #2c6e49;
    color: #fff;
    border-radius: 50%;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    overflow: hidden;
}
#cfa-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
#cfa-bubble-inner { line-height: 1; }
#cfa-bubble-inner img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Window */
#cfa-chat-window {
    position: fixed;
    bottom: 102px;
    right: 28px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
}

/* Header */
#cfa-chat-header {
    background: #2c6e49;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#cfa-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
#cfa-avatar-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.5);
}
#cfa-avatar-wrap img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
#cfa-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#cfa-header-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}
#cfa-header-status {
    color: #a8f0c6;
    font-size: 11px;
    font-weight: 500;
}
#cfa-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
#cfa-close-btn:hover { background: rgba(255,255,255,0.28); }

/* Messages */
#cfa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f8f5;
}

.cfa-message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}
.cfa-message.user {
    align-self: flex-end;
    background: #2c6e49;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.cfa-message.assistant {
    align-self: flex-start;
    background: #ffffff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.cfa-message.assistant strong { color: #1a4a30; }
.cfa-message.typing {
    align-self: flex-start;
    background: #fff;
    color: #888;
    font-style: italic;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Input area */
#cfa-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e4ebe4;
    background: #fff;
    flex-shrink: 0;
}
#cfa-user-input {
    flex: 1;
    border: 1.5px solid #c8d8c8;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    color: #1a1a1a;
    transition: border-color 0.2s;
    background: #f9fbf9;
}
#cfa-user-input:focus { border-color: #2c6e49; background: #fff; }
#cfa-user-input::placeholder { color: #9aab9a; }

#cfa-send-btn {
    background: #2c6e49;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-end;
}
#cfa-send-btn:hover { background: #245c3d; }
#cfa-send-btn:disabled { background: #a0b8a8; cursor: not-allowed; }

/* product link styles moved to bottom */

/* Scrollbar */
#cfa-chat-messages::-webkit-scrollbar { width: 5px; }
#cfa-chat-messages::-webkit-scrollbar-track { background: transparent; }
#cfa-chat-messages::-webkit-scrollbar-thumb { background: #c8d8c8; border-radius: 3px; }

/* Product thumbnail in message */
.cfa-product-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
    padding: 6px 10px;
    background: #f0f7f2;
    border-radius: 10px;
    border: 1px solid #c8dece;
    border-bottom: 1px solid #c8dece !important;
    text-decoration: none;
    color: #1a4a30 !important;
    font-weight: 600;
    font-size: 13.5px;
    transition: background 0.15s, border-color 0.15s;
    width: fit-content;
    max-width: 100%;
}
.cfa-product-link:hover {
    background: #e0f0e8;
    border-color: #2c6e49 !important;
    color: #1a3a28 !important;
}
.cfa-product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #c0d8c8;
}

/* ===== CTA Wrap & Label ===== */
#cfa-chat-cta-wrap {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 99999;
    flex-direction: row;
    pointer-events: none;
}
#cfa-chat-cta-label {
    background: #2c6e49;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.18);
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
    animation: cfa-cta-pulse 3s ease-in-out infinite;
    position: relative;
}
/* Small arrow pointing right toward bubble */
#cfa-chat-cta-label::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 8px;
    border-style: solid;
    border-color: transparent transparent transparent #2c6e49;
}
@keyframes cfa-cta-pulse {
    0%, 100% { transform: translateY(0); box-shadow: 0 3px 14px rgba(0,0,0,0.18); }
    50%       { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(44,110,73,0.35); }
}
#cfa-chat-bubble {
    pointer-events: auto;
    /* Override position since now inside wrap */
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    flex-shrink: 0;
}
