/* NeurX Bot Styles */
.neurx-bot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* 3D Sphere Bot */
.neurx-bot-sphere {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    /* No transition - using real-time volume response */
    box-shadow:
        0 10px 30px rgba(255, 107, 53, 0.4),
        inset 0 -8px 15px rgba(0, 0, 0, 0.05),
        inset 0 8px 15px rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 107, 53, 0.3);
}

.neurx-bot-sphere:hover {
    transform: scale(1.15);
    box-shadow:
        0 15px 40px rgba(255, 107, 53, 0.6),
        inset 0 -8px 15px rgba(0, 0, 0, 0.05),
        inset 0 8px 15px rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 140, 66, 0.8);
}

.neurx-bot-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-image: url('photos/neurx_bot_logo.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 50%;
    /* Logo animation removed to avoid conflicts with voice response */
}

.neurx-bot-glow {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.4) 0%, rgba(255, 140, 66, 0.2) 50%, transparent 80%);
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
    z-index: -1;
}

/* Chat Interface */
.neurx-bot-chat {
    position: absolute;
    bottom: 100px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0) translate(40px, 40px);
    transform-origin: bottom right;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 107, 53, 0.1);
}

.neurx-bot-chat.expanded {
    transform: scale(1) translate(0, 0);
    opacity: 1;
    visibility: visible;
}

.neurx-bot-header {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.neurx-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.neurx-bot-logo-small {
    width: 32px;
    height: 32px;
    background-image: url('photos/logo_white_transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.neurx-bot-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.neurx-bot-title span {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.neurx-bot-title span::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: pulse 2s infinite;
}

.neurx-bot-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.neurx-bot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.neurx-bot-messages {
    height: 340px;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.neurx-bot-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    min-width: 0; /* Allow shrinking */
}

.neurx-bot-message.user-message {
    align-self: flex-end;
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.user-message .message-content {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
}

.bot-message .message-content {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    align-self: flex-end;
}

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

/* Markdown Styling for Bot Messages */
.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3,
.bot-message .message-content h4,
.bot-message .message-content h5,
.bot-message .message-content h6 {
    color: #ff6b35;
    margin: 8px 0 4px 0;
    font-weight: 600;
}

.bot-message .message-content h1 { font-size: 18px; }
.bot-message .message-content h2 { font-size: 16px; }
.bot-message .message-content h3 { font-size: 15px; }
.bot-message .message-content h4,
.bot-message .message-content h5,
.bot-message .message-content h6 { font-size: 14px; }

.bot-message .message-content strong {
    font-weight: 600;
    color: #334155;
}

.bot-message .message-content em {
    font-style: italic;
    color: #475569;
}

.bot-message .message-content code {
    background: #e2e8f0;
    color: #1e293b;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.bot-message .message-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-all;
}

.bot-message .message-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.bot-message .message-content ul,
.bot-message .message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.bot-message .message-content li {
    margin: 2px 0;
}

.bot-message .message-content a {
    color: #ff6b35;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.bot-message .message-content a:hover {
    border-bottom-color: #ff6b35;
}

.bot-message .message-content blockquote {
    border-left: 3px solid #ff6b35;
    margin: 8px 0;
    padding: 4px 0 4px 12px;
    color: #64748b;
    font-style: italic;
}

.bot-message .message-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 12px 0;
}

.bot-message .message-content p {
    margin: 6px 0;
}

.bot-message .message-content p:first-child {
    margin-top: 0;
}

.bot-message .message-content p:last-child {
    margin-bottom: 0;
}

/* Interim Speech Recognition Messages */
.interim-message .message-content {
    background: rgba(255, 107, 53, 0.1) !important;
    border: 1px solid rgba(255, 107, 53, 0.3) !important;
    color: #ff6b35 !important;
    font-style: italic;
    font-weight: 400;
    opacity: 0.8;
}

.interim-message .message-time {
    color: #ff8c42 !important;
    font-style: italic;
    opacity: 0.7;
}

.neurx-bot-input-area {
    padding: 18px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 72px;
    box-sizing: border-box;
}


.neurx-bot-input-area input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
    height: 44px;
    box-sizing: border-box;
}

.neurx-bot-input-area input:focus {
    border-color: #ff6b35;
}

.neurx-bot-send,
.neurx-bot-mic {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.neurx-bot-send:hover,
.neurx-bot-mic:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.neurx-bot-mic.mic-active {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

.neurx-bot-mic.mic-off {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

/* Animations */
/* Float animation removed - now handled by JavaScript for smooth random movement */

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

/* Scrollbar Styling */
.neurx-bot-messages::-webkit-scrollbar {
    width: 6px;
}

.neurx-bot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.neurx-bot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.neurx-bot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    .neurx-bot-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
        position: fixed;
        z-index: 10000;
    }

    .neurx-bot-sphere {
        width: 55px;
        height: 55px;
        position: absolute;
        bottom: 0;
        right: 0;
    }

    .neurx-bot-logo {
        width: 35px;
        height: 35px;
    }

    .neurx-bot-chat {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: 20%;
        width: 100%;
        height: 80%;
        max-width: none;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transform-origin: bottom;
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    }

    .neurx-bot-chat.expanded {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .neurx-bot-header {
        padding: 20px;
        border-radius: 20px 20px 0 0;
        position: relative;
    }

    .neurx-bot-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .neurx-bot-messages {
        height: calc(100% - 160px);
        padding: 16px 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .neurx-bot-message {
        max-width: 85%;
        margin-bottom: 16px;
    }

    .message-content {
        padding: 14px 18px;
        font-size: 15px;
        line-height: 1.5;
        border-radius: 20px;
    }

    .neurx-bot-input-area {
        padding: 20px;
        border-top: 1px solid #e2e8f0;
        background: #ffffff;
        border-radius: 0;
        position: sticky;
        bottom: 0;
    }

    .neurx-bot-input-area input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px 20px;
        height: 48px;
    }

    .neurx-bot-send,
    .neurx-bot-mic {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    /* Better touch targets */
    .neurx-bot-close {
        padding: 8px;
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .neurx-bot-chat {
        top: 10%;
        height: 90%;
    }

    .neurx-bot-messages {
        height: calc(100% - 150px);
        padding: 12px 16px;
    }

    .neurx-bot-input-area {
        padding: 16px;
        gap: 10px;
    }

    .neurx-bot-input-area input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .neurx-bot-header {
        padding: 16px 20px;
    }

    .message-content {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .neurx-bot-chat {
        top: 0;
        height: 100%;
        border-radius: 0;
    }

    .neurx-bot-header {
        border-radius: 0;
    }

    .neurx-bot-messages {
        height: calc(100% - 140px);
    }
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 0;
}

.thinking-animation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.thinking-text {
    font-size: 16px;
    animation: pulse-opacity 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}