﻿/* ==========================================================
   Salesforce-Inspired Theme
   ========================================================== */

:root {
    --chat-primary: #0176d3;
    --chat-primary-hover: #014486;
    --chat-success: #2e844a;
    --chat-surface: #ffffff;
    --chat-surface-alt: #f3f6f9;
    --chat-border: #d8dde6;
    --chat-text: #181818;
    --chat-text-light: #706e6b;
    --chat-radius-small: 8px;
    --chat-radius-medium: 12px;
    --chat-radius-large: 18px;
    --chat-shadow-small: 0 1px 3px rgba(0,0,0,.08);
    --chat-shadow: 0 8px 32px rgba(0,0,0,.12);
    --chat-width: 420px;
    --chat-height: 720px;
    --chat-transition: .2s ease-in-out;
}

/* ==========================================================
   Global Chat Container
   ========================================================== */

.chat-container {
    font-family: "Salesforce Sans", "Segoe UI", Arial, sans-serif;
    color: var(--chat-text);
}

/* ==========================================================
   Launcher
   ========================================================== */

.chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: var(--chat-transition);
    z-index: 10000;
}

    .chat-launcher:hover {
        transform: scale(1.05);
        background: var(--chat-primary-hover);
    }

.launcher-icon {
    font-size: 24px;
}

.launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ea001e;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================
   Chat Window
   ========================================================== */

.chat-window {
    width: var(--chat-width);
    height: var(--chat-height);
    display: flex;
    flex-direction: column;
    background: var(--chat-surface);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--chat-shadow);
}

/* ==========================================================
   Header
   ========================================================== */

.chat-header {
    background: var(--chat-primary);
    color: white;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}

.assistant-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.assistant-name {
    font-size: 14px;
    font-weight: 600;
}

.assistant-status {
    font-size: 12px;
    opacity: .85;
}

/* ==========================================================
   Message Area
   ========================================================== */

.message-container {
    flex: 1;
    overflow-y: auto;
    background: var(--chat-surface-alt);
    padding: 16px;
}

/* ==========================================================
   Message Bubble
   ========================================================== */

.message-wrapper {
    display: flex;
    margin-bottom: 12px;
    gap: 8px;
}

    .message-wrapper.user {
        justify-content: flex-end;
    }

    .message-wrapper.assistant {
        justify-content: flex-start;
    }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--chat-radius-large);
    background: white;
    border: 1px solid var(--chat-border);
    box-shadow: var(--chat-shadow-small);
}

.user .bubble {
    background: var(--chat-primary);
    color: white;
    border: none;
}

.timestamp {
    margin-top: 6px;
    font-size: 11px;
    opacity: .7;
}

/* ==========================================================
   Suggested Actions
   ========================================================== */

.suggestion-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
}

.chip {
    border: 1px solid var(--chat-border);
    background: white;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--chat-transition);
}

    .chip:hover {
        background: var(--chat-primary);
        color: white;
    }

/* ==========================================================
   Input
   ========================================================== */

.chat-input {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid var(--chat-border);
    background: white;
}

    .chat-input textarea {
        flex: 1;
        resize: none;
        border: 1px solid var(--chat-border);
        border-radius: 12px;
        padding: 10px;
        font-family: inherit;
    }

.send-button {
    width: 44px;
    border: none;
    border-radius: 12px;
    background: var(--chat-primary);
    color: white;
    cursor: pointer;
    transition: var(--chat-transition);
}

    .send-button:hover {
        background: var(--chat-primary-hover);
    }

/* ==========================================================
   Survey Card
   ========================================================== */

.survey-card {
    background: white;
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--chat-shadow-small);
}

.survey-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
}

.survey-button {
    margin-top: 12px;
    border: none;
    background: var(--chat-primary);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.prompt-input {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    padding: 10px;
}

/* ==========================================================
   Typing Indicator
   ========================================================== */

.typing-container {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    width: fit-content;
    background: white;
    border: 1px solid var(--chat-border);
    border-radius: 16px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-primary);
    animation: pulse 1.2s infinite;
}

    .dot:nth-child(2) {
        animation-delay: .2s;
    }

    .dot:nth-child(3) {
        animation-delay: .4s;
    }

@keyframes pulse {
    0%,100% {
        transform: scale(.7);
        opacity: .5;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================
   Mobile
   ========================================================== */

@media (max-width: 768px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .chat-launcher {
        right: 16px;
        bottom: 16px;
    }
}
