/**
 * AI Portfolio Chatbot Widget Styles
 * Author: Shashi Bhushan Jha
 */

/* CSS Variables for theming */
:root {
    --chat-primary: #6366f1;
    --chat-primary-dark: #4f46e5;
    --chat-bg-dark: #1f2937;
    --chat-bg-light: #ffffff;
    --chat-text-dark: #f9fafb;
    --chat-text-light: #1f2937;
    --chat-border: #374151;
    --chat-user-bubble: #6366f1;
    --chat-bot-bubble: #374151;
    --chat-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Demo page styles */
.demo-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.demo-page h1 {
    color: #6366f1;
}

.demo-page code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

.demo-page pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
}

/* Widget Container */
.chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: white;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 30px 60px -12px rgba(99, 102, 241, 0.4);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
}

.chat-toggle .hidden {
    display: none;
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.notification-dot.hidden {
    display: none;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: var(--chat-bg-dark);
    border-radius: 16px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-window.hidden {
    display: none;
}

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

/* Dark theme */
.chat-widget.dark .chat-window {
    background: var(--chat-bg-dark);
    color: var(--chat-text-dark);
}

/* Light theme */
.chat-widget.light .chat-window {
    background: var(--chat-bg-light);
    color: var(--chat-text-light);
}

.chat-widget.light .chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
}

.chat-widget.light .chat-messages {
    background: #f9fafb;
}

.chat-widget.light .message.bot .message-content {
    background: #e5e7eb;
    color: var(--chat-text-light);
}

.chat-widget.light .chat-input-area {
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-widget.light .chat-input {
    background: #f3f4f6;
    color: var(--chat-text-light);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

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

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

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

.header-text .status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-text .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

.minimize-btn {
    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;
    transition: background 0.2s;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.minimize-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #111827;
}

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

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

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

/* Messages */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

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

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

.message.error .message-content {
    background: #7f1d1d;
    color: #fecaca;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.quick-action {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action:hover {
    background: var(--chat-primary);
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: #1f2937;
    border-top: 1px solid var(--chat-border);
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    background: #374151;
    color: var(--chat-text-dark);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.chat-input:focus {
    border-color: var(--chat-primary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--chat-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: var(--chat-primary-dark);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #4b5563;
    cursor: not-allowed;
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

.powered-by {
    text-align: center;
    font-size: 11px;
    opacity: 0.5;
    margin-top: 8px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        max-height: 600px;
        bottom: 70px;
        right: -10px;
    }

    .chat-toggle {
        width: 56px;
        height: 56px;
    }

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