/* Neural AI Portal - Creative & Non-Traditional Design */
:root {
    --neural-primary: #FF7518;
    --neural-glass: rgba(255, 255, 255, 0.7);
    --neural-blur: 30px;
    --neural-border: rgba(255, 255, 255, 0.4);
    --neural-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.2);
}

.neural-portal {
    position: fixed;
    top: 40px;
    right: 10px;
    bottom: 40px;
    width: 420px;
    z-index: 999999;
    display: none;
    opacity: 0;
    transform: translateX(100px) scale(0.9);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.neural-portal.active {
    display: block;
    opacity: 1;
    transform: translateX(0) scale(1);
}

.portal-glass {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--neural-glass);
    backdrop-filter: blur(var(--neural-blur));
    -webkit-backdrop-filter: blur(var(--neural-blur));
    border: 1px solid var(--neural-border);
    border-radius: 40px;
    box-shadow: var(--neural-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
}

.dark-mode .portal-glass {
    background: rgba(20, 20, 20, 0.75);
    border-color: rgba(255, 255, 255, 0.1);
    --neural-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.6);
}

/* Background Animated Blobs */
.portal-bg-blobs {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: 40px;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--neural-primary);
    filter: blur(80px);
    opacity: 0.2;
    border-radius: 50%;
    animation: blobMove 15s infinite alternate;
}

.blob-1 { top: -100px; left: -100px; background: var(--neural-primary); }
.blob-2 { bottom: -100px; right: -100px; background: #FF3D00; animation-delay: -7s; }

@keyframes blobMove {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 150px) scale(1.3); }
}

/* Ultra-Minimalist Single-Line Header */
.portal-header {
    position: relative;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-brand {
    flex-direction: row;
    gap: 15px;
    align-items: center;
}

/* Sound Wave Animation */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
    width: 24px;
}

.sound-wave.small {
    height: 16px;
    width: 22px;
    gap: 2px;
    flex-shrink: 0; /* CRITICAL: Prevent shrinking */
    margin-bottom: 6px;
    background: rgba(255, 117, 24, 0.1);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode .sound-wave.small {
    background: rgba(255, 255, 255, 0.05);
}

.sound-wave.small .bar {
    width: 2px;
    background: var(--neural-primary);
}

.sound-wave .bar {
    width: 2px;
    height: 100%;
    background: var(--neural-primary);
    border-radius: 10px;
    animation: soundWave 1s ease-in-out infinite;
}

.sound-wave .bar:nth-child(1) { animation-delay: 0.1s; height: 30%; }
.sound-wave .bar:nth-child(2) { animation-delay: 0.3s; height: 60%; }
.sound-wave .bar:nth-child(3) { animation-delay: 0.5s; height: 100%; }
.sound-wave .bar:nth-child(4) { animation-delay: 0.2s; height: 70%; }
.sound-wave .bar:nth-child(5) { animation-delay: 0.4s; height: 40%; }

@keyframes soundWave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1.2); }
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.brand-text h3 {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
    color: var(--black);
    line-height: 1;
    white-space: nowrap;
}

.dark-mode .brand-text h3 { color: #fff; }

.metric-item {
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--neural-primary);
    background: rgba(255, 117, 24, 0.1);
    padding: 3px 8px;
    border-radius: 100px;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.pulse-dot {
    width: 4px;
    height: 4px;
    background: #0ACF83;
    border-radius: 50%;
}

.portal-close {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--black-40);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.portal-close:hover {
    color: var(--neural-primary);
    transform: scale(1.2);
}

/* Body - Message Mesh */
.portal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
}


.message-mesh {
    flex: 1;
    overflow-y: scroll; /* Force scroll visibility */
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Premium Scrollbar Styling */
.message-mesh::-webkit-scrollbar {
    display: none;
}

.message-mesh {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}


.neural-msg {
    max-width: 85%;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.bot-icon-small {
    width: 28px;
    height: 28px;
    background: var(--neural-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(255, 117, 24, 0.2);
}

.bot-icon-small i {
    font-size: 14px;
    color: #fff;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.neural-msg.bot { align-self: flex-start; }
.neural-msg.user { align-self: flex-end; }

.msg-bubble {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 24px;
    position: relative;
}

.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.6);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-bottom-left-radius: 4px;
}

.dark-mode .bot .msg-bubble {
    background: rgba(40, 40, 40, 0.5);
    color: #EEE;
    border-color: rgba(255, 255, 255, 0.05);
}

.user .msg-bubble {
    background: var(--neural-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 10px 25px rgba(255, 117, 24, 0.3);
}

/* Footer */
.portal-footer {
    padding: 32px;
}

.neural-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    padding: 8px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dark-mode .neural-input-wrap {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.neural-input-wrap:focus-within {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--neural-primary);
    box-shadow: 0 10px 30px rgba(255, 117, 24, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.dark-mode .neural-input-wrap:focus-within {
    background: rgba(40, 40, 40, 0.8);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.neural-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--black);
    outline: none;
    font-family: inherit;
}

.neural-input-wrap input::placeholder {
    color: var(--black-40);
    transition: opacity 0.3s;
}

.neural-input-wrap:focus-within input::placeholder {
    opacity: 0.5;
}

.dark-mode .neural-input-wrap input { color: #fff; }

.pulse-btn {
    width: 46px;
    height: 46px;
    background: #000;
    color: #fff;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
}

.pulse-btn:hover {
    transform: scale(1.05) rotate(5deg);
    background: var(--neural-primary);
    box-shadow: 0 10px 20px rgba(255, 117, 24, 0.3);
}

.pulse-btn i {
    font-size: 18px;
    transition: transform 0.3s;
}

.pulse-btn:hover i {
    transform: translate(2px, -2px);
}

/* Chat Buttons Inside Neural Bubble */
.chat-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.chat-btn {
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.8);
    color: #333 !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    text-decoration: none !important;
}

.chat-btn:hover {
    background: var(--neural-primary);
    color: #fff !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 117, 24, 0.2);
}

@media (max-width: 768px) {
    .neural-portal {
        top: 0; right: 0; bottom: 0; left: 0;
        width: 100%;
        border-radius: 0;
    }
    .portal-glass, .portal-bg-blobs { border-radius: 0; }
}
