/* =================================================================
   🤖 AI CHATBOT - CYBERPUNK HUD REDESIGN (MATCHING IMAGE)
   Theme: High-contrast Black & Neon Red (#ff1a2d)
   Style: Geometric, Grid, HUD interface
   ================================================================= */

:root {
    --cp-white: #fff;
    --cp-red: #ff1a2d;
    /* Main Neon Red */
    --cp-bg: #050505;
    /* Deep Black */
    --cp-panel: #0a0a0a;
    /* Dark Panel */
    --cp-grid: rgba(255, 26, 45, 0.08);
    /* Faint Grid Lines */
    --cp-font: var(--font-mono);
    --chatbot-size: 80px;
}

/* =================================================================
   Floating Button (Keeping mostly same but matching red)
   ================================================================= */
.ai-chatbot-button {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: var(--chatbot-size);
    height: var(--chatbot-size);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s ease;
}

.ai-chatbot-button:hover {
    transform: translateY(-2px) scale(1.05);
}

.ai-chatbot-icon-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chatbot-icon-body {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 62%;
    height: 62%;
    object-fit: cover;
    border-radius: 50%;
    border: 1.5px solid #ff1a2d;
    z-index: 1;
    background: #000;
    box-shadow: 0 0 18px rgba(255, 26, 45, 0.7), inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.bot-glass-visor {
    position: absolute;
    top: 49%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64%;
    height: 22%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(12, 10, 18, 0.52) 55%, rgba(255, 26, 45, 0.22) 100%);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-bottom-color: rgba(255, 26, 45, 0.85);
    clip-path: polygon(8% 0%, 92% 0%, 100% 35%, 88% 100%, 58% 100%, 50% 78%, 42% 100%, 12% 100%, 0% 35%);
    box-shadow: 0 2px 10px rgba(255, 26, 45, 0.3);
}

.ai-chatbot-svg {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    filter: drop-shadow(0 0 14px rgba(255, 26, 45, 0.45));
    transition: filter 0.3s ease, transform 0.3s ease;
}

.ai-chatbot-button:hover .ai-chatbot-svg {
    filter: drop-shadow(0 0 22px rgba(255, 26, 45, 0.8));
}

.bot-hud-ring {
    transform-origin: 50px 52px;
    animation: botRingSpin 12s linear infinite;
}

.ai-chatbot-button:hover .bot-hud-ring {
    animation-duration: 4.5s;
}

.bot-eyes {
    transform-origin: 50px 54.5px;
    animation: botEyeBlink 4.2s ease-in-out infinite;
}

.ai-chatbot-tooltip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: rgba(8, 5, 10, 0.94);
    border: 1px solid rgba(255, 26, 45, 0.65);
    color: #ffffff;
    font-family: var(--cp-font, monospace);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 5px 10px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    box-shadow: 0 0 16px rgba(255, 26, 45, 0.3);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.ai-chatbot-button:hover .ai-chatbot-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@keyframes botRingSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes botEyeBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.1); }
}

.ai-chatbot-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cp-red);
    color: #000;
    font-weight: bold;
    font-size: 10px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
    z-index: 9999;
}

.ai-chatbot-button-badge.hidden {
    display: none;
}

/* =================================================================
   Chat Window - The HUD Frame
   ================================================================= */
.ai-chatbot-window {
    position: fixed;
    bottom: 110px;
    right: 22px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    z-index: 9999;

    background-color: var(--cp-bg);
    border: 1px solid var(--cp-red);

    /* The Cut Corner Shape (Top-Left cut big) */
    clip-path: polygon(20px 0,
            100% 0,
            100% 100%,
            0 100%,
            0 20px);

    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 26, 45, 0.2);
}

.ai-chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Decoration lines on frame - Optional HUD details */
.ai-chatbot-window::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    /* Corner accents */
    background:
        linear-gradient(to right, var(--cp-red) 2px, transparent 2px) 0 0,
        linear-gradient(to bottom, var(--cp-red) 2px, transparent 2px) 0 0;
    background-size: 20px 20px;
    background-repeat: no-repeat;
    opacity: 0.5;
}

/* =================================================================
   Header
   ================================================================= */
.ai-chatbot-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 26, 45, 0.3);
    background: rgba(255, 26, 45, 0.02);
    margin-top: 10px;
    /* Space for the cut corner visual */
}

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

.ai-chatbot-header-status {
    width: 8px;
    height: 8px;
    background-color: #00ff41;
    /* Cyber green dot */
    border-radius: 50%;
    box-shadow: 0 0 8px #00ff41;
}

.ai-chatbot-header-title h3 {
    margin: 0;
    color: var(--cp-red);
    font-family: var(--cp-font);
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(255, 26, 45, 0.5);
}

.ai-chatbot-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--cp-red);
    color: var(--cp-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chatbot-close-btn:hover {
    background: var(--cp-red);
    color: #000;
    box-shadow: 0 0 10px var(--cp-red);
}

.ai-chatbot-clear-history-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(255, 26, 45, 0.5);
    color: var(--cp-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.ai-chatbot-clear-history-btn:hover {
    background: rgba(255, 26, 45, 0.2);
    box-shadow: 0 0 5px var(--cp-red);
    border-color: var(--cp-red);
}

/* =================================================================
   Messages Area - The Grid
   ================================================================= */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;

    /* Cyber Grid Background */
    background-color: var(--cp-bg);
    background-image:
        linear-gradient(var(--cp-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--cp-grid) 1px, transparent 1px);
    background-size: 30px 30px;
    position: relative;
}

/* Scrollbar styling */
.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-messages::-webkit-scrollbar-track {
    background: #111;
    border-left: 1px solid #333;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--cp-red);
    border-radius: 0;
}

/* =================================================================
   Message Bubbles
   ================================================================= */
.ai-chatbot-message {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Avatar Box */
.ai-chatbot-message-avatar {
    width: 40px;
    height: 40px;
    border: 1px solid var(--cp-white);
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Corner accent on avatar */
    position: relative;
    box-shadow: 0 0 5px rgba(255, 26, 45, 0.2);
}

.ai-chatbot-message-avatar .material-symbols-outlined {
    font-size: 20px;
    color: var(--cp-red);
}

/* Message Content Box */
.ai-chatbot-message-content {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #ddd;
    font-family: var(--cp-font);
    position: relative;

    background: #0f0f0f;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);

    /* Cut corner effect for bubbles */
    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - 10px),
            calc(100% - 10px) 100%,
            0 100%);

    /* Fix overflow and wrap long words */
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
    /* Important for flex child wrapping */
}

