/* NDS Digital Studio Premium Chatbot Styles */

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(14, 165, 233, 0.4);
    transition: var(--transition);
    z-index: 1001;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(14, 165, 233, 0.5);
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: chatbot-shimmer 3s infinite;
}

@keyframes chatbot-shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.chatbot-toggle .chat-icon {
    display: block;
}

.chatbot-toggle .close-icon {
    display: none;
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block;
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    animation: chatbot-pulse 2s infinite;
    z-index: 2;
}

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

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 7rem;
    right: 2rem;
    width: 400px;
    max-width: calc(100vw - 2rem);
    height: 600px;
    max-height: calc(100vh - 10rem);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(14, 165, 233, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid rgba(14, 165, 233, 0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.chatbot-avatar svg {
    width: 24px;
    height: 24px;
    color: white;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.chatbot-header-status {
    font-size: 0.85rem;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: status-pulse 2s infinite;
}

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

.chatbot-header-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chatbot-header-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-header-close svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

/* Chat Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 165, 233, 0.5);
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: message-slide-in 0.3s ease-out;
}

@keyframes message-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-message.bot .chatbot-message-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.chatbot-message.user .chatbot-message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.chatbot-message-avatar svg {
    width: 16px;
    height: 16px;
    color: white;
}

.chatbot-message-content {
    padding: 0.875rem 1.25rem;
    border-radius: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chatbot-message.bot .chatbot-message-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-bottom-left-radius: 0.25rem;
}

.chatbot-message.user .chatbot-message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 0.75rem;
    align-self: flex-start;
    max-width: 85%;
}

.chatbot-typing-bubble {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    border-bottom-left-radius: 0.25rem;
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: 0s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Quick Replies */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chatbot-quick-reply {
    padding: 0.5rem 1rem;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 2rem;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.chatbot-quick-reply:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Chat Input Area */
.chatbot-input-area {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(14, 165, 233, 0.2);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    outline: none;
    transition: var(--transition);
}

.chatbot-input::placeholder {
    color: var(--text-secondary);
}

.chatbot-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.chatbot-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

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

.chatbot-send svg {
    width: 20px;
    height: 20px;
    color: white;
    transform: rotate(-45deg);
    margin-left: 2px;
}

/* Powered By Footer */
.chatbot-footer {
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.chatbot-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.chatbot-footer a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .chatbot-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
    }

    .chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* Message Links */
.chatbot-message-content a {
    color: var(--primary-light);
    text-decoration: underline;
}

.chatbot-message.user .chatbot-message-content a {
    color: white;
}

/* Error State */
.chatbot-message.error .chatbot-message-content {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Welcome Message Styles */
.chatbot-welcome {
    text-align: center;
    padding: 1rem;
}

.chatbot-welcome h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.chatbot-welcome p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Ultra-small devices - chatbot adjustments */
@media (max-width: 320px) {
    .chatbot-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }

    .chatbot-toggle svg {
        width: 22px;
        height: 22px;
    }

    .quick-reply-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .chatbot-input input {
        font-size: 14px;
    }
}
