/* Chatbot Styles - Redesigned Luminous Style */

.chatbot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 4000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4f46e5;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chatbot-fab:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.5);
    background: #4338ca;
}

.chatbot-fab:active {
    transform: scale(0.95);
}

.chatbot-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 620px; /* Taller for modern look */
    background: #fbfbfe;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.chatbot-panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.chatbot-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

@media (max-width: 480px) {
    .chatbot-panel {
        width: calc(100vw - 32px);
        right: -8px; /* account for right: 24px of parent */
        height: calc(100vh - 120px);
    }
}

.chatbot-header {
    padding: 24px 20px 16px;
    background: #fbfbfe;
    color: #4f46e5;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1e1b4b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-avatar .status-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    bottom: -2px;
    right: -2px;
    border: 2px solid #fbfbfe;
}

.chatbot-meta {
    flex: 1;
}

.chatbot-meta .title {
    font-weight: 700;
    font-size: 18px;
    margin: 0;
    letter-spacing: -0.01em;
}

.chatbot-meta .subtitle {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.6;
    margin: 2px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4b5563;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-icon-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #111827;
}

.chatbot-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.chatbot-date-divider {
    text-align: center;
    margin: 16px 0 8px;
    position: relative;
}

.chatbot-date-divider span {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    letter-spacing: 0.05em;
}

.chatbot-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff;
}

.chatbot-log::-webkit-scrollbar {
    width: 6px;
}

.chatbot-log::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-log::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}

.chatbot-log::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.chatbot-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
    animation: bounceIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.chatbot-msg.user {
    align-self: flex-end;
}

.chatbot-msg.bot {
    align-self: flex-start;
}

.chatbot-msg .msg-author {
    display: none;
}

.chatbot-msg .msg-text {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chatbot-msg.user .msg-text {
    background: #4f46e5;
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg.bot .msg-text {
    background: #e6e6f1;
    color: #1f2937;
    border-top-left-radius: 4px;
    border: none;
}

.chatbot-msg .msg-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
    padding: 0 6px;
}

.chatbot-msg.user .msg-time {
    align-self: flex-end;
}

.chatbot-msg.bot .msg-time {
    align-self: flex-start;
}

.chatbot-msg .msg-sources {
    max-width: 100%;
    margin-top: 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border-left: 3px solid #4f46e5;
    border-radius: 8px;
    font-size: 12px;
}

.chatbot-msg .msg-sources small strong {
    color: #4f46e5;
}

.chatbot-msg .msg-sources ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 0 0;
}

.chatbot-msg .msg-sources li {
    margin: 4px 0;
    color: #4b5563;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 16px;
    justify-content: center;
    background: #ffffff;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

.suggestion-chip {
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.suggestion-chip:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.suggestion-chip:active {
    transform: translateY(0);
}

.chatbot-input-area {
    padding: 16px 20px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 6px 6px 6px 16px;
    gap: 8px;
    transition: all 0.3s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: white;
}

.action-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
    flex-shrink: 0;
}

.action-btn:hover {
    color: #4f46e5;
}

.chatbot-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #334155;
    outline: none;
    padding: 8px 0;
    font-family: inherit;
}

.chatbot-input-wrapper input::placeholder {
    color: #94a3b8;
}

.chatbot-input-wrapper button[type="button"]:not(.action-btn) {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-input-wrapper button[type="button"]:not(.action-btn):hover:not(:disabled) {
    background: #4338ca;
    transform: scale(1.05);
}

.chatbot-input-wrapper button[type="button"]:not(.action-btn):active:not(:disabled) {
    transform: scale(0.95);
}

.chatbot-input-wrapper button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.chatbot-input-wrapper button.loading {
    animation: spin 1s linear infinite;
    background: #9ca3af;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .chatbot-launcher {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        right: -8px; 
    }

    .chatbot-msg .msg-text,
    .chatbot-msg .msg-sources {
        max-width: 95%;
    }
}
