/*
 * SMSPro Solutions - Professional Chat Widget
 * Premium Dark Theme matching SMSPro brand colors
 * Colors: Dark Navy (#1a1a2e), Teal (#0f3460), Coral (#e94560)
 */

/* 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;
}

/* Chat Toggle Button - Premium Dark Design */
.chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 2px solid rgba(233, 69, 96, 0.3);
    color: #ffffff;
    cursor: pointer;
    box-shadow:
        0 8px 16px rgba(26, 26, 46, 0.3),
        0 4px 8px rgba(233, 69, 96, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-toggle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(233, 69, 96, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.chat-toggle:hover::before {
    opacity: 1;
}

.chat-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow:
        0 12px 24px rgba(26, 26, 46, 0.4),
        0 6px 12px rgba(233, 69, 96, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(233, 69, 96, 0.5);
}

.chat-toggle:active {
    transform: scale(0.95);
}

.chat-toggle.active {
    background: linear-gradient(135deg, #e94560 0%, #d63652 100%);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
}

/* Unread Badge */
.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #e94560 0%, #d63652 100%);
    color: white;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.4);
}

.unread-badge.show {
    display: flex;
}

/* Chat Window - Premium Design */
.chat-window {
    position: fixed;
    bottom: 104px;
    right: 24px;
    width: 400px;
    height: 640px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(26, 26, 46, 0.25),
        0 8px 24px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(26, 26, 46, 0.08);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px) scale(0.92);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-window.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header - SMSPro Brand Colors */
.chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    padding: 24px 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(233, 69, 96, 0.3), transparent);
}

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

.chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.2) 0%, rgba(15, 52, 96, 0.2) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-header-avatar svg {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-header p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

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

.ai-badge {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.9) 0%, rgba(233, 69, 96, 0.7) 100%);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-left: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 2px 8px rgba(233, 69, 96, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
}

.chat-minimize {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

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

.chat-minimize svg {
    width: 18px;
    height: 18px;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(26, 26, 46, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 26, 46, 0.2);
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: slideIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 75%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(26, 26, 46, 0.06);
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-time {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
    font-weight: 500;
}

/* User Message - SMSPro Theme */
.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.2);
}

.user-message .message-avatar svg {
    color: white;
}

.user-message .message-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-message .message-content p {
    color: white;
}

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

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    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% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Chat Input - Premium Design */
.chat-input {
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-top: 1px solid rgba(26, 26, 46, 0.08);
    display: flex;
    gap: 12px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.02);
}

.chat-input input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 28px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    font-family: inherit;
    color: #1f2937;
}

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

.chat-input input:focus {
    border-color: #1a1a2e;
    box-shadow:
        0 0 0 4px rgba(26, 26, 46, 0.08),
        0 2px 8px rgba(26, 26, 46, 0.1);
    background: #ffffff;
}

.chat-input button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560 0%, #d63652 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 12px rgba(233, 69, 96, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-input button:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 16px rgba(233, 69, 96, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, #e94560 0%, #e03050 100%);
}

.chat-input button:active {
    transform: scale(0.95);
}

.chat-input button svg {
    width: 20px;
    height: 20px;
}

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

    .chat-window {
        bottom: 88px;
        right: 16px;
        left: 16px;
        width: auto;
        max-height: 75vh;
        height: auto;
    }

    .chat-toggle {
        width: 56px;
        height: 56px;
    }

    .chat-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    }

    .chat-messages {
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    }

    .message-content {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .message-content p {
        color: #f3f4f6;
    }

    .chat-input {
        background: #1f2937;
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .chat-input input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

    .chat-input input:focus {
        border-color: #e94560;
        box-shadow:
            0 0 0 4px rgba(233, 69, 96, 0.2),
            0 2px 8px rgba(0, 0, 0, 0.3);
    }
}
