/* AI Chat Button */
    .ai-chat-btn {
        position: fixed;
        bottom: 80px;
        right: 30px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #3B82F6, #8B5CF6);
        border: none;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
        transition: all 0.3s;
        z-index: 100;
    }
    
    .ai-chat-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
    }
    
    /* Chat Overlay */
    .chat-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 200;
    }
    
    /* Chat Panel */
    .chat-panel {
        position: fixed;
        top: 0;
        right: 0;
        width: 400px;
        height: 100vh;
        background: white;
        border-left: 1px solid #E5E7EB;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 201;
        display: flex;
        flex-direction: column;
        animation: slideIn 0.3s ease;
        overflow: hidden;
    }
    
    @keyframes slideIn {
        from { transform: translateX(100%); }
        to { transform: translateX(0); }
    }
    
    @media (max-width: 480px) {
        .chat-panel { width: 100%; }
    }
    
    /* Chat Header */
    .chat-header {
        background: linear-gradient(90deg, #6A11CB 0%, #8A3FFC 40%, #C471ED 100%);
        color: white;
        padding: 15px;
        border-radius: 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        min-height: 120px;
        height: 120px;
        flex-shrink: 0;
    }
    
    .chat-header h5 {
        margin: 0;
        font-size: 1.1rem;
        margin-bottom: 0;
    }
    
    .header-actions {
        display: flex;
        gap: 10px;
        align-items: center;
    }
    
    .btn-expand,
    .btn-close {
        background: none;
        border: none;
        color: white;
        font-size: 20px;
        cursor: pointer;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background-color 0.2s;
    }
    
    .btn-expand {
        font-size: 18px;
    }
    
    .btn-expand:hover,
    .btn-close:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    .sparkle-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .sparkle-big {
        width: 18px;
        height: 18px;
    }
    
    .sparkle-small {
        position: absolute;
        top: -4px;
        left: 14px;
        width: 10px;
        height: 10px;
        opacity: 0.9;
    }
    
    /* Chat Tabs */
    .chat-tabs {
        display: flex;
        border-bottom: 1px solid #e0e0e0;
        background: white;
        flex-shrink: 0;
    }
    
    .chat-tab,
    .tab-button {
        flex: 1;
        padding: 12px 20px;
        border: none;
        background: none;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        color: #666;
        border-bottom: 2px solid transparent;
        transition: all 0.2s;
    }
    
    .chat-tab:hover,
    .tab-button:hover {
        background-color: #f5f5f5;
        color: #333;
    }
    
    .chat-tab.active,
    .tab-button.active {
        color: #6A11CB;
        border-bottom-color: #6A11CB;
        background-color: #fafafa;
    }
    
    .chat-tab-badge {
        display: none;
    }
    
    /* Chat Messages */
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 24px;
        background: #F9FAFB;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .chat-message {
        display: flex;
        gap: 12px;
    }
    
    .chat-message.user {
        flex-direction: row-reverse;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(90deg, #6A11CB 0%, #8A3FFC 40%, #C471ED 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .message-content {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-width: 80%;
    }
    
    .chat-message.user .message-content {
        align-items: flex-end;
    }
    
    .message-bubble {
        padding: 12px 16px;
        border-radius: 16px;
        font-size: 14px;
        line-height: 1.5;
        background: white;
        color: #374151;
        border: 1px solid #E5E7EB;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    
    .chat-message.ai .message-bubble {
        border-radius: 16px 16px 16px 4px;
    }
    
    .chat-message.user .message-bubble {
        background: linear-gradient(135deg, #3B82F6, #6366F1);
        color: white;
        border: none;
        border-radius: 16px 16px 4px 16px;
    }
    
    .typing-indicator {
        font-style: italic;
        color: #9CA3AF;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px 16px;
    }
    
    .quick-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .quick-action-btn {
        padding: 8px 14px;
        border: 1px solid #E0E7FF;
        border-radius: 20px;
        background: #EFF6FF;
        color: #3B82F6;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .quick-action-btn:hover {
        background: #DBEAFE;
        border-color: #BFDBFE;
    }
    
    .message-time {
        font-size: 11px;
        color: #9CA3AF;
        margin-left: 4px;
    }
    
    /* Chat Input */
    .chat-input-container {
        padding: 20px 24px;
        background: white;
        border-top: 1px solid #F3F4F6;
        flex-shrink: 0;
    }
    
    .chat-input-container form {
        display: flex;
        gap: 12px;
        align-items: center;
    }
    
    .chat-input {
        flex: 1;
        height: 48px;
        padding: 0 16px;
        border: 1px solid #E5E7EB;
        border-radius: 12px;
        font-size: 14px;
        background: #f1f1f1;
        transition: all 0.2s;
    }
    
    .chat-input:focus {
        outline: none;
        border-color: #3B82F6;
        background: #f1f1f1;
    }
    
    .chat-send-btn {
        width: 48px;
        height: 48px;
        border: none;
        border-radius: 50%;
        background: #3B82F6;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        flex-shrink: 0;
    }
    
    .chat-send-btn:hover:not(:disabled) {
        background: #2563EB;
        transform: scale(1.05);
    }
    
    .chat-send-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    
    /* Suggestions Placeholder */
    .suggestion-placeholder {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        text-align: center;
        color: #666;
    }
    
    .suggestion-placeholder p {
        margin: 10px 0;
    }
    
    .suggestion-placeholder .text-muted {
        font-size: 14px;
        color: #999;
    }
    
    /* Expanded Window Styles */
    .chat-window-expanded {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 400px;
        background: white;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
        z-index: 200;
        animation: slideIn 0.3s ease-out;
        width: calc(100vw - 400px);
    }
    
    @keyframes slideIn {
        from {
            transform: translateX(-100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
    
    .chat-header-expanded {
        background: linear-gradient(90deg, #6A11CB 0%, #8A3FFC 40%, #C471ED 100%);
        color: white;
        padding: 15px 30px;
        border-radius: 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        min-height: 120px;
        height: 120px;
        flex-shrink: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-header-expanded h5 {
        margin: 0;
        padding: 0;
        font-size: 1.1rem;
        margin-bottom: 0;
        color: white;
        display: flex;
        align-items: center;
    }
    
    .chat-header-expanded .sparkle-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
        color: white;
    }
    
    .chat-header-expanded .sparkle-big {
        width: 18px;
        height: 18px;
        fill: white;
    }
    
    .chat-header-expanded .sparkle-small {
        position: absolute;
        top: -4px;
        left: 14px;
        width: 10px;
        height: 10px;
        opacity: 0.9;
        fill: white;
    }
    
    .chat-header-expanded .header-actions {
        display: flex;
        gap: 10px;
        align-items: center;
    }
    
    .chat-header-expanded .btn-collapse {
        background: none !important;
        border: none;
        color: white;
        cursor: pointer;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background-color 0.2s;
    }
    
    .chat-header-expanded .btn-collapse:hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    .chat-body-expanded {
        flex: 1;
        overflow-y: auto;
        padding: 30px;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .chat-input-expanded {
        padding: 20px 30px;
        border-top: 1px solid #e0e0e0;
        display: flex;
        gap: 15px;
        flex-shrink: 0;
    }
    
    .chat-input-expanded .form-control {
        flex: 1;
        border: 1px solid #ddd;
        border-radius: 25px;
        padding: 12px 20px;
        font-size: 16px;
        background-color: #f1f1f1;
    }
    
    .chat-input-expanded .send-button {
        width: 50px;
        height: 50px;
    }
    
    .chat-input-expanded .send-button svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-collapse {
        background: none !important;
        border: none;
        color: white;
        cursor: pointer;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0;
        transition: opacity 0.2s;
    }
    
    .btn-collapse:hover {
        opacity: 0.8;
        background: none !important;
    }
    
    .btn-collapse svg {
        width: 20px;
        height: 20px;
        display: block;
    }
    
    .send-button {
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 50%;
        background: #2a11cb;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        transition: transform 0.2s, box-shadow 0.2s;
        padding: 0;
        cursor: pointer;
    }
    
    .send-button:hover:not(:disabled) {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }
    
    .send-button:active:not(:disabled) {
        transform: scale(0.95);
    }
    
    .send-button svg {
        width: 18px;
        height: 18px;
    }
    
    .form-control {
        border: 1px solid #ddd;
        border-radius: 20px;
        padding: 8px 15px;
        font-size: 14px;
        background-color: #f1f1f1;
        outline: none;
    }
    
    .form-control:focus {
        border-color: #6A11CB;
        background-color: white;
    }

    /* Scroll to Top Button - Match chat button positioning */
    .mud-scroll-to-top {
        right: 15px !important;
    }
    
    .mud-scroll-to-top .mud-fab {
        right: 15px !important;
    }

    /* Ensure chat header and panel look identical when opened from Index or AdminLayout */
    .admin-layout .chat-panel,
    .admin-layout .chat-window-expanded {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    }
    .admin-layout .chat-header,
    .admin-layout .chat-header-expanded {
        background: linear-gradient(90deg, #6A11CB 0%, #8A3FFC 40%, #C471ED 100%);
        color: white;
    }
    .admin-layout .chat-header h5,
    .admin-layout .chat-header-expanded h5 {
        color: white;
    }