/* Enterprise Chat Widget - Professional Styling for Fortune 500 Clients */

/* Chat Button */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.4);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-button.open {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    transform: rotate(45deg);
}

/* Chat Notification Badge */
.chat-notification {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

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

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 560px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(59, 130, 246, 0.1);
    overflow: hidden;
}

.chat-container.open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="1.5" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.chat-header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.chat-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 12px;
    right: 60px;
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    animation: statusPulse 2s infinite;
}

.status-indicator.connected {
    background-color: #10b981;
}

.status-indicator.connecting {
    background-color: #f59e0b;
}

.status-indicator.disconnected {
    background-color: #ef4444;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 3px;
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.message-content {
    max-width: 75%;
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.user .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

.message-text {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    text-align: right;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #64748b;
    font-size: 14px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    margin-left: 8px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    background: #94a3b8;
    border-radius: 50%;
    margin: 0 1px;
    animation: typingDots 1.4s infinite;
}

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

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

@keyframes typingDots {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Quick Actions */
.quick-actions {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.quick-actions h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #374151;
    font-weight: 600;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-action-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #475569;
}

.quick-action-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Chat Input */
.chat-input {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
    border-radius: 0 0 16px 16px;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    position: relative;
}

.chat-textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    min-height: 44px;
    max-height: 100px;
    background: #f9fafb;
    transition: border-color 0.2s, background-color 0.2s;
}

.chat-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-textarea::placeholder {
    color: #9ca3af;
}

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

.file-upload-btn, .send-btn {
    background: #f1f5f9;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.send-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    border-color: #3b82f6;
    color: white;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg, .file-upload-btn svg {
    width: 20px;
    height: 20px;
}

/* Hidden file input */
.file-input {
    display: none;
}

/* Satisfaction Survey Modal */
.survey-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    backdrop-filter: blur(4px);
}

.survey-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.survey-content h3 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 20px;
}

.survey-content p {
    color: #6b7280;
    margin-bottom: 24px;
}

.rating-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.star {
    font-size: 32px;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.3;
}

.star:hover, .star.active {
    color: #fbbf24;
    opacity: 1;
    transform: scale(1.1);
}

.feedback-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 24px;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.survey-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.survey-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.survey-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    border: none;
}

.survey-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.survey-btn.secondary {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.survey-btn.secondary:hover {
    background: #f3f4f6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        bottom: 90px;
        right: 16px;
        left: 16px;
        width: auto;
        height: 500px;
    }
    
    .chat-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .chat-button svg {
        width: 24px;
        height: 24px;
    }
    
    .survey-content {
        padding: 24px;
        margin: 16px;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-container {
        border: 2px solid #000;
    }
    
    .message-content {
        border: 1px solid #000;
    }
    
    .chat-textarea {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .chat-button,
    .chat-container,
    .message,
    .send-btn,
    .star {
        transition: none;
    }
    
    .chat-notification,
    .status-indicator,
    .typing-dots span {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .chat-messages {
        background: #111827;
    }
    
    .message-content {
        background: #374151;
        color: #f9fafb;
    }
    
    .message.user .message-content {
        background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    }
    
    .chat-input {
        background: #1f2937;
        border-color: #374151;
    }
    
    .chat-textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .chat-textarea::placeholder {
        color: #9ca3af;
    }
    
    .quick-actions {
        background: #1f2937;
        border-color: #374151;
    }
    
    .quick-action-btn {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .quick-action-btn:hover {
        background: #4b5563;
    }
    
    .survey-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .feedback-textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
}