/* assets/css/chatbot.css */

:root {
    --chat-primary: var(--primary, #a855f7);
    --chat-bg: var(--bg-card, #242426);
    --chat-text: var(--text-primary, #f5f5f7);
    --chat-secondary-text: var(--text-secondary, #a1a1aa);
    --chat-border: var(--border-subtle, rgba(255, 255, 255, 0.08));
    --chat-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --chat-z-index: 9999;
}

/* Chat Toggle Button */
.fynal-chat-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-1, linear-gradient(135deg, #a855f7 0%, #c084fc 100%));
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--chat-z-index);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fynal-chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.6);
}

.fynal-chat-toggle svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.fynal-chat-toggle.active svg {
    transform: rotate(90deg);
}

/* Chat Window */
.fynal-chat-window {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 380px;
    height: 550px;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: var(--chat-z-index);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.fynal-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.fynal-chat-header {
    padding: 1.5rem;
    background: #2a2a2e;
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.fynal-chat-header .bot-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    overflow: hidden;
}

.fynal-chat-header .bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fynal-chat-header .header-info {
    flex: 1;
    min-width: 0;
}

.fynal-chat-header .header-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.fynal-chat-header .header-info span {
    font-size: 0.75rem;
    color: var(--chat-secondary-text);
}

.chat-close-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--chat-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Chat Messages Area */
.fynal-chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #1e1e22;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-msg-wrapper {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msgFadeIn 0.3s ease forwards;
}

.chat-msg-wrapper.bot {
    align-self: flex-start;
}

.chat-msg-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    align-self: flex-end;
    border: 1px solid var(--chat-border);
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-msg h1,
.chat-msg h2,
.chat-msg h3 {
    margin-top: 0.8rem;
    margin-bottom: 0.4rem;
    color: #fff;
    font-weight: 800;
}

.chat-msg h1 {
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.chat-msg h2 {
    font-size: 1.15rem;
}

.chat-msg h3 {
    font-size: 1.05rem;
    color: var(--chat-primary);
}

.chat-msg p {
    margin-bottom: 0.6rem;
}

.chat-msg p:last-child {
    margin-bottom: 0;
}

.chat-msg ul,
.chat-msg ol {
    margin-bottom: 0.8rem;
    padding-left: 1.2rem;
}

.chat-msg li {
    margin-bottom: 0.3rem;
}

.chat-msg b,
.chat-msg strong {
    color: #fff;
    font-weight: 700;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
    margin-left: 36px;
    /* Offset for avatar */
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-secondary-text);
    border-radius: 50%;
    animation: typingJump 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingJump {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Chat Input Area */
.fynal-chat-input-area {
    padding: 1.25rem;
    background: #2a2a2e;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    align-items: center;
}

.fynal-chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--chat-text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.fynal-chat-input-area input:focus {
    border-color: var(--chat-primary);
}

.fynal-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--chat-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.fynal-chat-send-btn:hover {
    transform: scale(1.05);
}

.fynal-chat-send-btn:active {
    transform: scale(0.95);
}

/* Advanced Components */
.chat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    padding: 1rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.chat-card:hover {
    transform: translateY(-5px);
    border-color: var(--chat-primary);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--chat-primary);
    margin-bottom: 8px;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--chat-secondary-text);
    margin-bottom: 12px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin: 1rem 0;
}

.feature-tag {
    background: rgba(168, 85, 247, 0.1);
    color: var(--chat-primary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.chat-cta-btn {
    display: inline-block;
    background: var(--chat-primary);
    color: white !important;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.chat-cta-btn:hover {
    background: #c084fc;
    transform: scale(1.02);
}

/* Responsive */
@media (max-width: 480px) {
    .fynal-chat-window {
        width: calc(100vw - 2rem);
        height: min(500px, 70vh);
        right: 1rem;
        bottom: 5.5rem;
    }

    .fynal-chat-toggle {
        right: 1rem;
        bottom: 1rem;
        width: 54px;
        height: 54px;
    }
}