/* AI Chat Widget - Premium Glassmorphism Styles */

.ai-chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd 0%, #00d2ff 100%);
    box-shadow: 0 10px 25px rgba(13, 110, 253, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.ai-chat-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px rgba(13, 110, 253, 0.6);
}

.ai-chat-launcher i {
    color: white;
    font-size: 24px;
}

.ai-chat-launcher .notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #ffc107;
    border: 2px solid white;
    border-radius: 50%;
}

/* Chat Container */
.ai-chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 480px;
    height: 520px;
    /* Reduced from 600px */
    background: rgba(26, 28, 32, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ai-chat-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.ai-chat-header {
    padding: 10px 15px;
    /* Reduced padding */
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.15) 0%, rgba(0, 210, 255, 0.15) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    background: rgba(13, 110, 253, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00d2ff;
    border: 1px solid rgba(0, 210, 255, 0.3);
}

.bot-name {
    font-size: 14px;
    /* Reduced from default h6 */
    margin: 0;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.bot-status {
    font-size: 11px;
    color: #00d2ff;
    display: flex;
    align-items: center;
    gap: 5px;
}

.bot-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #00d2ff;
    border-radius: 50%;
    display: block;
    box-shadow: 0 0 5px #00d2ff;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    width: 28px;
    /* Slightly smaller */
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

/* User Friendly Maximize Button */
#maximizeChat {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.2);
    color: #0d6efd;
}

#maximizeChat:hover {
    background: #0d6efd;
    color: white;
    transform: scale(1.1);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

.header-btn.close-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ff4d5e;
}

/* Maximized State */
.ai-chat-container.maximized {
    width: 90%;
    height: 85vh;
    bottom: 5vh;
    right: 5%;
}

@media (max-width: 992px) {
    .ai-chat-container.maximized {
        width: 95vw;
        height: 90vh;
        right: 2.5vw;
        bottom: 5vh;
    }
}

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message {
    max-width: 92%;
    /* Increased from 85% */
    padding: 14px 18px;
    border-radius: 15px;
    font-size: 14.5px;
    line-height: 1.6;
    position: relative;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

/* Table Styles inside message */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.message table {
    width: 100%;
    min-width: 600px;
    /* Force minimum width to trigger scrolling on small containers */
    border-collapse: collapse;
    font-size: 13px;
    background: transparent;
}

.message th,
.message td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.message th {
    background: rgba(13, 110, 253, 0.2);
    color: #00d2ff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.message tr:last-child td {
    border-bottom: none;
}

.message tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: #0d6efd;
    color: white;
    border-bottom-right-radius: 2px;
}

/* Input Area */
.ai-chat-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-chat-input-wrapper {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 10px;
    align-items: flex-end;
    /* Align bottom for multi-line */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 8px 5px;
    font-size: 14px;
    resize: none;
    height: 24px;
    /* Initial height single line */
    max-height: 100px;
    font-family: inherit;
    line-height: 1.5;
    overflow-y: hidden;
}

.ai-chat-input-wrapper textarea:focus {
    outline: none;
}

.send-ai-message {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #0d6efd;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.send-ai-message:hover {
    background: #0b5ed7;
    transform: scale(1.05);
}

/* Login Prompt */
.ai-chat-login-prompt {
    padding: 40px 20px;
    text-align: center;
    background: rgba(13, 110, 253, 0.05);
    border-radius: 15px;
    margin: 10px;
    border: 1px dashed rgba(13, 110, 253, 0.3);
}

.ai-chat-login-prompt i {
    font-size: 40px;
    color: #0d6efd;
    margin-bottom: 20px;
}

.ai-chat-login-prompt h5 {
    color: white;
    margin-bottom: 10px;
}

.ai-chat-login-prompt p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 25px;
}

.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #444;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.google-login-btn:hover {
    background: #f1f1f1;
    transform: translateY(-2px);
}

.google-login-btn img {
    width: 18px;
    margin-right: 10px;
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    align-self: flex-start;
    display: none;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: rgba(255, 255, 255, 0.3);
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-of-type(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-of-type(2) {
    animation-delay: 0.33s;
}

.typing-indicator span:nth-of-type(3) {
    animation-delay: 0.66s;
}

@keyframes typing {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }

    33% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0.4;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-container {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 90px;
        height: 70vh;
    }

    .ai-chat-launcher {
        bottom: 20px;
        right: 20px;
    }
}