/**
 * NuSpot Chatbot Widget Styles
 * Modern, responsive, and conversion-focused
 */

/* Widget Container */
#nuspot-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: calc(100vw - 32px);
}

/* Launcher Button */
.nuspot-chatbot-launcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.nuspot-chatbot-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.nuspot-chatbot-launcher-icon {
    font-size: 20px;
}

/* Chat Panel */
.nuspot-chatbot-panel {
    display: none;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 100px);
    max-width: calc(100vw - 32px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    overflow: hidden;
}

#nuspot-chatbot-widget.nuspot-chatbot-open .nuspot-chatbot-panel {
    display: flex;
}

#nuspot-chatbot-widget.nuspot-chatbot-open .nuspot-chatbot-launcher {
    display: none !important;
}

#nuspot-chatbot-widget.nuspot-chatbot-closed .nuspot-chatbot-launcher {
    display: flex !important;
}

/* Header */
.nuspot-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nuspot-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nuspot-chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.nuspot-chatbot-header-text {
    display: flex;
    flex-direction: column;
}

.nuspot-chatbot-title {
    font-weight: 600;
    font-size: 15px;
}

.nuspot-chatbot-status {
    font-size: 12px;
    opacity: 0.8;
}

.nuspot-chatbot-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    margin-right: 6px;
}

.nuspot-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nuspot-chatbot-close:hover {
    opacity: 1;
}

/* Messages Area */
.nuspot-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

/* Message Bubbles */
.nuspot-chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease;
}

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

.nuspot-chatbot-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.nuspot-chatbot-message.assistant {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.nuspot-chatbot-typing {
    align-self: flex-start;
    background: white;
    padding: 16px 20px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 4px;
}

.nuspot-chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.nuspot-chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.nuspot-chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.nuspot-chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e8e8e8;
}

.nuspot-chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.nuspot-chatbot-quick-action {
    padding: 8px 14px;
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.nuspot-chatbot-quick-action:hover {
    background: #e0e0e0;
}

.nuspot-chatbot-input-row {
    display: flex;
    gap: 8px;
}

.nuspot-chatbot-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.nuspot-chatbot-input:focus {
    border-color: #667eea;
}

.nuspot-chatbot-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nuspot-chatbot-send:hover {
    transform: scale(1.05);
}

.nuspot-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Holiday Banner */
.nuspot-chatbot-holiday {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    padding: 10px 16px;
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

/* Form Cards */
.nuspot-chatbot-form-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nuspot-chatbot-form-card h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

.nuspot-chatbot-form-field {
    margin-bottom: 12px;
}

.nuspot-chatbot-form-field label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.nuspot-chatbot-form-field input,
.nuspot-chatbot-form-field select,
.nuspot-chatbot-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.nuspot-chatbot-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.nuspot-chatbot-form-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.nuspot-chatbot-form-submit:hover {
    opacity: 0.9;
}

/* Checkbox styling */
.nuspot-chatbot-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.nuspot-chatbot-checkbox input {
    margin-top: 2px;
}

.nuspot-chatbot-checkbox label {
    font-size: 12px;
    color: #666;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #nuspot-chatbot-widget {
        right: 0;
        bottom: 0;
        left: 0;
        max-width: none;
        pointer-events: none;
    }
    
    .nuspot-chatbot-launcher {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 25px;
        width: fit-content;
        max-width: min(100%, 280px);
        margin: 0 12px max(12px, env(safe-area-inset-bottom)) auto;
        pointer-events: auto;
    }
    
    .nuspot-chatbot-launcher-icon {
        font-size: 18px;
    }
    
    .nuspot-chatbot-launcher-text {
        font-size: 13px;
    }
    
    .nuspot-chatbot-panel {
        width: auto;
        max-width: none;
        height: calc(var(--nuspot-chatbot-vh, 100vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(var(--nuspot-chatbot-vh, 100vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        position: fixed;
        inset: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
        border-radius: 0;
        pointer-events: auto;
    }

    .nuspot-chatbot-header {
        padding: 14px 16px;
    }

    .nuspot-chatbot-messages {
        padding: 16px;
    }

    .nuspot-chatbot-input-area {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .nuspot-chatbot-input-row {
        align-items: center;
    }

    .nuspot-chatbot-input,
    .nuspot-chatbot-form-field input,
    .nuspot-chatbot-form-field select,
    .nuspot-chatbot-form-field textarea {
        font-size: 16px;
    }

    .nuspot-chatbot-send {
        flex: 0 0 44px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .nuspot-chatbot-message,
    .nuspot-chatbot-launcher,
    .nuspot-chatbot-typing-dot {
        animation: none;
        transition: none;
    }
}

/* Focus styles */
.nuspot-chatbot-launcher:focus,
.nuspot-chatbot-close:focus,
.nuspot-chatbot-send:focus,
.nuspot-chatbot-quick-action:focus,
.nuspot-chatbot-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Scrollbar styling */
.nuspot-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.nuspot-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}
