:root {
    --purple-gradient-from: #8b5cf6;
    --purple-gradient-to: #9333ea;
    --text-gray-900: #111827;
    --text-gray-700: #374151;
    --text-gray-600: #4b5563;
    --text-gray-500: #6b7280;
    --text-gray-400: #9ca3af;
    --text-gray-300: #d1d5db;
    --bg-gray-50: #f9fafb;
    --bg-gray-100: #f3f4f6;
    --border-gray-100: #f3f4f6;
    --border-gray-200: #e5e7eb;
    --placeholder-color: #a2a9b7;
    --subtext-color: #8792a4;
}

/* All styles wrapped in .ai-bot parent class */
.ai-bot .modal-dialog {
    max-width: 1080px;
    margin: 1.75rem auto;
}

.ai-bot .modal-content {
    border-radius: 24px;
    border: none;
    box-shadow: 0px 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    background: white;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

.ai-bot .modal-header {
    border: none;
    position: relative;
    padding: 0;
    flex-shrink: 0;
}

.ai-bot .btn-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    background: white;
    opacity: 1;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-bot .modal-body {
    padding: 32px 32px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Initial State Styles */
.ai-bot .initial-state {
    display: block;
}

.ai-bot .conversation-state {
    display: none;
    flex-direction: column;
    height: 100%;
}

.ai-bot .logo-container {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0px 0px 8px 11px rgba(139, 92, 246, 0.2);
}

.ai-bot .logo-container.small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin: 0;
    box-shadow: 0px 0px 4px 4px rgba(139, 92, 246, 0.15);
}

.ai-bot .logo-icon {
    width: 36px;
    height: 36px;
    color: white;
}

.ai-bot .logo-icon.small {
    width: 18px;
    height: 18px;
}

.ai-bot .brand-title {
    font-size: 29px;
    font-weight: 700;
    color: var(--text-gray-900);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.ai-bot .subtitle {
    font-size: 15.5px;
    font-weight: 500;
    color: var(--text-gray-500);
    margin-bottom: 6px;
}

.ai-bot .description {
    font-size: 14px;
    color: var(--subtext-color);
    line-height: 1.6;
    margin-bottom: 52px;
}


.ai-bot .quick-questions-section {
    margin-bottom: 32px;
}

.ai-bot .section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.35px;
    margin-bottom: 16px;
}

.ai-bot .question-btn {
    background: var(--bg-gray-50);
    border: none;
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 13.7px;
    font-weight: 500;
    color: var(--text-gray-700);
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    display: inline-block;
    margin-bottom: 16px;
}

.ai-bot .question-btn:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ai-bot .divider {
    height: 1px;
    background: var(--border-gray-100);
    margin: 0 -32px 25px;
}

/* Conversation Header */
.ai-bot .conversation-header {
    display: flex;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-gray-100);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.ai-bot .conversation-header .brand-info {
    margin-left: 12px;
}

.ai-bot .conversation-header .brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-gray-900);
    margin: 0;
}

.ai-bot .conversation-header .brand-status {
    font-size: 12px;
    color: var(--text-gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-bot .status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* Chat Messages Area */
.ai-bot .chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0;
    margin: 0 -16px;
    padding: 0 16px;
}

.ai-bot .message {
    margin-bottom: 20px;
    display: flex;
    animation: slideIn 0.3s ease;
}

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

.ai-bot .message.user {
    justify-content: flex-end;
}

.ai-bot .message.assistant {
    justify-content: flex-start;
}

.ai-bot .message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

/* Compact table for chat bubble */
.ai-bot .message-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border-radius: 8px;
    overflow: hidden;
}

/* Header - subtle style */
.ai-bot .message-content th {
    background-color: #f6f8fa;
    color: #24292e;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #e1e4e8;
}

/* Cells - compact padding */
.ai-bot .message-content td {
    padding: 6px 12px;
    color: #24292e;
    border-bottom: 1px solid #e1e4e8;
}

/* Remove last border */
.ai-bot .message-content tr:last-child td {
    border-bottom: none;
}

/* Light alternating rows */
.ai-bot .message-content tr:nth-child(even) td {
    background-color: #f9fafb;
}

/* Optional: Make first column slightly bold */
.ai-bot .message-content td:first-child {
    font-weight: 500;
    color: #586069;
}

