/* =========================================
   FAB MENU SYSTEM (Modern & Sleek)
   ========================================= */
:root {
    --chat-bg: #1a1a1a;
    --chat-header-bg: #252525;
    --chat-user-msg: #f5a524;
    --chat-bot-msg: #2a2a2a;
    --chat-text: #ffffff;
    --chat-text-secondary: #aaaaaa;
    --chat-accent: #f5a524;
}

.fab-container {
    position: fixed;
    bottom: 15px;
    right: 30px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Main Toggle Button */
.fab-main-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-accent), #ff8c00);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(245, 165, 36, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1042;
    position: relative;
}

.fab-main-btn:active {
    transform: scale(0.95);
}

.fab-main-btn i {
    transition: transform 0.3s ease;
}

.fab-container.active .fab-main-btn i {
    transform: rotate(135deg);
}

/* Menu Items Container */
.fab-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

/* Individual Items */
.fab-item {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--chat-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    
    /* Animation States */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.fab-item:hover {
    background-color: var(--chat-accent);
    color: #fff;
    transform: scale(1.1) translateY(0);
}

.fab-container.active .fab-menu .fab-item {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* =========================================
   SYSTEM TUTORIAL (Floating & Contextual)
   ========================================= */
.system-tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* El blur es pesado en móviles, lo quitamos o reducimos */
    backdrop-filter: none; 
    -webkit-backdrop-filter: none;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    pointer-events: auto;
}

/* Estado de la web durante el tutorial */
body.tutorial-active #fab-container {
    z-index: 3001 !important; /* El FAB por encima del overlay */
}

.system-tutorial-overlay.active {
    opacity: 1;
    visibility: visible;
}

.system-tutorial-card {
    position: fixed;
    width: 280px;
    background: #121212;
    border: 1px solid rgba(245, 165, 36, 0.5);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9);
    z-index: 3005;
    pointer-events: auto;
    /* Optimización de rendimiento */
    will-change: transform, opacity, top, left;
    contain: content;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* Arrow Base */
.system-tutorial-card::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #121212;
    border-right: 1px solid rgba(245, 165, 36, 0.4);
    border-bottom: 1px solid rgba(245, 165, 36, 0.4);
    z-index: 1;
}

/* Tutorial Signal Line (The red arrow in your image) */
.tutorial-signal-line {
    position: fixed;
    height: 2px;
    background: linear-gradient(90deg, #f5a524, #ff8c00);
    z-index: 3000;
    pointer-events: none;
    transform-origin: left center;
    box-shadow: 0 0 10px rgba(245, 165, 36, 0.5);
    display: none;
}

.tutorial-signal-line::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -4px;
    border-left: 8px solid #ff8c00;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.tutorial-signal-line.active {
    display: block;
}

/* Arrow on Right (points to the right, card is on the left) */
.system-tutorial-card.arrow-right::after {
    transform: rotate(-45deg);
    right: -8px;
    top: var(--arrow-top, 50%);
    margin-top: -7px;
}

/* Arrow on Left (points to the left, card is on the right) */
.system-tutorial-card.arrow-left::after {
    transform: rotate(135deg);
    left: -8px;
    top: var(--arrow-top, 50%);
    margin-top: -7px;
}

/* Arrow on Bottom (points down, card is above) */
.system-tutorial-card.arrow-bottom::after {
    transform: rotate(45deg);
    bottom: -8px;
    left: var(--arrow-left, 50%);
    margin-left: -7px;
}

/* Arrow on Top (points up, card is below) */
.system-tutorial-card.arrow-top::after {
    transform: rotate(-135deg);
    top: -8px;
    left: var(--arrow-left, 50%);
    margin-left: -7px;
}

