/* Smart Chat Assistant - Frontend Styles - Modern Design */

/* Widget Container */
.smart-chat-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.smart-chat-widget.bottom-right {
    bottom: 24px;
    right: 24px;
}

.smart-chat-widget.bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Chat Bubble Button */
.smart-chat-bubble {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.smart-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.5s ease;
}

.smart-chat-bubble:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16), 0 6px 12px rgba(0, 0, 0, 0.12);
}

.smart-chat-bubble:hover::before {
    transform: scale(1);
}

.smart-chat-bubble:active {
    transform: scale(0.95);
}

.smart-chat-bubble svg {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Pulse Animation */
@keyframes bubblePulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35), 0 4px 8px rgba(99, 102, 241, 0.25);
    }
}

.smart-chat-bubble {
    animation: bubblePulse 3s ease-in-out infinite;
}

/* Chat Window Container */
.smart-chat-window {
    position: fixed;
    width: 400px;
    height: 640px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: windowSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.smart-chat-widget.bottom-right .smart-chat-window {
    bottom: 100px;
    right: 24px;
}

.smart-chat-widget.bottom-left .smart-chat-window {
    bottom: 100px;
    left: 24px;
}

@keyframes windowSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.smart-chat-header {
    padding: 24px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--header-color, #6366f1) 0%, var(--header-color-dark, #4f46e5) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.smart-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.smart-chat-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.smart-chat-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.smart-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.smart-chat-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}

/* Messages Container */
.smart-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fb 0%, #f1f3f7 100%);
    scroll-behavior: smooth;
}

/* Individual Message */
.smart-chat-message {
    margin-bottom: 16px;
    animation: messageAppear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.smart-chat-message-content {
    padding: 13px 17px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14.5px;
    position: relative;
}

/* User Message */
.smart-chat-user-message {
    justify-content: flex-end;
}

.smart-chat-user-message .smart-chat-message-content {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* Bot Message */
.smart-chat-bot-message {
    justify-content: flex-start;
}

.smart-chat-bot-message .smart-chat-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.smart-chat-bot-message .smart-chat-message-content strong {
    color: #6366f1;
}

.smart-chat-bot-message .smart-chat-message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #ef4444;
}

/* Chat Input Area */
.smart-chat-input {
    display: flex;
    padding: 18px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 10px;
    align-items: center;
}

.smart-chat-input input {
    flex: 1;
    padding: 13px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 28px;
    outline: none;
    font-size: 14.5px;
    transition: all 0.25s ease;
    background: #f9fafb;
}

.smart-chat-input input:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.smart-chat-input input::placeholder {
    color: #9ca3af;
}

.smart-chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.smart-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.08) rotate(15deg);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.smart-chat-send-btn:active:not(:disabled) {
    transform: scale(0.95) rotate(15deg);
}

.smart-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

/* Typing Indicator */
.smart-chat-typing {
    padding: 12px 20px;
    display: flex;
    gap: 5px;
    align-items: center;
    background: linear-gradient(to bottom, #f8f9fb 0%, #f1f3f7 100%);
}

.smart-chat-typing span {
    width: 9px;
    height: 9px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    animation: typingBounce 1.3s infinite ease-in-out;
}

.smart-chat-typing span:nth-child(1) {
    animation-delay: 0s;
}

.smart-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.smart-chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-12px) scale(1.1);
        opacity: 1;
    }
}

/* Custom Scrollbar */
.smart-chat-messages::-webkit-scrollbar {
    width: 7px;
}

.smart-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.smart-chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    border-radius: 10px;
}

.smart-chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

/* Mobile Responsive Design */
@media (max-width: 480px) {
    .smart-chat-bubble {
        width: 56px;
        height: 56px;
    }
    
    .smart-chat-window {
        width: calc(100vw - 32px) !important;
        height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 16px !important;
        left: 16px !important;
        border-radius: 12px;
    }
    
    .smart-chat-widget.bottom-left .smart-chat-window {
        left: 16px !important;
        right: 16px !important;
    }
    
    .smart-chat-header {
        padding: 18px 16px;
    }
    
    .smart-chat-header h3 {
        font-size: 17px;
    }
    
    .smart-chat-messages {
        padding: 16px;
    }
    
    .smart-chat-input {
        padding: 14px 12px;
    }
    
    .smart-chat-send-btn {
        width: 44px;
        height: 44px;
    }
}

/* Tablet Responsive */
@media (min-width: 481px) and (max-width: 768px) {
    .smart-chat-window {
        width: 380px;
        height: 580px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .smart-chat-bubble,
    .smart-chat-window,
    .smart-chat-message {
        animation: none;
    }
    
    .smart-chat-bubble:hover {
        transform: scale(1.05);
    }
}