/* ============================================
   AUTOLINK PRO — AI Chat Widget Styles
   ============================================ */

#chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* On mobile — sit above the sticky CTA bar */
@media (max-width: 768px) {
    #chat-widget {
        bottom: 80px;
        right: 16px;
    }
}

/* ---- TOGGLE BUTTON ---- */
.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e94560;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    color: #fff;
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(233, 69, 96, 0.5);
}

.chat-icon-open,
.chat-icon-close {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-toggle .chat-icon-close {
    opacity: 0;
    transform: rotate(-90deg);
}

.chat-toggle.open .chat-icon-open {
    opacity: 0;
    transform: rotate(90deg);
}

.chat-toggle.open .chat-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #27ae60;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ---- CHAT PANEL ---- */
.chat-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform-origin: bottom right;
}

.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

@media (max-width: 400px) {
    .chat-panel {
        width: calc(100vw - 32px);
        right: 0;
    }
}

/* ---- HEADER ---- */
.chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e94560;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-header-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.chat-header-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #27ae60;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.chat-close-btn:hover {
    color: #fff;
}

/* ---- MESSAGES ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #e8ecf1;
    border-radius: 4px;
}

.chat-message {
    display: flex;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.user .message-bubble {
    background: #e94560;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: #f8f9fb;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8ecf1;
}

/* Typing indicator */
.message-bubble.typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}

.message-bubble.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6c7a89;
    animation: typing-bounce 1.2s infinite;
}

.message-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.message-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---- SUGGESTION CHIPS ---- */
.chat-suggestions {
    padding: 4px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.suggestion-chip {
    background: #fff0f3;
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.suggestion-chip:hover {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

/* ---- INPUT AREA ---- */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8ecf1;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid #e8ecf1;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8f9fb;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input:focus {
    border-color: #e94560;
    background: #fff;
}

.chat-input::placeholder {
    color: #9ba5b0;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e94560;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}

.chat-send-btn:hover {
    background: #d63851;
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.95);
}
