/* HtmlCodesBot Chatbot Styles */

/* Light Theme (Default) */
:root {
    --chatbot-primary: #7c3aed;
    --chatbot-secondary: #6d28d9;
    --chatbot-hover: #8b5cf6;
    --chatbot-bubble-user: #7c3aed;
    --chatbot-bubble-bot: #f1f5f9;
    --chatbot-text-user: #ffffff;
    --chatbot-text-bot: #1e293b;
    --chatbot-shadow: 0 10px 40px rgba(124, 58, 237, 0.3);
    --chatbot-border: #e2e8f0;
}

/* Dark Blue Theme */
[data-theme="dark"] {
    --chatbot-bubble-bot: #1e293b;
    --chatbot-text-bot: #ffffff;
    --chatbot-border: #334155;
    --chatbot-primary: #60a5fa;
    --chatbot-secondary: #3b82f6;
    --chatbot-hover: #93c5fd;
    --chatbot-bubble-user: #3b82f6;
}

/* Dark Orange Theme */
[data-theme="dark-orange"] {
    --chatbot-bubble-bot: #1a1d24;
    --chatbot-text-bot: #ffffff;
    --chatbot-border: #3d4149;
    --chatbot-primary: #ff751f;
    --chatbot-secondary: #ff751f;
    --chatbot-hover: #ff8b49;
    --chatbot-bubble-user: #ff751f;
    --chatbot-text-user: #000000;
}

/* Floating Robot Icon */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

/* Tooltip */
.chatbot-toggle::before {
    content: 'Need help with HTML?';
    position: absolute;
    bottom: 75px;
    right: 0;
    background: var(--chatbot-primary);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

[data-theme="dark-orange"] .chatbot-toggle::before {
    color: #000000;
}

/* Tooltip arrow */
.chatbot-toggle::after {
    content: '';
    position: absolute;
    bottom: 65px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid var(--chatbot-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle:hover::before,
.chatbot-toggle:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 50px rgba(124, 58, 237, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle .robot-icon {
    width: 48px;
    height: 48px;
    display: block;
    animation: wave 2s ease-in-out infinite;
}

/* Make toggle icon white in light theme for visibility */
:root .chatbot-toggle .robot-icon,
[data-theme="light"] .chatbot-toggle .robot-icon {
    filter: brightness(0) invert(1);
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Notification Badge */
.chatbot-toggle .notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

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

/* Chat Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    border: 1px solid var(--chatbot-border);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.active {
    display: flex;
}

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

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

[data-theme="dark-orange"] .chatbot-header {
    background: #ff751f;
    color: #000000;
}

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

.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;
}

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

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

[data-theme="dark-orange"] .chatbot-close {
    background: rgba(0, 0, 0, 0.2);
    color: #000000;
}

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

[data-theme="dark-orange"] .chatbot-close:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-secondary);
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-border);
    border-radius: 3px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.welcome-message .robot-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

/* Make robot icon white in dark themes for visibility */
[data-theme="dark"] .welcome-message .robot-icon,
[data-theme="dark-orange"] .welcome-message .robot-icon {
    filter: brightness(0) invert(1);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-message h4 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.welcome-message p {
    font-size: 14px;
    margin: 0 0 20px 0;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.quick-action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--chatbot-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.quick-action-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
    transform: translateY(-2px);
}

[data-theme="dark-orange"] .quick-action-btn:hover {
    color: #000000;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    flex-direction: row-reverse;
}

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

.message.bot .message-avatar {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
}

.message.user .message-avatar {
    background: var(--accent-primary);
    color: white;
}

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

.message.bot .message-bubble {
    background: var(--chatbot-bubble-bot);
    color: var(--chatbot-text-bot);
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: var(--chatbot-bubble-user);
    color: var(--chatbot-text-user);
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
    background: var(--chatbot-bubble-bot);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Code Blocks in Messages */
.message-bubble code {
    background: rgba(139, 92, 246, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--chatbot-primary);
}

[data-theme="dark"] .message-bubble code {
    background: rgba(96, 165, 250, 0.2);
    color: #dbeafe;
}

[data-theme="dark-orange"] .message-bubble code {
    background: rgba(255, 139, 73, 0.2);
    color: #fed7aa;
}

.message-bubble pre {
    background: rgba(139, 92, 246, 0.1);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="dark"] .message-bubble pre {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
}

[data-theme="dark-orange"] .message-bubble pre {
    background: rgba(255, 139, 73, 0.15);
    border-color: rgba(255, 139, 73, 0.3);
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

/* Links in Messages */
.message-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    margin: 8px 0;
    text-decoration: none;
    color: var(--chatbot-primary);
    transition: all 0.2s;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="dark"] .message-link {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    color: #dbeafe;
}

[data-theme="dark-orange"] .message-link {
    background: rgba(255, 139, 73, 0.15);
    border-color: rgba(255, 139, 73, 0.3);
    color: #fed7aa;
}

.message-link:hover {
    background: rgba(139, 92, 246, 0.25);
    transform: translateX(4px);
}

[data-theme="dark"] .message-link:hover {
    background: rgba(96, 165, 250, 0.3);
}

[data-theme="dark-orange"] .message-link:hover {
    background: rgba(255, 139, 73, 0.3);
}

.message-link-icon {
    font-size: 18px;
}

.message-link-text {
    flex: 1;
}

.message-link-title {
    font-weight: 600;
    font-size: 14px;
}

.message-link-url {
    font-size: 12px;
    opacity: 0.7;
}

/* Input Area */
.chatbot-input-area {
    padding: 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--chatbot-border);
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--font-family);
    resize: none;
    max-height: 120px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
}

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

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

[data-theme="dark-orange"] .chatbot-send-btn {
    color: #000000;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

/* Suggestions */
.message-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.suggestion-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--chatbot-primary);
}

[data-theme="dark"] .suggestion-btn {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    color: #dbeafe;
}

[data-theme="dark-orange"] .suggestion-btn {
    background: rgba(255, 139, 73, 0.15);
    border-color: rgba(255, 139, 73, 0.4);
    color: #fed7aa;
}

.suggestion-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    transform: translateY(-2px);
}

[data-theme="dark-orange"] .suggestion-btn:hover {
    color: #000000;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 90px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        height: 70vh;
    }

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

    .chatbot-toggle .robot-icon {
        width: 36px;
        height: 36px;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* Accessibility */
.chatbot-container:focus-within {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.chatbot-input:focus,
.chatbot-send-btn:focus,
.quick-action-btn:focus,
.suggestion-btn:focus {
    outline: 2px solid var(--chatbot-primary);
    outline-offset: 2px;
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 13px;
}

[data-theme="dark"] .error-message,
[data-theme="dark-orange"] .error-message {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Info Box */
.info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 13px;
}

.info-box strong {
    color: #2563eb;
}

[data-theme="dark"] .info-box strong {
    color: #93c5fd;
}

[data-theme="dark-orange"] .info-box {
    background: rgba(255, 117, 31, 0.15);
    border-color: rgba(255, 117, 31, 0.3);
}

[data-theme="dark-orange"] .info-box strong {
    color: #ffb380;
}
