/**
 * Voyger AI Module - Full Screen with Glassmorphism
 * Clean visual identity, full-screen experience
 */

/* ═══════════════════════════════════════════════════════════════
   CSS Variables
   ═══════════════════════════════════════════════════════════════ */
:root {
    --vai-primary: #000000;
    --vai-primary-light: #333333;
    --vai-accent: #666666;
    --vai-bg-glass: rgba(10, 10, 15, 0.85);
    --vai-panel-bg: transparent;
    --vai-glass-border: rgba(255, 255, 255, 0.08);
    --vai-text-primary: #ffffff;
    --vai-text-secondary: rgba(255, 255, 255, 0.7);
    --vai-text-muted: rgba(255, 255, 255, 0.5);
    --vai-transition: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar Button (Rail Item)
   ═══════════════════════════════════════════════════════════════ */
.vai-rail-item {
    position: relative;
}

.vai-rail-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--vai-text-primary);
    border-radius: 0 2px 2px 0;
    transition: height 0.3s var(--vai-transition);
}

.vai-rail-item.active::before,
.vai-rail-item:hover::before {
    height: 24px;
}

.vai-rail-item svg {
    width: 20px;
    height: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   Main Container - FULL SCREEN
   ═══════════════════════════════════════════════════════════════ */
.voyger-ai-container {
    position: fixed;
    top: 0;
    left: 90px;
    /* Sidebar width */
    right: 0;
    bottom: 0;
    z-index: 100001;
    /* Above Menu (100000) and Eva (99999) */
    background: #000000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s var(--vai-transition);
}

.voyger-ai-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* RippleGrid Background */
.vai-ripple-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   Overlay (for click-to-close, invisible)
   ═══════════════════════════════════════════════════════════════ */
.vai-overlay {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   Main Panel - FULL SCREEN
   ═══════════════════════════════════════════════════════════════ */
.vai-panel {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════ */
.vai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--vai-glass-border);
    background: rgba(0, 0, 0, 0.2);
}

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

.vai-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vai-header-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--vai-text-primary);
    margin: 0;
    letter-spacing: 0.3px;
}

.vai-header-title span {
    font-size: 12px;
    color: var(--vai-text-muted);
    font-weight: 400;
}

.vai-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vai-debug-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vai-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vai-debug-btn:hover {
    background: rgba(255, 200, 0, 0.15);
    border-color: rgba(255, 200, 0, 0.3);
    color: #ffc800;
}

.vai-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vai-text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vai-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--vai-text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   Chat Container
   ═══════════════════════════════════════════════════════════════ */
.vai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 60px;
    overflow: hidden;
}

/* Messages Area */
.vai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vai-messages::-webkit-scrollbar {
    width: 5px;
}

.vai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.vai-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.vai-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   Welcome Screen
   ═══════════════════════════════════════════════════════════════ */
.vai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    animation: welcome-fade-in 0.6s ease-out;
}

.vai-welcome-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--vai-text-secondary);
}

.vai-welcome h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--vai-text-primary);
    margin: 0 0 10px 0;
}

.vai-welcome p {
    font-size: 15px;
    color: var(--vai-text-muted);
    margin: 0 0 32px 0;
    max-width: 400px;
    line-height: 1.6;
}

.vai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 550px;
}

.vai-suggestion {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--vai-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vai-suggestion:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--vai-text-primary);
    transform: translateY(-2px);
}

@keyframes welcome-fade-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   Message Bubbles
   ═══════════════════════════════════════════════════════════════ */
.vai-message {
    max-width: 95%;
    padding: 18px 24px;
    border-radius: 14px;
    font-size: 16px;
    line-height: 1.75;
    word-wrap: break-word;
    animation: message-appear 0.3s ease-out;
}