.ai-chatbot-message.bot .ai-chatbot-message-content {
    border: 1px solid rgba(255, 26, 45, 0.3);
    background: rgba(255, 26, 45, 0.05);
    /* Slight red tint */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.ai-chatbot-message.bot .ai-chatbot-message-content::before {
    /* Top accent for bot */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--cp-red);
    border-left: 2px solid var(--cp-red);
}

.ai-chatbot-message.user .ai-chatbot-message-content {
    background: rgba(255, 255, 255, 0.08);
    /* Grey/White tint */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* =================================================================
   Typing Indicator
   ================================================================= */
.ai-chatbot-typing {
    display: flex;
    gap: 6px;
    padding: 15px;
    border: 1px solid rgba(255, 26, 45, 0.3);
    background: rgba(255, 26, 45, 0.05);
    width: fit-content;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}

.ai-chatbot-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--cp-red);
    animation: typingBlink 1.4s infinite alternate;
}

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

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

@keyframes typingBlink {
    0% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* =================================================================
   Input Area - The Bottom HUD
   ================================================================= */
.ai-chatbot-input-area {
    padding: 20px;
    background: #050505;
    border-top: 1px solid var(--cp-red);
    position: relative;
}

/* Decorative box framing the input to look like the image */
.ai-chatbot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding: 5px;
    border: 1px solid rgba(255, 26, 45, 0.5);
    /* Outer RED box */

    /* Cut corners styling for input box frame */
    clip-path: polygon(0 0,
            100% 0,
            100% 100%,
            0 100%);
    /* In the image, there's a specific bracket shape, simpler to simulate with border */
}

/* Decorative corner frames for input wrapper */
.ai-chatbot-input-wrapper::before,
.ai-chatbot-input-wrapper::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--cp-red);
    pointer-events: none;
    transition: all 0.3s;
}

/* Bottom Left Corner */
.ai-chatbot-input-wrapper::before {
    bottom: -1px;
    left: -1px;
    border-top: none;
    border-right: none;
}

/* Top Right Corner */
.ai-chatbot-input-wrapper::after {
    top: -1px;
    right: -1px;
    border-bottom: none;
    border-left: none;
}

.ai-chatbot-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--cp-font);
    font-size: 14px;
    padding: 10px 15px;
    outline: none;
    resize: none;
    height: 48px;
    /* Fixed height for single line feel, growing if needed */
    max-height: 100px;
}

.ai-chatbot-input::placeholder {
    color: #555;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.ai-chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 26, 45, 0.1);
    border: 1px solid var(--cp-red);
    color: var(--cp-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 5px;
}

.ai-chatbot-send-btn:hover:not(:disabled) {
    background: var(--cp-red);
    color: #000;
    box-shadow: 0 0 15px var(--cp-red);
}

.ai-chatbot-send-btn:disabled {
    opacity: 0.3;
    border-color: #555;
    color: #555;
    cursor: default;
}

.ai-chatbot-send-btn span {
    font-size: 20px;
}

/* =================================================================
   FLOATING PROMPT BUBBLE (Notification - Reverted to Red Tail Design)
   ================================================================= */
.ai-chatbot-float {
    position: fixed;
    right: 110px;
    bottom: 46px;
    max-width: 260px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9997;

    /* Semi-transparent background */
    background: rgba(16, 16, 20, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    /* Angled borders with tail (Cyberpunk speech bubble) */
    clip-path: polygon(10px 0, 100% 0,
            100% calc(100% - 20px),
            /* Top part of tail */
            calc(100% - 20px) calc(100% - 20px),
            100% 100%,
            /* Tip of tail */
            calc(100% - 40px) 100%,
            0 100%, 0 10px);

    /* Red border color */
    border: 1px solid rgba(255, 26, 45, 0.5);
    box-shadow: 0 0 15px rgba(255, 26, 45, 0.2);

    color: #fff;
    font-family: var(--cp-font);
    font-size: 13px;
    line-height: 1.4;

    opacity: 0;
    transform: translateY(8px) scale(.98);
    pointer-events: none;
    transition: opacity .4s ease, transform .4s ease;
}

/* Pseudo-element for the tail border/accent */
.ai-chatbot-float::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 25px;
    height: 25px;
    background: rgba(255, 26, 45, 0.2);
    clip-path: polygon(100% calc(100% - 20px), 100% 100%, calc(100% - 25px) 100%);
    pointer-events: none;
}

.ai-chatbot-float.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-chatbot-float-content {
    display: flex;
    /* Ensure layout works with old structure if needed, or remove if not used */
    gap: 12px;
    align-items: center;
    margin-bottom: 5px;
}

.ai-chatbot-float-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #ff1a2d;
    /* Neon Red */
    text-shadow: 0 0 8px rgba(255, 26, 45, 0.6);
}

.ai-chatbot-float-text {
    flex: 1;
    color: #fff;
}

.ai-chatbot-message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}