/* chat.css - Space/Cosmic Theme */
:root {
    --chat-primary: #ffffff;
    --chat-primary-glow: rgba(255, 255, 255, 0.2);
    --chat-bg: rgba(0, 0, 0, 0.98);
    --chat-text: #ffffff;
    --chat-text-muted: #bbbbbb;
    --chat-bubble-user: #ffffff;
    --chat-bubble-bot: rgba(255, 255, 255, 0.08);
    --chat-border: rgba(255, 255, 255, 0.15);
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    --chat-glass: blur(25px);
}

.lumin-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 65px;
    height: 65px;
    border-radius: 20px;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.chat-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(67, 181, 129, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.chat-toggle:hover::before {
    transform: translateX(100%);
}

.chat-toggle:hover {
    transform: translateY(-5px);
    border-color: var(--chat-primary);
    box-shadow: 0 10px 30px rgba(67, 181, 129, 0.2);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: var(--chat-primary);
    filter: drop-shadow(0 0 8px var(--chat-primary-glow));
    transition: all 0.3s ease;
}

.chat-toggle.active svg {
    transform: rotate(90deg) scale(0.8);
    opacity: 0.5;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 400px;
    height: 650px;
    max-height: calc(100vh - 150px);
    background: var(--chat-bg);
    backdrop-filter: var(--chat-glass);
    -webkit-backdrop-filter: var(--chat-glass);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    padding: 24px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.03), transparent);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--chat-text);
}

.chat-header-info p {
    margin: 4px 0 0;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-info p::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--chat-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--chat-primary);
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(67, 181, 129, 0.1);
    border: 1px solid rgba(67, 181, 129, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-chat-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-muted);
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.05) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    animation: messageIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: var(--chat-bubble-user);
    color: black;
    font-weight: 500;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(67, 181, 129, 0.2);
}

.message.bot {
    align-self: flex-start;
    background: var(--chat-bubble-bot);
    color: var(--chat-text);
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 4px;
}

.message p {
    margin: 0;
}

.message p.typing::after {
    content: '|';
    animation: blink 0.7s infinite;
    margin-left: 2px;
    color: var(--chat-primary);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Typing Indicator */
.typing-container {
    padding: 0 24px 14px;
    display: none;
}

.typing-indicator {
    padding: 12px 16px;
    background: var(--chat-bubble-bot);
    border-radius: 15px;
    border: 1px solid var(--chat-border);
    align-self: flex-start;
    display: flex;
    gap: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    background: var(--chat-primary);
    border-radius: 50%;
    animation: typing 1s infinite;
    opacity: 0.6;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Chat Input */
.chat-input-container {
    padding: 24px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.02), transparent);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 6px 6px 18px;
    border-radius: 16px;
    border: 1px solid var(--chat-border);
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--chat-primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 20px rgba(67, 181, 129, 0.1);
}

.chat-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: var(--chat-text);
    font-size: 14px;
    outline: none;
    padding: 12px 0;
}

.chat-input-wrapper input::placeholder {
    color: var(--chat-text-muted);
}

.send-btn {
    background: var(--chat-primary);
    border: none;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05) rotate(-5deg);
    box-shadow: 0 5px 15px rgba(67, 181, 129, 0.3);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: black;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .lumin-chat-widget {
        bottom: 20px;
        right: 20px;
    }

    .chat-window {
        width: calc(100vw - 40px);
        height: 80vh;
        bottom: 80px;
    }
}