/* Ensure text doesn't overflow */
.ai-bot .message-content td, .ai-bot .message-content th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* For numeric data - right align */
.ai-bot .message-content td.numeric, .ai-bot .message-content th.numeric {
    text-align: right;
}

.ai-bot .message.user .message-content {
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-bot .message.assistant .message-content {
    background: var(--bg-gray-50);
    color: var(--text-gray-700);
    border-bottom-left-radius: 4px;
}

.ai-bot .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-bot .message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
}

.ai-bot .typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.ai-bot .typing-indicator.show {
    display: flex;
}

.ai-bot .typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-gray-400);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.ai-bot .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input Section */
.ai-bot .input-section {
    margin: 0 auto;
    width: 100%;
    padding-top: 16px;
    border-top: 1px solid var(--border-gray-100);
    flex-shrink: 0;
}

.ai-bot .input-section.initial {
    max-width: 768px;
    margin: 0 auto;
    border-top: none;
    padding-top: 0;
}

.ai-bot .input-container {
    position: relative;
    margin-bottom: 12px;
}

.ai-bot .message-input {
    width: 100%;
    min-height: 80px;
    padding: 16px 96px 40px 24px;
    background: var(--bg-gray-50);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    resize: none;
    font-size: 15.375px;
    font-family: 'Nunito', sans-serif;
    color: var(--text-gray-700);
    transition: all 0.2s ease;
}

.ai-bot .conversation-state .message-input {
    min-height: 60px;
    padding: 12px 48px 12px 16px;
}

.ai-bot .message-input::placeholder {
    color: var(--placeholder-color);
}

.ai-bot .message-input:focus {
    outline: none;
    border-color: var(--purple-gradient-from);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ai-bot .send-button {
    position: absolute;
    bottom: 16px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--text-gray-300), var(--text-gray-400));
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.ai-bot .conversation-state .send-button {
    bottom: 14px;
}

.ai-bot .send-button:hover {
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
    transform: scale(1.05);
}

.ai-bot .send-button.active {
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
}

.ai-bot .send-icon {
    width: 16px;
    height: 16px;
    color: white;
}

.ai-bot .powered-by {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 11.8px;
    color: var(--text-gray-400);
    text-align: center;
}

.ai-bot .suggested-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ai-bot .suggested-action {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-gray-200);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-bot .suggested-action:hover {
    background: var(--bg-gray-50);
    border-color: var(--purple-gradient-from);
    color: var(--purple-gradient-from);
}

/* Floating Action Button */
.ai-bot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
    border-radius: 20px;
    box-shadow: 0px 4px 12px rgba(139, 92, 246, 0.3), 0px 8px 24px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-bot-fab:hover {
    transform: scale(1.05);
    box-shadow: 0px 6px 16px rgba(139, 92, 246, 0.4), 0px 12px 32px rgba(0, 0, 0, 0.2);
}

.ai-bot-fab:active {
    transform: scale(0.95);
}

.ai-bot-fab-icon {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.ai-bot-fab:hover .ai-bot-fab-icon {
    transform: rotate(10deg) scale(1.1);
}

/* Pulse animation for attention */
.ai-bot-fab::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple-gradient-from), var(--purple-gradient-to));
    border-radius: 20px;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
    z-index: -1;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Notification dot */
.ai-bot-fab-notification {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    display: none;
}

.ai-bot-fab-notification.active {
    display: block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Hide FAB when modal is open */
.ai-bot-fab.hide {
    transform: scale(0) rotate(180deg);
    opacity: 0;
    pointer-events: none;
}

/* Tooltip for FAB */
.ai-bot-fab-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(31, 41, 55, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-bot-fab:hover .ai-bot-fab-tooltip {
    opacity: 1;
}

.ai-bot-fab-tooltip::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid rgba(31, 41, 55, 0.95);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-bot .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .ai-bot .modal-body {
        padding: 40px 20px 20px;
    }

    .ai-bot .question-btn {
        font-size: 12px;
        padding: 12px 14px;
    }

    .ai-bot .message-content {
        max-width: 85%;
    }

    .ai-bot-fab {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .ai-bot-fab-icon {
        width: 24px;
        height: 24px;
    }

    .ai-bot-fab-tooltip {
        display: none;
    }
}