/**
 * Live Chat Widget Styling
 *
 * @package WeymanBusinessHub
 */

/* Chat Bubble Container */
.whdr-chat-bubble {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 999997;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.whdr-chat-bubble.show {
    opacity: 1;
    transform: scale(1);
}

/* Chat Trigger Button */
.whdr-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d63638 0%, #a02b2d 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(214, 54, 56, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    transition: all 0.3s ease;
}

.whdr-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(214, 54, 56, 0.5);
}

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

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

/* Notification Badge */
.whdr-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #00ff00;
    color: #000000;
    font-size: 12px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse-badge 2s infinite;
}

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

/* Chat Window */
.whdr-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

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

/* Chat Header */
.whdr-chat-header {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333333;
}

.whdr-chat-agent {
    display: flex;
    align-items: center;
    gap: 12px;
}

.whdr-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #d63638;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.whdr-chat-agent-info {
    display: flex;
    flex-direction: column;
}

.whdr-chat-agent-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.whdr-chat-status {
    font-size: 12px;
    color: #aaaaaa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.whdr-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff00;
    animation: pulse-status 2s infinite;
}

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

.whdr-chat-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.whdr-chat-close:hover {
    opacity: 0.7;
}

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

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

.whdr-chat-message-bot {
    align-items: flex-start;
}

.whdr-chat-message-user {
    align-items: flex-end;
}

.whdr-chat-bubble-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.whdr-chat-message-bot .whdr-chat-bubble-content {
    background: white;
    color: #000000;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.whdr-chat-message-user .whdr-chat-bubble-content {
    background: #d63638;
    color: white;
    border-bottom-right-radius: 4px;
}

.whdr-chat-bubble-content p {
    margin: 0 0 8px;
}

.whdr-chat-bubble-content p:last-child {
    margin-bottom: 0;
}

.whdr-chat-bubble-content a {
    color: #d63638;
    text-decoration: underline;
    font-weight: 500;
}

.whdr-chat-message-user .whdr-chat-bubble-content a {
    color: white;
}

.whdr-chat-time {
    font-size: 11px;
    color: #666666;
    padding: 0 4px;
}

/* Typing Indicator */
.whdr-chat-typing {
    font-size: 13px;
    color: #666666;
    font-style: italic;
    padding: 8px;
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Quick Replies */
.whdr-chat-quick-replies {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.whdr-quick-reply {
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.whdr-quick-reply:hover {
    background: #d63638;
    color: white;
    border-color: #d63638;
}

/* Chat Input */
.whdr-chat-input-wrapper {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.whdr-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.whdr-chat-input:focus {
    border-color: #d63638;
}

.whdr-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d63638;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.whdr-chat-send:hover {
    background: #a02b2d;
    transform: scale(1.05);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .whdr-chat-bubble {
        bottom: 20px;
        right: 10px;
    }

    .whdr-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 0;
    }

    .whdr-chat-trigger {
        width: 56px;
        height: 56px;
    }

    .whdr-chat-quick-replies {
        flex-direction: column;
    }

    .whdr-quick-reply {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .whdr-chat-window {
        background: #1a1a1a;
    }

    .whdr-chat-messages {
        background: #0a0a0a;
    }

    .whdr-chat-message-bot .whdr-chat-bubble-content {
        background: #2a2a2a;
        color: #ffffff;
    }

    .whdr-chat-input-wrapper {
        background: #1a1a1a;
        border-top-color: #333333;
    }

    .whdr-chat-input {
        background: #2a2a2a;
        border-color: #333333;
        color: #ffffff;
    }

    .whdr-chat-input:focus {
        border-color: #d63638;
    }

    .whdr-quick-reply {
        background: #2a2a2a;
        border-color: #333333;
        color: #ffffff;
    }

    .whdr-chat-quick-replies {
        background: #1a1a1a;
        border-top-color: #333333;
    }
}

/* Print - Hide chat */
@media print {
    .whdr-chat-bubble {
        display: none !important;
    }
}
