/* ═══════════════════════════════════════════════════════════
   FLOATING AI ASSISTANT - DASHBOARD ONLY
   ═══════════════════════════════════════════════════════ */

/* Floating AI Button */
.ai-float-button {
    position: fixed !important;
    right: 1px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0;
    transition: opacity 0.6s ease;
    width: 35px;
    height: 140px;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    background: var(--grad-corona);
    border-left: 1px solid rgba(176, 232, 245, 0.3);
    border-top: 1px solid rgba(176, 232, 245, 0.3);
    border-bottom: 1px solid rgba(176, 232, 245, 0.3);
    border-right: none;
    box-shadow: -4px 0 24px rgba(74, 173, 224, 0.4);
    cursor: pointer;
    overflow: hidden;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    z-index: 9999;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 1rem 0.5rem;
}
.ai-float-button.fade-in { opacity: 1; }
.ai-float-button.panel-open { opacity: 0; transition: opacity 0.6s ease; }
.ai-float-button.panel-open.fade-in { opacity: 1; }

.ai-float-button:hover {
    width: 43px;
    box-shadow: -6px 0 32px rgba(74, 173, 224, 0.6);
}

.ai-float-button svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    writing-mode: horizontal-tb;
    transform: rotate(0);
}

.ai-bookmark-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-sm);
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Panel Wrapper - controls pointer events and visibility (v2024-02-24-2) */
.ai-panel-wrapper {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-backdrop);
    pointer-events: none;
    visibility: hidden;
}

.ai-panel-wrapper.open {
    pointer-events: auto;
    visibility: visible;
}

/* Backdrop - click outside to close */
.ai-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.ai-panel-wrapper.open .ai-backdrop {
    opacity: 1;
}

/* Slide-in Chat Panel */
.ai-chat-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -420px;
    width: 420px;
    background: rgba(10, 10, 15, 0.70);
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: -4px 0 80px rgba(0, 0, 0, 0.6),
                -4px 0 40px var(--corona-glow),
                -8px 0 20px rgba(74, 173, 224, 0.4),
                -15px 0 40px rgba(74, 173, 224, 0.2);
    animation: ai-panel-glow-breathe 4s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.ai-panel-wrapper.open .ai-chat-panel {
    right: 0 !important;
}

/* AI Panel: Full-screen on small phones */
@media (max-width: 600px) {
    .ai-chat-panel {
        width: 100vw;
        right: -100vw;
    }

    .ai-float-button.panel-open {
        right: auto;
        left: 8px;
    }
}

/* Gradient border on left edge only */
/* Gradient border on left edge */
.ai-chat-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #489E46, #2489BD, #7CC8E6);
    opacity: 1;
    z-index: 10;
}

/* Horizontal gradient line under top nav area */
.ai-chat-panel::after {
    content: '';
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #489E46, #2489BD, #7CC8E6);
    z-index: 10;
    pointer-events: none;
    box-shadow:
        0 2px 6px rgba(36, 137, 189, 0.4),
        0 3px 12px rgba(36, 137, 189, 0.15);
}

/* Chat Header */
.ai-chat-header {
    padding: var(--space-2) var(--space-3);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-base);
    font-weight: 600;
    background: var(--grad-corona);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-chat-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.ai-chat-close:hover {
    color: var(--corona-bright);
}

.ai-chat-close svg {
    width: 18px;
    height: 18px;
}

/* Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: transparent;
}

/* Individual Message */
.ai-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message.assistant .ai-message-avatar {
    background: var(--grad-corona);
}

.ai-message.user .ai-message-avatar {
    background: rgba(74, 173, 224, 0.2);
    border: 1px solid var(--border-default);
}

.ai-message-avatar svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

.ai-message-content {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(17, 17, 30, 0.6);
    border: 1px solid rgba(74, 173, 224, 0.08);
    border-radius: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.ai-message.user .ai-message-content {
    background: rgba(74, 173, 224, 0.1);
    border-color: rgba(74, 173, 224, 0.2);
}

/* Chat Input Area */
.ai-chat-input-area {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid rgba(74, 173, 224, 0.12);
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(17, 17, 30, 0.6);
    border: 1px solid var(--border-default);
    border-radius: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: 'Figtree', sans-serif;
    transition: all 0.3s var(--ease-out-expo);
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--corona);
    box-shadow: 0 0 0 3px rgba(74, 173, 224, 0.25);
    background: rgba(17, 17, 30, 0.8);
}

.ai-chat-send {
    width: 42px;
    height: 42px;
    background: var(--grad-corona);
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-out-expo);
}

.ai-chat-send:hover {
    box-shadow: 0 4px 24px rgba(74, 173, 224, 0.3);
    transform: translateY(-2px);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-send svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

/* Welcome message styling */
.ai-welcome-message {
    text-align: center;
    padding: var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.ai-welcome-message strong {
    color: var(--corona-bright);
}

/* Table sorting pulse animation */
@keyframes sortPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

