/* ==========================================
   VILLAIN_OS CHAT WIDGET STYLES
   ========================================== */

   #chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: var(--font-mono, monospace);
}

/* --- THE FAB --- */
.chat-fab {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 65px;
    height: 65px;
    border-radius: 8px; /* Subtle radius */
    background-color: var(--bg-color, #050505);
    border: 2px solid var(--accent, #ff3c00);
    box-shadow: 0 0 15px rgba(255, 60, 0, 0.4);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28), box-shadow 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    z-index: 9999; /* Ensures FAB sits above the slide-out tray */
}

.chat-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 60, 0, 0.6);
}

.chat-fab img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.2) contrast(1.2);
}

/* --- THE CHAT CONTAINER --- */
.chat-container {
    position: absolute;
    bottom: 85px; /* Sits directly above the FAB */
    right: 0;
    width: 360px;
    height: 500px;
    max-height: 70vh;
    background-color: rgba(5, 5, 5, 0.98);
    border: 1px solid var(--accent, #ff3c00);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 60, 0, 0.1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(5px);
    
    /* Animation Defaults (Hidden) */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Active State */
.chat-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* --- INTERNAL UI --- */
.chat-header {
    background-color: var(--accent, #ff3c00);
    color: #000;
    padding: 10px 15px;
    font-family: var(--font-display, sans-serif);
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: #000;
    font-weight: bold;
    font-family: var(--font-mono, monospace);
    cursor: pointer;
}

.chat-close-btn:hover {
    color: #fff;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: radial-gradient(var(--grid-line, #1a1a1a) 1px, transparent 1px);
    background-size: 10px 10px;
    /* Hide native scrollbars */
    scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

/* --- MESSAGE BUBBLES --- */
.chat-msg {
    font-size: 0.8rem;
    line-height: 1.4;
    max-width: 85%;
    word-wrap: break-word;
    padding: 8px 12px;
}

.chat-msg.system {
    align-self: flex-start;
    color: var(--text-dim, #666666);
    font-size: 0.9rem;
    max-width: 100%;
}

.chat-msg.error {
    align-self: center;
    color: var(--term-alert, #ff0033);
    border-color: var(--term-alert, #ff0033);
    max-width: 100%;
}

.chat-msg.user {
    align-self: flex-end;
    color: var(--text-main, #e0e0e0);
    border-right: 2px solid var(--accent, #ff3c00);
    background: rgba(255, 60, 0, 0.05);
}

.chat-msg.villain {
    align-self: flex-start;
    color: var(--accent, #ff3c00);
    border-left: 2px solid var(--text-dim, #666666);
    background: #0a0a0a;
}

/* --- TYPING INDICATOR --- */
.typing-indicator {
    color: var(--accent, #ff3c00);
    font-style: italic;
    font-size: 0.8rem;
    align-self: flex-start;
    animation: blink 1.5s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- INPUT AREA --- */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px dashed var(--accent, #ff3c00);
    background-color: var(--bg-color, #050505);
}

.prompt-arrow {
    color: var(--accent, #ff3c00);
    margin-right: 10px;
    font-weight: bold;
}

#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main, #e0e0e0);
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    outline: none;
    text-transform: uppercase;
}
#chat-input::placeholder { color: var(--text-dim, #666666); }

.chat-transmit-btn {
    background: transparent;
    border: 1px solid var(--accent, #ff3c00);
    color: var(--accent, #ff3c00);
    padding: 5px 12px;
    font-family: var(--font-display, sans-serif);
    font-weight: bold;
    cursor: pointer;
    margin-left: 10px;
    transition: 0.2s;
}
.chat-transmit-btn:hover { background: var(--accent, #ff3c00); color: #000; }

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .chat-container { width: calc(100vw - 40px); right: -10px; }
}

/* --- THE CALLOUT --- */
#chat-callout {
    position: absolute;
    bottom: 80px; 
    right: 10px;
    background-color: var(--bg-color, #050505);
    color: var(--text-main, #e0e0e0);
    border: 1px solid var(--accent, #ff3c00);
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 8px 12px;
    z-index: 10001;
    pointer-events: none; 
    
    animation: float-bob 2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

#chat-callout::after {
    content: '';
    position: absolute;
    bottom: -6px; 
    right: 18px; 
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--accent, #ff3c00) transparent transparent transparent;
    display: block;
    width: 0;
}

.cursor-blink {
    display: inline-block;
    margin-left: 5px;
    color: var(--accent, #ff3c00);
    animation: terminal-blink 1s step-end infinite;
}

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

@keyframes terminal-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#chat-callout.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================
   FOLLOW DOOM MODULE (SLIDE-OUT)
   ========================================== */

/* Container: Horizontal Tray */
.follow-module {
    position: absolute;
    bottom: 0; 
    right: 80px; /* Anchors right next to the 65px FAB, plus 15px gap */
    height: 65px; /* Matches FAB height perfectly */
    background: rgba(5, 5, 5, 0.98);
    border: 1px solid var(--accent, #ff3c00);
    padding: 0 15px;
    display: flex;
    flex-direction: row; /* Forces horizontal layout */
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.9);
    z-index: 9998;
    
    /* Animation: Hides slightly to the right behind the FAB */
    opacity: 0;
    transform: translateX(40px); 
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Active State */
.follow-module.revealed {
    opacity: 1;
    transform: translateX(0); /* Slides smoothly into position */
    pointer-events: auto;
}

/* Inline Label */
.follow-label {
    color: var(--text-dim, #666666);
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

/* Link Button Formatting */
.follow-link {
    text-decoration: none;
    color: var(--accent, #ff3c00);
    border: 1px solid var(--accent, #ff3c00);
    padding: 6px 12px;
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

/* SVG Icon Sizing */
.social-icon {
    width: 14px;
    height: 14px;
    margin-right: 8px;
    fill: var(--accent, #ff3c00);
    transition: fill 0.2s;
}

/* Hover States */
.follow-link:hover {
    background: var(--accent, #ff3c00);
    color: #000;
    box-shadow: 0 0 10px rgba(255, 60, 0, 0.5);
}

.follow-link:hover .social-icon {
    fill: #000;
}