.vai-message.user {
    background: rgba(255, 255, 255, 0.1);
    color: var(--vai-text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-size: 16px;
}

.vai-message.ai {
    max-width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--vai-glass-border);
    color: var(--vai-text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    font-size: 16px;
}

.vai-message.command {
    background: rgba(80, 80, 80, 0.2);
    border: 1px solid rgba(100, 100, 100, 0.3);
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    align-self: flex-start;
}

.vai-message.system {
    background: rgba(100, 100, 100, 0.2);
    border: 1px solid rgba(150, 150, 150, 0.3);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 100%;
    font-size: 13px;
}

.vai-message.error {
    background: rgba(180, 50, 50, 0.2);
    border: 1px solid rgba(200, 80, 80, 0.3);
    color: rgba(255, 180, 180, 0.9);
    align-self: flex-start;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Markdown Styling */
.vai-message.ai p {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.vai-message.ai p:last-child {
    margin-bottom: 0;
}

.vai-message.ai strong {
    color: #fff;
    font-weight: 600;
}

.vai-message.ai em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

.vai-code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px 20px;
    margin: 14px 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.vai-code-block code {
    background: none;
    padding: 0;
    color: #e0e0e0;
    font-size: 14px;
}

.vai-inline-code {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    color: #ffd885;
}

.vai-list {
    margin: 12px 0;
    padding-left: 24px;
}

.vai-list li {
    margin: 6px 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.vai-h1 {
    display: block;
    font-size: 1.8em;
    margin: 20px 0 14px 0;
    color: #fff;
    font-weight: 600;
}

.vai-h2 {
    display: block;
    font-size: 1.5em;
    margin: 18px 0 12px 0;
    color: #fff;
    font-weight: 600;
}

.vai-h3 {
    display: block;
    font-size: 1.25em;
    margin: 14px 0 8px 0;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.vai-currency {
    color: #7bed9f;
    font-weight: 600;
    font-size: 16px;
}

/* Table Styling */
.vai-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 15px;
    border-radius: 10px;
    overflow: hidden;
}

.vai-table thead {
    background: rgba(255, 255, 255, 0.1);
}

.vai-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 15px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.vai-table td {
    padding: 12px 16px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

.vai-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vai-table tbody tr:last-child td {
    border-bottom: none;
}

/* Blockquotes */
.vai-quote {
    border-left: 3px solid rgba(255, 200, 100, 0.5);
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    margin: 10px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
}

/* Horizontal Rule */
.vai-hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 16px 0;
}

/* Links */
.vai-link {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 4px 0;
}

.vai-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff !important;
}

.vai-link:visited {
    color: #ffffff !important;
}

/* Highlight */
.vai-highlight {
    background: rgba(255, 230, 100, 0.25);
    color: #ffeaa7;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Strikethrough */
.vai-message.ai del {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: line-through;
}

/* Checkboxes */
.vai-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-right: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.vai-checkbox.checked {
    background: rgba(123, 237, 159, 0.2);
    border-color: #7bed9f;
    color: #7bed9f;
}

/* Typing Indicator */
.vai-typing {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
}

.vai-typing span {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite;
}

.vai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.vai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Input Area
   ═══════════════════════════════════════════════════════════════ */
.vai-input-container {
    padding: 20px 0 32px;
}

.vai-input-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 6px;
    transition: all 0.2s ease;
}

.vai-input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

.vai-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--vai-text-primary);
    outline: none;
}

.vai-input::placeholder {
    color: var(--vai-text-muted);
}

.vai-send-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vai-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vai-send-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.02);
}

.vai-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.vai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vai-send-btn svg {
    width: 20px;
    height: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   Hide Dashboard Header when AI is active
   ═══════════════════════════════════════════════════════════════ */
body.vai-active .dashboard-header {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
    transition: all 0.3s var(--vai-transition);
}

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .voyger-ai-container {
        left: 0;
    }

    .vai-header {
        padding: 16px 20px;
    }

    .vai-chat-container {
        padding: 0 16px;
    }

    .vai-welcome h2 {
        font-size: 22px;
    }

    .vai-message {
        max-width: 90%;
    }

    .vai-suggestions {
        flex-direction: column;
        align-items: stretch;
    }

    .vai-suggestion {
        text-align: center;
    }
}

/* Sidebar collapsed state */
body.sidebar-collapsed .voyger-ai-container {
    left: 70px;
}
