/* Professional Opti Chatbot Styles */
.opti-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto;
}

/* Modern Floating Chat Button */
.opti-chat-button {
    position: relative;
    width: 56px;
    height: 56px;
    background: #0078FF;
    border-radius: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 120, 255, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
}

.opti-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 120, 255, 0.35), 0 3px 8px rgba(0, 0, 0, 0.15);
}

.opti-chat-button:active {
    transform: translateY(0);
}

.opti-chat-button.opti-active {
    background: #1A1A1A;
}

/* Professional Icon */
.opti-chat-icon {
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.opti-chat-button:not(.opti-active) .opti-chat-icon {
    fill: white;
}

.opti-chat-button.opti-active .opti-chat-icon {
    transform: rotate(45deg);
    fill: white;
}

/* Clean Message Icon */
.opti-message-icon {
    width: 100%;
    height: 100%;
}

/* Close Icon */
.opti-close-icon {
    width: 100%;
    height: 100%;
    display: none;
}

.opti-chat-button.opti-active .opti-message-icon {
    display: none;
}

.opti-chat-button.opti-active .opti-close-icon {
    display: block;
}

/* Notification Badge */
.opti-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    background: #FF4757;
    border-radius: 10px;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    padding: 0 6px;
    animation: optiBadgePopIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: none;
}

.opti-notification-badge.opti-show {
    display: flex;
}

/* Professional Chat Widget */
.opti-chat-widget {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #E5E7EB;
    display: none;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px) scale(0.98);
    opacity: 0;
    overflow: hidden;
    z-index: 999998;
}

.opti-chat-widget.opti-show {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Professional Chat Header */
.opti-chat-header {
    background: linear-gradient(135deg, #0078FF 0%, #0066DD 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.opti-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.opti-header-logo {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.opti-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opti-header-title {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.opti-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.opti-status-dot {
    width: 6px;
    height: 6px;
    background: #00FF88;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.opti-header-actions {
    display: flex;
    gap: 8px;
}

.opti-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.opti-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Clean Chat Messages Area */
.opti-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FAFBFC;
}

/* Scrollbar Styling */
.opti-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.opti-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.opti-chat-messages::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.opti-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Professional Message Bubbles */
.opti-message {
    display: flex;
    gap: 12px;
    animation: optiMessageSlideIn 0.3s ease;
}

.opti-message-user {
    flex-direction: row-reverse;
}

.opti-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.opti-bot-avatar {
    background: linear-gradient(135deg, #0078FF 0%, #0066DD 100%);
    color: white;
}

.opti-user-avatar {
    background: #E5E7EB;
    color: #4B5563;
}

.opti-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.opti-message-opti .opti-message-content {
    background: white;
    color: #1F2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 4px;
}

.opti-message-user .opti-message-content {
    background: #0078FF;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Professional Typing Indicator */
.opti-typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.opti-typing-indicator.opti-show {
    display: flex;
    opacity: 1;
}

.opti-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.opti-typing-dots span {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: optiTyping 1.4s infinite ease-in-out;
}

.opti-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.opti-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Clean Input Area */
.opti-chat-input-container {
    padding: 16px 20px 20px;
    background: white;
    border-top: 1px solid #E5E7EB;
    border-radius: 0 0 16px 16px;
}

.opti-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #F3F4F6;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: all 0.2s ease;
}

.opti-input-wrapper:focus-within {
    background: #E5E7EB;
}

#opti-chat-input {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #1F2937;
}

#opti-chat-input::placeholder {
    color: #9CA3AF;
}

.opti-input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.opti-attach-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.opti-attach-btn:hover {
    color: #4B5563;
    background: rgba(0, 0, 0, 0.05);
}

.opti-send-btn {
    width: 36px;
    height: 36px;
    background: #0078FF;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.opti-send-btn:hover {
    background: #0066DD;
    transform: scale(1.05);
}

.opti-send-btn:active {
    transform: scale(0.95);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes optiBadgePopIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes optiMessageSlideIn {
    0% { 
        opacity: 0;
        transform: translateY(10px);
    }
    100% { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes optiTyping {
    0%, 60%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Dark Mode Support */
body.dark-mode .opti-chat-widget {
    background: #1F2937;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.dark-mode .opti-chat-messages {
    background: #111827;
}

body.dark-mode .opti-message-opti .opti-message-content {
    background: #374151;
    color: #F3F4F6;
    box-shadow: none;
}

body.dark-mode .opti-chat-input-container {
    background: #1F2937;
    border-top-color: #374151;
}

body.dark-mode .opti-input-wrapper {
    background: #374151;
}

body.dark-mode .opti-input-wrapper:focus-within {
    background: #4B5563;
}

body.dark-mode #opti-chat-input {
    color: #F3F4F6;
}

body.dark-mode #opti-chat-input::placeholder {
    color: #6B7280;
}

body.dark-mode .opti-attach-btn {
    color: #9CA3AF;
}

body.dark-mode .opti-attach-btn:hover {
    color: #D1D5DB;
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .opti-typing-dots {
    background: #374151;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .opti-chatbot {
        bottom: 16px;
        right: 16px;
    }
    
    .opti-chat-widget {
        width: calc(100vw - 32px);
        max-width: 360px;
        height: 70vh;
        max-height: 600px;
        bottom: 68px;
    }
    
    .opti-chat-button {
        width: 52px;
        height: 52px;
    }
}

/* Tablet Responsiveness */
@media (min-width: 769px) and (max-width: 1024px) {
    .opti-chat-widget {
        width: 360px;
        height: 550px;
    }
}

/* Smooth Transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}