/**
 * Freight Factoring Inc. - Chat Widget Styles
 */

/* Chat Widget Toggle Button */
.chat-widget-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(30, 64, 175, 0.6);
}

.chat-widget-toggle .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #F97316;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 2px solid white;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(30, 64, 175, 0.7);
    }
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-widget.open ~ .chat-widget-toggle {
    display: none;
}

/* Chat Widget Header */
.chat-widget-header {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-widget-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-widget-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.chat-widget-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.chat-widget-status {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-widget-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chat Widget Body */
.chat-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #F9FAFB;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #D1D5DB;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-bot {
    justify-content: flex-start;
}

.chat-message-user {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.chat-message-bot .chat-message-avatar {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
    color: white;
}

.chat-message-user .chat-message-avatar {
    background: #E5E7EB;
    color: #6B7280;
}

.chat-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.chat-message-bot .chat-message-content {
    align-items: flex-start;
}

.chat-message-user .chat-message-content {
    align-items: flex-end;
}

.chat-message-text {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message-bot .chat-message-text {
    background: white;
    color: #1F2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message-user .chat-message-text {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 0.7rem;
    color: #9CA3AF;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

/* Typing Indicator */
.typing-indicator {
    opacity: 0.7;
}

.typing-dots {
    display: flex;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input Container */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #E5E7EB;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: #1E40AF;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.chat-input:disabled {
    background: #F3F4F6;
    cursor: not-allowed;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 2rem);
        height: calc(100vh - 4rem);
        max-height: 90vh;
        bottom: 1rem;
        right: 1rem;
        border-radius: 16px;
    }

    .chat-widget-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .chat-widget-header {
        border-radius: 16px 16px 0 0;
        padding: 1rem 1.25rem;
    }

    .chat-messages {
        padding: 1.25rem;
    }

    .chat-input-container {
        padding: 0.875rem 1.25rem;
    }
}