.system-tutorial-header {
    padding: 12px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.system-badge {
    background: linear-gradient(135deg, #f5a524 0%, #ff8c00 100%);
    color: #000;
    font-weight: 800;
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.system-tutorial-body {
    padding: 0 16px 16px;
}

.system-tutorial-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-tutorial-title i {
    color: #f5a524;
    font-size: 0.9rem;
}

.system-tutorial-desc {
    color: #a0a0a0;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0;
}

.system-step-indicator {
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    margin: 12px 0 0;
}

.step-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.step-dot.active {
    width: 12px;
    border-radius: 2px;
    background: #f5a524;
}

.system-tutorial-footer {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    gap: 8px;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.system-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.system-btn-skip {
    background: transparent;
    color: #666;
}

.system-btn-skip:hover {
    color: #fff;
}

.system-btn-next {
    background: #f5a524;
    color: #000;
}

/* Tutorial Highlight Reforzado */
.tutorial-highlight {
    z-index: 3002 !important;
    outline: 4px solid #f5a524 !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 30px #f5a524 !important;
    pointer-events: auto !important; /* Permitir interacción con el botón resaltado */
}

/* Parent elevation for tutorial context */
.tutorial-highlight-parent {
    z-index: 2999 !important; /* El contenedor FAB también debe subir */
}

#fab-container.active .fab-menu .fab-item.tutorial-highlight {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important; /* Static scale for performance */
}

@media (max-width: 768px) {
    .system-tutorial-card {
        width: 260px;
    }
}

/* Staggered Delay */
.fab-container.active .fab-menu .fab-item:nth-child(1) { transition-delay: 0.1s; }
.fab-container.active .fab-menu .fab-item:nth-child(2) { transition-delay: 0.15s; }
.fab-container.active .fab-menu .fab-item:nth-child(3) { transition-delay: 0.2s; }

/* =========================================
   CHATBOT WINDOW - PRO DESIGN
   ========================================= */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 480px; /* Wider for laptop */
    height: 700px; /* Increased height as requested */
    max-height: 82vh; 
    background: #121212; 
    background: linear-gradient(165deg, rgba(26,26,26,0.98) 0%, rgba(13,13,13,0.98) 100%);
    backdrop-filter: blur(12px); 
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    
    /* Animation */
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(15px);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: 10;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chatbot-icon-box {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.chatbot-icon-box svg {
    filter: drop-shadow(0 0 5px rgba(245, 165, 36, 0.4));
}

.chatbot-header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.chatbot-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.2;
    display: flex;
    align-items: center;
}

.chatbot-beta-tag {
    font-size: 0.6rem;
    background: linear-gradient(45deg, var(--chat-accent), #ff8c00);
    color: #121212;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(245, 165, 36, 0.4);
    position: relative;
    top: -1px;
}

.chatbot-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
}

.chatbot-subtitle {
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.65rem;
    font-weight: 700;
}

.status-separator {
    color: #444;
    font-size: 0.6rem;
}

.connection-status {
    position: relative;
    padding-left: 10px;
    font-weight: 600;
    transition: color 0.3s;
}

.connection-status::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

/* Status Colors */
.status-online { color: #00e676; }
.status-online::before { background-color: #00e676; box-shadow: 0 0 8px rgba(0, 230, 118, 0.4); }

.status-unstable { color: #ffb300; }
.status-unstable::before { background-color: #ffb300; box-shadow: 0 0 8px rgba(255, 179, 0, 0.4); }

.status-offline { color: #ff5252; }
.status-offline::before { background-color: #ff5252; box-shadow: 0 0 8px rgba(255, 82, 82, 0.4); }


/* Header Controls */
.chatbot-header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.header-ctrl-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: rotate(15deg);
}

.header-ctrl-btn.close-mode:hover {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
    border-color: rgba(255, 82, 82, 0.3);
    transform: scale(1.1);
}

.chatbot-controls i {
    /* Removed old styles */
    display: none;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 60%);
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* Message Groups (Avatar + Name + Bubble) */
.message-group {
    display: flex;
    align-items: flex-start; /* Aligns avatar with top (name) */
    gap: 12px;
    max-width: 85%; /* Slightly reduced for cleaner look */
    margin-bottom: 5px;
}

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

.message-group.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-top: 0px; /* Aligned with top */
}

.message-avatar:hover {
    border-color: var(--chat-accent);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(245, 165, 36, 0.4);
}

.message-avatar.bot-icon {
    background: linear-gradient(135deg, #333, #111);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-accent);
    font-size: 1.1rem;
}

.message-avatar.user-icon {
    background-color: var(--chat-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 800;
    font-size: 1.1rem;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Prevents overflow issues */
}

.message-name {
    font-size: 0.7rem; /* Smaller text */
    color: #ccc;
    font-weight: 600;
    margin-bottom: 2px; /* Reduced space */
    margin-left: 2px; /* Indent bot name inwards */
    padding: 2px 10px;
    background: rgba(20, 20, 20, 0.6); /* Badge background */
    border: 1px solid rgba(255,255,255,0.1); /* Visible border */
    border-radius: 12px;
    width: fit-content;
    line-height: 1.2;
}

.message-group.user .message-name {
    margin-left: auto; /* Push to right side flex */
    margin-right: 2px; /* Indent user name inwards */
    text-align: right;
    background: rgba(245, 165, 36, 0.1);
    border-color: rgba(245, 165, 36, 0.3);
    color: var(--chat-accent);
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px !important;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.message-group.bot .chat-bubble {
    background-color: rgba(30, 30, 30, 0.95);
    color: #f0f0f0;
    border-top-left-radius: 2px; /* Slight corner accent like in reference */
    border: 1px solid rgba(255,255,255,0.05);

    box-shadow: 0 4px 8px rgba(0,0,0,0.4); /* Stronger shadow */
}

.message-group.user .chat-bubble {
    background-color: #1e1e1e; /* Dark elegant card */
    color: #f0f0f0;
    border-top-right-radius: 2px; /* Changed from bottom-right to top-right to match bot style */
    border: 1px solid rgba(245, 165, 36, 0.4); /* Accent border */
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* Links inside bubbles */
.chat-link,
.chat-bubble a {
    color: var(--chat-accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted var(--chat-accent);
    cursor: pointer !important;
    transition: all 0.2s;
}
.chat-link:hover,
.chat-bubble a:hover {
    color: #fff;
    border-bottom: 1px solid #fff;
    text-shadow: 0 0 5px rgba(245, 165, 36, 0.5);
}
.message-group.user .chat-link {
    color: var(--chat-accent);
    border-bottom-color: var(--chat-accent);
}
.message-group.user .chat-link:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-shadow: 0 0 5px rgba(245, 165, 36, 0.5);
}

/* Recommendations Container */
.recommendations-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 5px;
}

/* Recommendations Card - Compact Design */
.chat-recommendation {
    display: flex;
    gap: 10px;
    background-color: rgba(35, 35, 35, 0.6);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
}

.chat-recommendation:hover {
    background-color: rgba(60, 60, 60, 0.8);
    transform: translateX(3px);
    border-color: rgba(245, 165, 36, 0.3);
}

.chat-rec-img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.chat-rec-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0; /* Text truncation fix */
}

.chat-rec-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #f0f0f0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-rec-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
}

.chat-rec-chapters {
    color: #aaa;
}

.chat-rec-rating {
    color: #ffc107;
    font-weight: 600;
}

/* Actions Area (Chips) */
.chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.action-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: var(--chat-accent);
    cursor: pointer;
    transition: all 0.2s;
}

.action-chip:hover {
    background: rgba(245, 165, 36, 0.15);
    border-color: var(--chat-accent);
}

/* Footer & Input */
.chatbot-footer {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Mode Switcher as Tabs */
.chatbot-modes {
    display: flex;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 12px;
}

.chatbot-mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--chat-text-secondary);
    padding: 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.chatbot-mode-btn.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.chatbot-mode-btn i {
    margin-right: 5px;
}

/* Input Container */
.chatbot-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: #2a2a2a;
    border-radius: 25px;
    padding: 5px 5px 5px 15px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: border-color 0.2s;
}

.chatbot-input-container:focus-within {
    border-color: var(--chat-accent);
}

.chatbot-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    padding-right: 10px;
}

.chatbot-send-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--chat-accent);
    border: none;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: var(--chat-bot-msg);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* Scroll to Bottom Button */
.scroll-bottom-btn {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--chat-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.scroll-bottom-btn:hover {
    background: var(--chat-accent);
    color: #121212;
    transform: translateY(-2px) scale(1.1);
}

/* Mobile optimization for Scroll Button */
@media (max-width: 767.98px) {
    .scroll-bottom-btn {
        bottom: 80px; /* Adjust for mobile footer height */
        right: 15px;
        width: 32px;
        height: 32px;
        background: #222; /* Flat color for mobile performance */
        box-shadow: none;
        backdrop-filter: none;
        transition: opacity 0.2s ease-out, transform 0.2s ease-out; /* Simpler transition */
    }
    
    .scroll-bottom-btn:hover {
        transform: none; /* No hover effect on mobile */
        background: #222;
        color: var(--chat-accent);
    }
    
    .scroll-bottom-btn:active {
        background: var(--chat-accent);
        color: #121212;
    }
}

/* =========================================
   MOBILE RESPONSIVE & PERFORMANCE OPTIMIZATION
   ========================================= */
@media (max-width: 767.98px) {
    .fab-container {
        bottom: 10px;
        right: 5px;
    }

    .chatbot-window {
        width: 100%;
        height: 100%; /* Changed from 100dvh to 100% to work with interactive-widget resize */
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        z-index: 2000;
        transform: translateY(100%);
        transition: transform 0.3s ease-out; /* Simpler transition */
        
        /* Performance: Remove expensive effects */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #121212 !important; /* Solid color, no gradient */
        box-shadow: none !important;
        border: none !important;
    }

    .chatbot-window.active {
        transform: translateY(0);
    }

    .chatbot-header {
        padding-top: max(15px, env(safe-area-inset-top));
        /* Performance */
        background: #1a1a1a !important;
        backdrop-filter: none !important;
        border-bottom: 1px solid #333;
    }

    .chatbot-footer {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        /* Performance */
        background: #1a1a1a !important;
        backdrop-filter: none !important;
        border-top: 1px solid #333;
    }
    
    .message-group {
        max-width: 90%;
    }

    /* Reduce rendering cost for lists */
    .chatbot-messages {
        background-image: none !important; /* Remove gradient bg */
        background-color: #121212;
    }

    /* Simplify FAB items */
    .fab-item {
        backdrop-filter: none !important;
        background-color: #222 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important; /* Smaller shadow */
    }

    /* Disable hover animations that cause lag/sticky issues */
    .chat-recommendation:hover,
    .action-chip:hover,
    .header-ctrl-btn:hover,
    .message-avatar:hover,
    .fab-item:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    /* Active states for touch feedback */
    .action-chip:active {
        background-color: rgba(245, 165, 36, 0.2) !important;
    }

    .chat-recommendation:active {
        background-color: #2a2a2a !important;
    }

    /* Extra Low-End Optimization: Remove remaining shadows */
    .message-avatar,
    .chat-bubble,
    .fab-main-btn {
        box-shadow: none !important;
    }
}
