/**
 * Interactive Question Widgets CSS
 * - Floating CTA Button (Option A)
 * - Chat-Style Popup (Option B)
 */

/* ========================================
   OPTION A: FLOATING CTA WIDGET
   ======================================== */

.floating-question-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.floating-question-widget.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Floating Button */
.floating-question-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
}

.floating-question-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.5);
}

.floating-question-btn .icon-question {
    flex-shrink: 0;
}

.floating-question-widget.expanded .floating-question-btn {
    display: none;
}

/* Expanded Panel */
.floating-question-expanded {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 360px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.floating-question-widget.expanded .floating-question-expanded {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.expanded-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.expanded-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-expanded {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-expanded:hover {
    background: rgba(255, 255, 255, 0.3);
}

.quick-question-form {
    padding: 20px;
}

.question-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s ease;
}

.question-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

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

.submit-question-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a202c;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-question-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.4);
}

.widget-hint {
    margin: 0;
    padding: 12px 20px 16px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .floating-question-widget {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    
    .floating-question-expanded {
        width: 100%;
        left: 0;
        right: 0;
    }
    
    .floating-question-btn .btn-text {
        display: none;
    }
    
    .floating-question-btn {
        padding: 14px;
        border-radius: 50%;
    }
}

/* ========================================
   OPTION B: CHAT-STYLE POPUP WIDGET
   ======================================== */

.chat-question-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-question-widget.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Chat Trigger Button */
.chat-trigger-btn {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-trigger-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.5);
}

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

.chat-question-widget.open .chat-trigger-btn .icon-chat {
    display: none;
}

.chat-question-widget.open .chat-trigger-btn .icon-close {
    display: block;
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a202c;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
}

.chat-question-widget.open .chat-badge {
    display: none;
}

/* Chat Popup */
.chat-popup {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 480px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.chat-question-widget.open .chat-popup {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

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

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

.chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.status-online {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-status 2s infinite;
}

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

/* Chat Body */
.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message p {
    margin: 0;
}

.bot-message {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message a {
    color: #8b5cf6;
    font-weight: 600;
    text-decoration: none;
}

.bot-message a:hover {
    text-decoration: underline;
}

/* Typing indicator */
.typing-dots span {
    animation: typing-bounce 1.4s infinite;
    display: inline-block;
}

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

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Chat Input */
.chat-input-form {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 24px;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #8b5cf6;
    background: white;
}

.chat-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    min-height: 24px;
    max-height: 100px;
}

.chat-input:focus {
    outline: none;
}

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

.chat-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

/* Chat Footer */
.chat-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    background: #f9fafb;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .chat-question-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        transform-origin: bottom center;
    }
    
    .chat-question-widget.open .chat-popup {
        border-radius: 20px 20px 0 0;
    }
}

/* ========================================
   SHARED STYLES
   ======================================== */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .floating-question-widget,
    .floating-question-expanded,
    .chat-question-widget,
    .chat-popup,
    .chat-trigger-btn,
    .floating-question-btn {
        transition: none;
    }
    
    .typing-dots span,
    .status-online::before {
        animation: none;
    }
}

