/* --- chatbot.css --- */
:root {
    --lhg-blue: #004a98;
    --lhg-blue-dark: #003366;
    --lhg-red: #d6001c;
    --gradient-primary: linear-gradient(135deg, #004a98 0%, #0072ff 100%);
    --gradient-header: linear-gradient(135deg, #004a98 0%, #002a5c 100%);
    --gradient-user-bubble: linear-gradient(135deg, #004a98 0%, #0066cc 100%);
    --bg-color: #ffffff;
    --widget-bg: #ffffff;
    --msg-bg-user: var(--lhg-blue);
    --msg-text-user: #ffffff;
    --msg-bg-bot: #f3f4f6;
    --msg-text-bot: #1f2937;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --header-height: 80px;
}

/* --- CHAT LAUNCHER --- */
#chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: var(--lhg-blue);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 9998;
}

#chat-launcher:hover {
    transform: scale(1.05) translateY(-2px);
    background: var(--lhg-blue-dark);
    box-shadow: 0 12px 28px rgba(0, 74, 152, 0.3);
}

#chat-launcher svg {
    width: 32px;
    height: 32px;
    fill: white;
    transition: transform 0.3s ease;
}

/* --- CHAT WIDGET CONTAINER --- */
#chat-widget {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 140px);
    background: var(--widget-bg);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', 'Open Sans', sans-serif;
    /* Ensure font matches */
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- HEADER --- */
#chat-widget header {
    height: var(--header-height);
    background: var(--gradient-header);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.logo-container {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
    background: white;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-details h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.agent-details span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 4px;
}

.agent-details span::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
}

.header-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- CHAT AREA --- */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-color);
    visibility: hidden;
    scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* --- MESSAGES --- */
.msg-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 85%;
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-container.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-container.bot {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-bottom: 2px;
    box-shadow: var(--shadow-sm);
    background: white;
    object-fit: cover;
    border: 1px solid white;
}

.msg-avatar.user-avatar {
    background: transparent;
    border: none;
    box-shadow: none;
}

.msg-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.msg-bubble {
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
    max-width: 100%;
}

.msg-container.bot .msg-bubble {
    background: var(--msg-bg-bot);
    color: var(--msg-text-bot);
    border-bottom-left-radius: 4px;
}

.msg-container.bot .msg-bubble a {
    color: var(--lhg-blue);
}

.msg-container.user .msg-bubble {
    background: var(--gradient-user-bubble);
    color: var(--msg-text-user);
    border-bottom-right-radius: 4px;
}

.msg-timestamp {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 4px;
    padding: 0 4px;
}

.msg-container.user .msg-timestamp {
    text-align: right;
}

.system-msg {
    align-self: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.03);
    padding: 6px 12px;
    border-radius: 12px;
    margin: 8px 0;
    text-align: center;
}

/* --- INPUT AREA --- */
.input-area {
    padding: 20px;
    background: var(--widget-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
    visibility: hidden;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-area textarea {
    width: 100%;
    padding: 14px 20px;
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    outline: none;
    background: #f9fafb;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-area textarea:focus {
    border-color: var(--lhg-blue);
    background: white;
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05) translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.send-btn:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
    box-shadow: none;
}

.send-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
    margin-left: 2px;
}

/* --- QUICK REPLIES --- */
.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-left: 36px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.quick-reply-pill {
    background: white;
    border: 1px solid var(--lhg-blue);
    color: var(--lhg-blue);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.quick-reply-pill:hover {
    background: var(--lhg-blue);
    color: white;
    transform: translateY(-1px);
}

/* --- TYPING --- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

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

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

/* --- LOADER --- */
#chat-loader-overlay {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 74, 152, 0.1);
    border-radius: 50%;
    border-top-color: var(--lhg-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- CONFIRMATION --- */
.confirmation-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 20;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.confirmation-card {
    background: white;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-width: 280px;
}

.confirmation-card h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.confirmation-card p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn-danger {
    background: var(--lhg-red);
    color: white;
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
}

/* --- VIDEO --- */
.msg-video-embed {
    margin-top: 10px;
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    aspect-ratio: 16 / 9;
    background: #000;
}

.msg-video-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}