/**
 * Frontend Chat Widget Styles
 * Modern Tidio-like interface
 */

/* Widget Container */
.npd-chatbot-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.npd-chatbot-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.npd-chatbot-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Ensure body doesn't hide chatbot */
body {
    overflow-x: visible !important;
}

/* Prevent parent containers from hiding chatbot */
.npd-chatbot-widget * {
    box-sizing: border-box;
}

/* Chat Bubble Button */
.npd-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--npd-primary-color, #0066cc);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.npd-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.npd-online-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #00c853;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    white-space: nowrap;
}

/* Chat Window */
.npd-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.npd-chatbot-widget.bottom-left .npd-chat-window {
    right: auto;
    left: 0;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.npd-chat-header {
    background: var(--npd-primary-color, #0066cc);
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.npd-chat-avatar,
.npd-chat-avatar-default {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.npd-chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.npd-status-online {
    font-size: 12px;
    opacity: 0.9;
}

.npd-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.npd-chat-close:hover {
    opacity: 1;
}

/* Lead Form */
.npd-lead-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f9f9f9;
}

.npd-lead-form-content {
    width: 100%;
    max-width: 320px;
}

.npd-lead-form-content h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--npd-text-color, #333);
}

.npd-lead-form-content p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
}

.npd-form-group {
    margin-bottom: 12px;
}

.npd-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.npd-form-group input:focus {
    outline: none;
    border-color: var(--npd-primary-color, #0066cc);
}

.npd-btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--npd-primary-color, #0066cc);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.npd-btn-primary:hover {
    background: var(--npd-primary-color, #0052a3);
}

/* Chat Messages */
.npd-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
}

.npd-message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.npd-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.npd-message-bot .npd-message-content {
    background: #fff;
    color: var(--npd-text-color, #333);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.npd-message-user {
    justify-content: flex-end;
}

.npd-message-user .npd-message-content {
    background: var(--npd-primary-color, #0066cc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.npd-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    margin: 0 16px 16px 16px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.npd-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.npd-typing-indicator 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;
    }
}

/* Quick Replies / Action Buttons */
.npd-quick-replies {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.npd-quick-reply,
.npd-action-button {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    color: var(--npd-text-color, #333);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

.npd-quick-reply:hover,
.npd-action-button:hover {
    background: var(--npd-primary-color, #0066cc);
    color: #fff;
    border-color: var(--npd-primary-color, #0066cc);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
}

/* Message content with links */
.npd-message-content a {
    color: var(--npd-primary-color, #0066cc);
    text-decoration: underline;
    font-weight: 500;
}

.npd-message-content a:hover {
    color: #0052a3;
}

.npd-message-content strong {
    font-weight: 600;
    color: #222;
}

.npd-message-bot .npd-message-content {
    line-height: 1.5;
}

/* Chat Input */
.npd-chat-input {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #eee;
}

.npd-chat-input form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

#npd-message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

#npd-message-input:focus {
    outline: none;
    border-color: var(--npd-primary-color, #0066cc);
}

.npd-send-button {
    width: 40px;
    height: 40px;
    background: var(--npd-primary-color, #0066cc);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.npd-send-button:hover {
    background: var(--npd-primary-color, #0052a3);
}

.npd-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .npd-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 10px;
    }

    .npd-chatbot-widget.bottom-right {
        right: 10px;
        bottom: 10px;
    }

    .npd-chatbot-widget.bottom-left {
        left: 10px;
        bottom: 10px;
    }

    .npd-chatbot-widget.bottom-left .npd-chat-window {
        left: 10px;
        right: auto;
    }
}

/* Scrollbar Styling */
.npd-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.npd-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}