/* Modern Chat Widget Styles */
* {
    box-sizing: border-box;
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
}

/* Chat Button */
.chat-button {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chat-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

.chat-button-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-icon {
    width: 28px !important;
    height: 28px !important;
    color: white;
    transition: transform 0.3s ease;
}

.chat-button:hover .chat-icon {
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

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

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 60px;
    right: 24px;
    width: 440px;
    height: 800px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Much larger height for bigger screens */
@media (min-height: 900px) {
    .chat-window {
        height: 850px;
    }
}

@media (min-height: 1080px) {
    .chat-window {
        height: 950px;
    }
}

/* Make window wider on very large screens */
@media (min-width: 1600px) {
    .chat-window {
        width: 500px;
    }
}

/* Chat Header */
.chat-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 1rem 1rem 0 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.assistant-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.status-text {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-text::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.header-button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.header-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.header-button svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Styles */
.message {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    animation: slideIn 0.3s ease-out, newMessageGlow 0.8s ease-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

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

@keyframes newMessageGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.assistant-message .message-avatar svg {
    width: 16px;
    height: 16px;
    color: white;
}

.user-message .message-avatar {
    background: #64748b;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.user-message .message-avatar::after {
    content: 'You';
    font-size: 10px;
}

.message-content {
    flex: 1;
    max-width: 90%;
}

.message-text {
    padding: 10px 14px;
    border-radius: 0.75rem;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.assistant-message .message-text {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.user-message .message-text {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    margin-left: auto;
    border-top-right-radius: 0.375rem;
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    text-align: right;
}

.user-message .message-time {
    text-align: left;
}

/* Chat Links Styling */
.chat-link {
    color: #2563eb !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    padding: 1px 2px;
    border-radius: 2px;
}

.chat-link:hover {
    color: #1d4ed8 !important;
    background-color: #dbeafe;
    border-bottom-color: #2563eb;
    text-decoration: none;
}

.chat-link:active {
    background-color: #2563eb;
    color: white !important;
}

/* Ensure links are visible in user messages (white background) */
.user-message .chat-link {
    color: rgba(255, 255, 255, 0.95) !important;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.user-message .chat-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom-color: white;
}

/* Product Cards */
.product-cards-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.product-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.product-name {
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    flex: 1;
    margin-right: 12px;
}

.product-price {
    font-weight: 700;
    color: #2563eb;
    font-size: 16px;
    white-space: nowrap;
}

.product-description {
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.feature-tag {
    background: #dbeafe;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 0.375rem;
    font-size: 11px;
    font-weight: 500;
}

.product-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.product-button {
    padding: 8px 12px;
    border-radius: 0.5rem;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-button-primary {
    background: #2563eb;
    color: white;
    border: none;
}

.product-button-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.product-button-secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.product-button-secondary:hover {
    background: #f1f5f9;
    border-color: #2563eb;
    color: #2563eb;
}

.price-comparison {
    margin-top: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 0.375rem;
    font-size: 11px;
}

.price-comparison-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    color: #64748b;
}

/* Quick Questions */
.quick-questions {
    padding: 16px 24px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.quick-questions-header {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
}

.quick-questions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 10px 12px;
    font-size: 13px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.quick-question:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateX(4px);
}

/* Chat Input */
.chat-input-container {
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.input-wrapper {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px #dbeafe;
}

.chat-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #0f172a;
    max-height: 120px;
    min-height: 44px;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.input-actions {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.attachment-button,
.send-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.attachment-button {
    background: transparent;
    color: #94a3b8;
}

.attachment-button:hover {
    background: #f1f5f9;
    color: #64748b;
}

.send-button {
    background: #2563eb;
    color: white;
}

.send-button:hover:not(:disabled) {
    background: #1d4ed8;
    transform: scale(1.05);
}

.send-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.5;
}

.send-button svg,
.attachment-button svg {
    width: 16px;
    height: 16px;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
}

.character-count {
    font-variant-numeric: tabular-nums;
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-top: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #2563eb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.typing-text {
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}
.loadingdiv {
    display: none !important;
}
/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: #ffffff;
    padding: 32px;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .chat-button {
        width: 60px;
        height: 60px;
    }

    .chat-icon {
        width: 24px;
        height: 24px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message {
        margin-bottom: 16px;
    }

    .chat-input-container {
        padding: 16px;
    }
}

@media (max-width: 360px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-header {
        border-radius: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-widget {
        color: #f8fafc;
    }
    
    .chat-window {
        background: #0f172a;
        border-color: #334155;
    }
    
    .chat-messages {
        background: #1e293b;
    }
    
    .assistant-message .message-text {
        background: #1e293b;
        border-color: #1e293b;
    }
    
    .quick-questions {
        background: #0f172a;
        border-color: #1e293b;
    }
    
    .quick-question {
        background: #1e293b;
        border-color: #334155;
        color: #f8fafc;
    }
    
    .quick-question:hover {
        background: #334155;
        border-color: #2563eb;
        color: #2563eb;
    }
    
    .chat-input-container {
        background: #0f172a;
        border-color: #1e293b;
    }
    
    .input-wrapper {
        background: #1e293b;
        border-color: #334155;
    }
    
    .chat-input {
        color: #f8fafc;
    }
    
    .chat-input::placeholder {
        color: #64748b;
    }
    
    .attachment-button:hover {
        background: #334155;
        color: #cbd5e1;
    }
    
    .product-card {
        background: #0f172a;
        border-color: #334155;
    }
    
    .product-name {
        color: #f8fafc;
    }
    
    .product-description {
        color: #cbd5e1;
    }
    
    .product-button-secondary {
        color: #cbd5e1;
        border-color: #334155;
    }
    
    .product-button-secondary:hover {
        background: #334155;
        border-color: #2563eb;
        color: #2563eb;
    }
    
    .price-comparison {
        background: #1e293b;
    }
    
    .price-comparison-title {
        color: #f8fafc;
    }
    
    .price-item {
        color: #cbd5e1;
    }
    
    .quick-questions-header {
        color: #cbd5e1;
    }
    
    .typing-indicator {
        background: #0f172a;
        border-color: #334155;
    }
    
    .typing-text {
        color: #cbd5e1;
    }
    
    .loading-spinner {
        background: #0f172a;
    }
    
    .loading-spinner p {
        color: #cbd5e1;
    }
    
    .spinner {
        border-color: #334155;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chat-window {
        border-color: #000000;
    }
    
    .chat-input::placeholder {
        color: #64748b;
    }
} 
