/* EduLoom Education Chatbot Styles */

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.5);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: white;
    font-size: 1.6rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.chatbot-toggle:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #ef4444, #f97316);
    transform: rotate(90deg);
}

.chatbot-toggle .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-notification 2s infinite;
}

@keyframes pulse-notification {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.chatbot-container.chatbot-open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 6px;
    object-fit: contain;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chatbot-header .status {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

.chatbot-header .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message Styles */
.message {
    margin-bottom: 18px;
    animation: slideInMessage 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* User Messages */
.user-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 14px 18px;
    border-radius: 20px 20px 6px 20px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
    animation: messagePopIn 0.3s ease;
}

@keyframes messagePopIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bot Messages */
.bot-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: avatarPulse 2s infinite;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    }
}

.message-bubble {
    background: white;
    padding: 14px 18px;
    border-radius: 8px 20px 20px 20px;
    max-width: calc(100% - 50px);
    word-wrap: break-word;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    position: relative;
    animation: bubbleSlide 0.4s ease;
}

@keyframes bubbleSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
}

.message-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 6px;
    text-align: right;
}

.bot-message .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator .message-bubble {
    padding: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Replies */
.chatbot-quick-replies {
    padding: 10px 15px 8px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 100px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.quick-reply {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 18px;
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: #475569;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-reply::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.quick-reply:hover::before {
    width: 300px;
    height: 300px;
}

.quick-reply:hover {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-color: transparent;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Input Area */
.chatbot-input {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    gap: 12px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.chatbot-input input:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chatbot-input button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.chatbot-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.chatbot-input button:active {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-container {
        right: 15px;
        left: 15px;
        width: auto;
        bottom: 90px;
        height: calc(100vh - 120px);
        max-height: none;
        border-radius: 15px;
    }
    
    .chatbot-toggle {
        right: 15px;
        bottom: 15px;
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .chatbot-header {
        padding: 16px;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-input {
        padding: 16px;
    }
    
    .message-content {
        font-size: 0.9rem;
    }
    
    .user-message .message-content,
    .message-bubble {
        max-width: 85%;
    }
    
    .chatbot-quick-replies {
        padding: 8px 12px 6px;
        max-height: 80px;
    }
    
    .quick-reply {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
}

@media (max-width: 380px) {
    .chatbot-quick-replies {
        padding: 6px 10px 5px;
        max-height: 70px;
    }
    
    .quick-reply {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
}

/* Animation for chatbot appearance */
@keyframes chatbotSlideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chatbot-container {
    animation: chatbotSlideIn 0.4s ease-out;
}

/* Enhanced hover effects */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-toggle:hover::before {
    opacity: 0.3;
}

/* Smooth scrolling */
.chatbot-messages {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.chatbot-toggle:focus,
.chatbot-close:focus,
.chatbot-input button:focus,
.quick-reply:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.chatbot-input input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Loading state */
.chatbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Success state for form interactions */
.message-success {
    background: #ecfdf5 !important;
    border: 1px solid #10b981 !important;
    color: #065f46 !important;
}

/* Error state for form interactions */
.message-error {
    background: #fef2f2 !important;
    border: 1px solid #ef4444 !important;
    color: #b91c1c !important;
}

/* Data Collection Styles */
.interest-options {
    text-align: center;
    padding: 1rem 0;
}

.interest-options p {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 600;
}

.interest-btn {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 30px;
    padding: 12px 20px;
    margin: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: var(--text-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    display: inline-block;
    min-width: 130px;
    position: relative;
    overflow: hidden;
}

.interest-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.interest-btn:hover::before {
    left: 100%;
}

.interest-btn:hover {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-color: transparent;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.interest-btn:active {
    transform: translateY(0);
}

/* Lead Quality Indicators */
.lead-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0.7;
}

.lead-cold {
    background: #6b7280;
}

.lead-warm {
    background: #f59e0b;
}

.lead-hot {
    background: #ef4444;
    animation: pulse-hot 2s infinite;
}

@keyframes pulse-hot {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Data Collection Form Styling */
.data-collection-form {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    border: 2px solid #e2e8f0;
}

.data-collection-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.data-collection-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.data-collection-form .form-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

/* Progress Indicator for Data Collection */
.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.progress-step {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: #3b82f6;
    width: 24px;
    border-radius: 12px;
}

.progress-step.completed {
    background: #10b981;
}

/* Analytics Panel (for admin/debugging) */
.analytics-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.8rem;
    z-index: 1002;
    display: none;
    min-width: 250px;
}

.analytics-panel h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-dark);
}

.analytics-panel .metric {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.analytics-panel .metric-label {
    color: #6b7280;
}

.analytics-panel .metric-value {
    color: var(--text-dark);
    font-weight: 600;
}

.analytics-panel.show {
    display: block;
}

/* Mobile Responsiveness for Data Collection */
@media (max-width: 480px) {
    .interest-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
        min-width: auto;
    }
    
    .interest-options {
        padding: 0.5rem;
    }
    
    .data-collection-form {
        padding: 1rem;
        margin: 0.5rem 0;
    }
}
