/* AI Chat Widget - Glassmorphism Design */
:root {
    --chat-primary: #0056b3; /* Matching SSAHE Blue roughly */
    --chat-secondary: #00a8e8;
    --chat-bg-glass: rgba(255, 255, 255, 0.85);
    --chat-border: rgba(255, 255, 255, 0.5);
    --chat-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --chat-text: #1f2937;
    --chat-text-light: #6b7280;
}

/* Floating Action Button */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chat-widget-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.chat-widget-btn ion-icon {
    font-size: 30px;
    color: white;
    transition: transform 0.3s ease;
}

.chat-widget-btn.active ion-icon {
    transform: rotate(45deg); /* Turn message icon to close X roughly, or better switch icons in JS */
}

/* Chat Container */
.chat-widget-container {
    padding: 0;
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    border-radius: 20px;
    background: var(--chat-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--chat-border);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.chat-widget-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    padding: 20px;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-status {
    font-size: 0.8rem;
    opacity: 0.9;
    display: block;
    margin-top: 4px;
}

/* Chat Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

/* Messages */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: messageIn 0.3s ease forwards;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot {
    background: white;
    color: var(--chat-text);
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    align-self: flex-start;
}

.message.user {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: white;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.2);
}

.typing-indicator {
    padding: 15px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    width: fit-content;
    display: none; /* Hidden by default */
}

.dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Footer */
.chat-footer {
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 25px;
    background: white;
    outline: none;
    font-family: inherit;
    transition: box-shadow 0.2s;
}

.chat-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.2);
}

.send-btn {
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}
