/* Mini Chat Button - Floating at bottom right */
        .mini-chat-button {
            position: fixed;
            bottom: 80px;
            right: 20px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            z-index: 9998;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .mini-chat-button:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        }

        .mini-chat-button {
    background: 
        url("resources/images/bot.svg") center / 28px 28px no-repeat,
        linear-gradient(135deg, #667eea, #764ba2);

    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

        /* Mini Chat Container */
        .mini-chat-container {
            position: fixed;
            bottom: 90px;
            right: 20px;
            width: 480px;
            height: 600px;
            min-width: 420px;
            max-width: 800px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            z-index: 9999;
            display: none;
            flex-direction: column;
            overflow: hidden;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            resize: horizontal;
        }
        
        .mini-chat-container > * {
            position: relative;
        }

        .mini-chat-container.active {
            display: flex;
            animation: slideUp 0.3s ease;
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Resize Handle */
        .mini-chat-resize-handle {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 2px;
            cursor: ew-resize;
            z-index: 10;
            background: transparent;
            transition: background 0.2s;
        }

        .mini-chat-resize-handle:hover {
            background: rgba(102, 126, 234, 0.2);
        }

        .mini-chat-resize-handle::before {
            content: '';
            position: absolute;
            left: 2px;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 50px;
            background: rgba(102, 126, 234, 0.5);
            border-radius: 2px;
            opacity: 0.6;
            transition: opacity 0.2s;
        }

        .mini-chat-resize-handle:hover::before {
            opacity: 1;
            background: rgba(102, 126, 234, 0.8);
        }

        .mini-chat-container.resizing {
            user-select: none;
        }

        /* Chat Header */
        .mini-chat-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 16px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .mini-chat-header h3 {
            margin: 0;
            font-size: 18px;
            font-weight: 600;
        }

        .mini-chat-header-controls {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .mini-chat-control-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s;
        }

        .mini-chat-control-btn:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .mini-chat-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            font-size: 28px;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
            transition: background 0.2s;
        }

        .mini-chat-close:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        /* Messages Area */
        .mini-chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            background: #f7f9fc;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .mini-chat-messages::-webkit-scrollbar {
            width: 6px;
        }

        .mini-chat-messages::-webkit-scrollbar-track {
            background: transparent;
        }

        .mini-chat-messages::-webkit-scrollbar-thumb {
            background: #cbd5e0;
            border-radius: 3px;
        }

        /* Message Bubbles */
        .mini-chat-message {
            max-width: 80%;
            padding: 10px 14px;
            border-radius: 12px;
            line-height: 1.5;
            font-size: 14px;
            word-wrap: break-word;
            animation: messageSlide 0.3s ease;
        }

        @keyframes messageSlide {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .mini-chat-message.user {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            align-self: flex-end;
            border-bottom-right-radius: 4px;
        }

        .mini-chat-message.ai {
            background: white;
            color: #2d3748;
            align-self: flex-start;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        /* Processing Animation */
        .mini-chat-processing {
            align-self: flex-start;
            background: white;
            padding: 12px 16px;
            border-radius: 12px;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            display: flex;
            gap: 6px;
        }

        .mini-chat-processing-dot {
            width: 8px;
            height: 8px;
            background: #667eea;
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out both;
        }

        .mini-chat-processing-dot:nth-child(1) {
            animation-delay: -0.32s;
        }

        .mini-chat-processing-dot:nth-child(2) {
            animation-delay: -0.16s;
        }

        @keyframes bounce {
            0%, 80%, 100% {
                transform: scale(0);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* Input Area */
        .mini-chat-input-area {
            padding: 12px 16px 8px 16px;
            background: white;
            border-top: 1px solid #e2e8f0;
        }

        .mini-chat-input-wrapper {
            display: flex;
            gap: 8px;
            align-items: flex-end;
        }

        .mini-chat-input {
            flex: 1;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            padding: 10px 12px;
            font-size: 14px;
            font-family: inherit;
            resize: none;
            max-height: 100px;
            min-height: 40px;
            transition: border-color 0.2s;
        }

        .mini-chat-input:focus {
            outline: none;
            border-color: #667eea;
        }

        /* Disclaimer Message */
        .mini-chat-disclaimer {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-top: 8px;
            padding: 6px 8px;
            font-size: 11px;
            color: #6b7280;
            background: #f9fafb;
            border-radius: 6px;
            line-height: 1.4;
        }

        .mini-chat-disclaimer svg {
            flex-shrink: 0;
            color: #9ca3af;
            margin-top: 1px;
        }

        .mini-chat-send {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            width: 40px;
            height: 40px;
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all 0.2s;
        }

        .mini-chat-send:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .mini-chat-send:not(:disabled):hover {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        /* Quick Actions */
        .mini-chat-quick-actions {
            display: flex;
            gap: 8px;
            padding: 0 16px 12px;
            overflow-x: auto;
            background: white;
        }

        .mini-chat-quick-actions::-webkit-scrollbar {
            height: 4px;
        }

        .mini-chat-quick-actions::-webkit-scrollbar-thumb {
            background: #cbd5e0;
            border-radius: 2px;
        }

        .mini-chat-quick-action {
            background: #f7f9fc;
            border: 1px solid #e2e8f0;
            padding: 8px 14px;
            border-radius: 20px;
            font-size: 13px;
            color: #4a5568;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .mini-chat-quick-action:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        /* Responsive Design */
        @media (max-width: 480px) {
            .mini-chat-container {
                width: calc(100vw - 40px);
                height: calc(100vh - 140px);
                bottom: 90px;
                right: 20px;
                left: 20px;
            }
        }

        /* Message Text Container */
        .message-text {
            line-height: 1.6;
        }

        /* Markdown Styling in Messages */
        .message-text h1 {
            font-size: 20px;
            font-weight: 700;
            margin: 0 0 12px 0;
            color: #1a202c;
        }

        .message-text h2 {
            font-size: 18px;
            font-weight: 600;
            margin: 12px 0 10px 0;
            color: #2d3748;
        }

        .message-text h3 {
            font-size: 16px;
            font-weight: 600;
            margin: 10px 0 8px 0;
            color: #2d3748;
        }

        .message-text h4,
        .message-text h5,
        .message-text h6 {
            font-size: 14px;
            font-weight: 600;
            margin: 8px 0 6px 0;
            color: #4a5568;
        }

        .message-text p {
            margin: 0 0 10px 0;
            color: #2d3748;
        }

        .message-text p:last-child {
            margin-bottom: 0;
        }

        .message-text strong {
            font-weight: 600;
            color: #1a202c;
        }

        .message-text em {
            font-style: italic;
        }

        .message-text code {
            background: #f1f5f9;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 13px;
            font-family: 'Courier New', monospace;
            color: #d63384;
        }

        .message-text pre {
            background: #1e293b;
            color: #e2e8f0;
            padding: 12px;
            border-radius: 6px;
            overflow-x: auto;
            margin: 10px 0;
        }

        .message-text pre code {
            background: transparent;
            padding: 0;
            color: inherit;
        }

        .message-text ul,
        .message-text ol {
            margin: 10px 0;
            padding-left: 24px;
        }

        .message-text ul {
            list-style-type: disc;
        }

        .message-text ol {
            list-style-type: decimal;
        }

        .message-text li {
            margin: 6px 0;
            color: #2d3748;
        }

        .message-text li p {
            margin: 4px 0;
        }

        .message-text blockquote {
            border-left: 4px solid #667eea;
            padding-left: 12px;
            margin: 10px 0;
            color: #4a5568;
            font-style: italic;
        }

        .message-text a {
            color: #667eea;
            text-decoration: none;
            transition: all 0.2s;
            display: inline-block;
            margin: 0;
        }

        .message-text a:hover {
            color: #5568d3;
            text-decoration: underline;
            text-underline-offset: 2px;
        }
        
        /* Ensure links after "Source URL:" text display on separate lines */
        .message-text p:has(a) {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .message-text hr {
            border: none;
            border-top: 1px solid #e2e8f0;
            margin: 12px 0;
        }

        .message-text table {
            width: 100%;
            border-collapse: collapse;
            margin: 10px 0;
            font-size: 13px;
        }

        .message-text table th,
        .message-text table td {
            padding: 8px;
            border: 1px solid #e2e8f0;
            text-align: left;
        }

        .message-text table th {
            background: #f7f9fc;
            font-weight: 600;
            color: #2d3748;
        }

        .message-text img {
            max-width: 100%;
            height: auto;
            border-radius: 6px;
            margin: 10px 0;
        }

        /* Consent Modal Overlay Styles */
        .sf-chatmodal {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
            border-radius: 16px;
            overflow: hidden;
        }
        
        .sf-chatmodal::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(3px);
            -webkit-backdrop-filter: blur(4px);
            z-index: -1;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }

        @keyframes fadeOut {
            from {
                opacity: 1;
            }
            to {
                opacity: 0;
            }
        }

        .sf-chatmodal-overlay {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            padding: 30px;
        }

        .sf-chatmodal-body {
            background: white;
            border-radius: 16px;
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
            max-width: 400px;
            width: 100%;
            animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            transform: translateY(0);
            position: relative;
            z-index: 1;
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(30px) scale(0.95);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .sf-chatmodal-content {
            padding: 32px 24px;
        }

        .sf-chatmodal-content > div {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .sf-chatmodal-title {
            color: #667eea;
            margin-bottom: 16px;
            font-weight: 700;
            font-size: 20px;
            line-height: 1.3;
            text-align: center;
        }

        .sf-chatmodal-description {
            margin-bottom: 20px;
            font-size: 14px;
            color: #6b7280;
            line-height: 1.6;
            text-align: center;
        }

        .sf-chatmodal-checkbox-wrapper {
            display: flex;
            align-items: flex-start;
            margin-bottom: 24px;
            gap: 12px;
            width: 100%;
            padding: 14px;
            background: #f9fafb;
            border-radius: 10px;
            border: 2px solid transparent;
            transition: all 0.2s ease;
        }

        .sf-chatmodal-checkbox-wrapper:hover {
            background: #f3f4f6;
            border-color: #e5e7eb;
        }

        #sf-rbl-tnc-checkbox {
            cursor: pointer;
            width: 20px;
            height: 20px;
            min-width: 20px;
            margin-top: 2px;
            accent-color: #667eea;
        }

        .sf-chatmodal-checkbox-wrapper label {
            cursor: pointer;
            flex: 1;
        }

        .label-text {
            text-align: left;
            font-size: 14px;
            color: #374151;
            line-height: 1.6;
        }

        .sf-chatmodal-btn {
            color: #ffffff;
            padding: 12px 28px;
            border: none;
            border-radius: 10px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            font-size: 15px;
            font-weight: 600;
            width: 100%;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .sf-chatmodal-btn:not(:disabled):hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
        }

        .sf-chatmodal-btn:not(:disabled):active {
            transform: translateY(0);
        }

        .sf-chatmodal-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            box-shadow: none;
        }

        /* Apply blur to chat content behind the modal */
        .mini-chat-container.blurred .mini-chat-header,
        .mini-chat-container.blurred .mini-chat-messages,
        .mini-chat-container.blurred .mini-chat-input-area,
        .mini-chat-container.blurred .mini-chat-quick-actions {
            filter: blur(3px);
            pointer-events: none;
        }

        /* Responsive adjustments for consent modal */
        @media (max-width: 480px) {
            .sf-chatmodal-content {
                padding: 32px 24px;
            }

            .sf-chatmodal-title {
                font-size: 20px;
            }

            .sf-chatmodal-description {
                font-size: 14px;
            }
        }

        .mini-chat-feedback-container {
            display: flex;
            gap: 4px;
            margin-top: 8px;
            padding: 4px 0;
            position: relative;
            z-index: 1;
        }


        .mini-chat-feedback-btn {
            background: none;
            border: none;
            cursor: pointer;
            padding: 4px 4px;
            border-radius: 4px;
            transition: all 0.2s;
            color: #64748b;
            display: flex;
            align-items: center;
            justify-content: center;
            pointer-events: auto;
            position: relative;
        }

        /* Feedback Dialog Styles */
        .mini-chat-feedback-dialog {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: #ffffff;
            border-top: 1px solid #e5e7eb;
            box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12), 0 -2px 4px rgba(0, 0, 0, 0.08);
            z-index: 10001;
            opacity: 0;
            transform: translateY(100%);
            transition: opacity 0.3s ease, transform 0.3s ease;
            pointer-events: none;
        }

        .mini-chat-feedback-dialog-show {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }

        .mini-chat-feedback-dialog-closing {
            opacity: 0;
            transform: translateY(100%);
        }

        /* Remove the arrow since dialog is at the bottom now */
        .mini-chat-feedback-dialog::before {
            display: none;
        }

        /* Update z-index for input area to be below dialog */
        .mini-chat-input-area {
            position: relative;
            z-index: 10000;
        }

        /* Responsive feedback dialog */
        @media (max-width: 480px) {
            .mini-chat-feedback-dialog {
                left: 0;
                right: 0;
            }
        }