/**
 * Custom Chat Widget Styles
 * A Tawk.to-like chat interface
 */

/* Chat Widget Button */
.chat-widget-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    z-index: 10004;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 99, 235, 0.5);
}

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

.chat-widget-btn .close-icon {
    display: none;
}

.chat-widget-btn.active .chat-icon {
    display: none;
}

.chat-widget-btn.active .close-icon {
    display: block;
}

/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 370px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10004;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.chat-widget-container.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Chat Header */
.chat-widget-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-widget-header .back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-header .back-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.chat-widget-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.chat-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-widget-header .new-chat-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-widget-header .new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-header .new-chat-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chat-widget-header .menu-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-widget-header .menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-header .menu-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Chat Messages Area */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.chat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.chat-message.incoming {
    align-self: flex-start;
}

.chat-message.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-message-avatar svg {
    width: 20px;
    height: 20px;
    fill: #64748b;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-sender {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 4px;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.incoming .chat-message-bubble {
    background: #2563eb;
    color: white;
    border-bottom-left-radius: 4px;
}

.chat-message.outgoing .chat-message-bubble {
    background: #e5e7eb;
    color: #1f2937;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-left: 4px;
}

/* Quick Reply Options */
.chat-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.chat-quick-reply-btn {
    background: white;
    border: 1px solid #2563eb;
    color: #2563eb;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    text-align: center;
}

.chat-quick-reply-btn:hover {
    background: #2563eb;
    color: white;
}

/* Typing Indicator */
.chat-typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.chat-typing-indicator.active {
    display: flex;
}

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

.chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(1) { animation-delay: 0s; }
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Chat Input Area */
.chat-widget-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-widget-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    padding: 10px 0;
    resize: none;
    font-family: inherit;
    background: transparent;
}

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

.chat-widget-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-widget-input-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-widget-input-actions button:hover {
    background: #f1f5f9;
}

.chat-widget-input-actions button svg {
    width: 22px;
    height: 22px;
    fill: #64748b;
}

.chat-widget-send-btn {
    background: #2563eb !important;
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
}

.chat-widget-send-btn:hover {
    background: #1d4ed8 !important;
}

.chat-widget-send-btn svg {
    fill: white !important;
    width: 18px !important;
    height: 18px !important;
}

/* Welcome Screen */
.chat-widget-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    background: #f8fafc;
}

.chat-widget-welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.chat-widget-welcome-avatar svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.chat-widget-welcome h3 {
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 10px;
}

.chat-widget-welcome p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.chat-widget-start-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.chat-widget-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-widget-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-widget-btn {
        bottom: 15px;
        right: 15px;
    }
}

/* Notification Badge */
.chat-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.chat-widget-badge.active {
    display: flex;
    animation: badgePulse 2s infinite;
}

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

/* Powered By */
.chat-widget-powered {
    text-align: center;
    padding: 8px;
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.chat-widget-powered a {
    color: #2563eb;
    text-decoration: none;
}
