/* ==========================================================================
   Arrests.org VA - Interactive AI Public Records Assistant Styles
   ========================================================================== */

/* Floating Launch Button (Capsule "Ask" Pill matching Screenshot 3) */
.va-ai-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #103159;
    color: #ffffff;
    border: 2px solid #b8754d;
    padding: 7px 18px;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 49, 89, 0.45);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.va-ai-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 18px rgba(16, 49, 89, 0.65);
    background: #0d2849;
    border-color: #cf8457;
}

.va-ai-ask-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.va-ai-ask-text {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.3px;
    line-height: 1;
}
@keyframes vaPulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.1); }
    100% { transform: scale(0.95); }
}

/* Chat Modal / Window (Strictly floating, never in page flow) */
.va-ai-window {
    display: none !important;
    position: fixed !important;
    bottom: 80px !important;
    right: 24px !important;
    width: 410px !important;
    max-width: calc(100vw - 32px) !important;
    height: 600px !important;
    max-height: calc(100vh - 120px) !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 45px rgba(9, 26, 46, 0.28), 0 8px 16px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e2e8f0 !important;
    flex-direction: column !important;
    z-index: 999999 !important;
    overflow: hidden !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    transform: scale(0.92) translateY(15px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.va-ai-window.va-ai-open {
    display: flex !important;
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.va-ai-header {
    background: linear-gradient(135deg, #091a2e 0%, #0f2d4a 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #0284c7;
    flex-shrink: 0;
}

.va-ai-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.va-ai-avatar {
    width: 38px;
    height: 38px;
    background: #0284c7;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    border: 2px solid #38bdf8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.va-ai-header-title {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
}

.va-ai-header-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 2px 0 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.va-ai-header-subtitle .status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.va-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.va-ai-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.va-ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.va-ai-header-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
}

/* Quick Topic Suggestions */
.va-ai-chips-bar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    flex-shrink: 0;
}

.va-ai-chips-bar::-webkit-scrollbar {
    display: none;
}

.va-ai-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0284c7;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.va-ai-chip:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* Message Area */
.va-ai-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f1f5f9;
}

.va-ai-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: vaMsgFade 0.25s ease-out;
}

@keyframes vaMsgFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.va-ai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.va-ai-msg-bot {
    align-self: flex-start;
}

.va-ai-msg-bubble {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}

.va-ai-msg-user .va-ai-msg-bubble {
    background: #0284c7;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.va-ai-msg-bot .va-ai-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.va-ai-msg-bot .va-ai-msg-bubble p {
    margin: 0 0 8px 0;
}

.va-ai-msg-bot .va-ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.va-ai-msg-bot .va-ai-msg-bubble ul {
    margin: 6px 0 8px 0;
    padding-left: 18px;
}

.va-ai-msg-bot .va-ai-msg-bubble li {
    margin-bottom: 4px;
}

.va-ai-msg-links {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.va-ai-msg-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.va-ai-msg-link-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

.va-ai-tts-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    transition: color 0.2s;
}

.va-ai-tts-btn:hover {
    color: #0284c7;
}

/* Voice Listening Indicator */
.va-ai-listening-indicator {
    padding: 8px 14px;
    background: #ecfdf5;
    border-top: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.82rem;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 8px;
}

.va-ai-listening-indicator.active {
    display: flex;
}

.va-ai-audio-wave {
    display: flex;
    gap: 3px;
    align-items: center;
    height: 14px;
}

.va-ai-audio-wave span {
    width: 3px;
    height: 100%;
    background: #10b981;
    border-radius: 2px;
    animation: vaWave 1s infinite ease-in-out;
}

.va-ai-audio-wave span:nth-child(2) { animation-delay: 0.2s; }
.va-ai-audio-wave span:nth-child(3) { animation-delay: 0.4s; }

@keyframes vaWave {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}

/* Chat Input Bar */
.va-ai-input-bar {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.va-ai-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 22px;
    padding: 10px 14px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    background: #f8fafc;
}

.va-ai-input:focus {
    border-color: #0284c7;
    background: #ffffff;
}

.va-ai-btn-voice {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.va-ai-btn-voice:hover {
    background: #e2e8f0;
    color: #0284c7;
}

.va-ai-btn-voice.recording {
    background: #ef4444;
    color: #ffffff;
    border-color: #dc2626;
    animation: vaPulseRecord 1.2s infinite;
}

@keyframes vaPulseRecord {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.va-ai-btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #0284c7;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.va-ai-btn-send:hover {
    background: #0369a1;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .va-ai-launcher {
        bottom: 16px;
        right: 16px;
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .va-ai-window {
        bottom: 76px;
        right: 12px;
        left: 12px;
        width: auto;
        height: calc(100vh - 100px);
        max-height: none;
        border-radius: 12px;
    }
}
/* Mobile Quick Actions FAB Styles */
@media (min-width: 769px) {
    .va-mobile-fab-container {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Hide desktop individual AI launcher and scroll-to-top on mobile */
    .va-ai-launcher {
        display: none !important;
    }
    .scroll-nav-top, .floating-scroll-nav {
        display: none !important;
    }

    .va-mobile-fab-container {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 999999;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    }

    .va-mobile-fab-trigger {
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0284c7 0%, #091a2e 100%);
        color: #ffffff;
        border: 2px solid rgba(255, 255, 255, 0.4);
        box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1.4rem;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        outline: none;
    }

    .va-mobile-fab-trigger .va-fab-trigger-close {
        display: none;
        font-size: 1.2rem;
    }

    .va-mobile-fab-container.va-active .va-mobile-fab-trigger {
        background: #091a2e;
        border-color: #38bdf8;
        transform: rotate(90deg);
    }

    .va-mobile-fab-container.va-active .va-fab-trigger-icon {
        display: none;
    }

    .va-mobile-fab-container.va-active .va-fab-trigger-close {
        display: block;
    }

    .va-mobile-fab-menu {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
        opacity: 0;
        pointer-events: none;
        transform: translateY(16px) scale(0.9);
        transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .va-mobile-fab-container.va-active .va-mobile-fab-menu {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .va-mobile-fab-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 18px;
        border-radius: 28px;
        border: 1px solid rgba(255, 255, 255, 0.25);
        cursor: pointer;
        font-size: 0.9rem;
        font-weight: 700;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
        white-space: nowrap;
        outline: none;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .va-mobile-fab-item:active {
        transform: scale(0.95);
    }

    /* Option 1: AI Assistant */
    .va-fab-ai {
        background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
        color: #ffffff;
    }

    /* Option 2: Sidebar */
    .va-fab-sidebar {
        background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
        color: #ffffff;
        border-color: #2dd4bf;
    }

    /* Option 3: Top */
    .va-fab-top {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        color: #ffffff;
        border-color: #64748b;
    }

    .va-fab-icon {
        font-size: 1.05rem;
    }

    .va-fab-text {
        font-size: 0.88rem;
    }
}

/* Desktop Dock: Scroll-to-Top Button right next to AI Assistant */
@media (min-width: 769px) {
    .scroll-nav-widget,
    .floating-scroll-nav {
        position: fixed !important;
        bottom: 24px !important;
        right: 184px !important; /* Beside AI Assistant (width ~150px + 10px margin) */
        z-index: 99998 !important;
        display: flex !important;
    }
    .scroll-nav-btn {
        width: 46px !important;
        height: 46px !important;
        border-radius: 50% !important;
        background: #091a2e !important;
        color: #ffffff !important;
        border: 2px solid #0284c7 !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .scroll-nav-btn:hover {
        background: #0284c7 !important;
        border-color: #38bdf8 !important;
        transform: translateY(-2px) scale(1.05) !important;
    }
}

@media (max-width: 768px) {
    .scroll-nav-widget,
    .floating-scroll-nav,
    .scroll-nav-btn {
        display: none !important;
    }
}


/* ==========================================================================
   Mobile Sidebar Drawer Modal & Compact Desktop Dock
   ========================================================================== */
@media (min-width: 769px) {
    .scroll-nav-widget,
    .floating-scroll-nav {
        position: fixed !important;
        bottom: 24px !important;
        right: 125px !important; /* Beside Ask capsule button */
        z-index: 99998 !important;
        display: flex !important;
    }
    .scroll-nav-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background: #091a2e !important;
        color: #ffffff !important;
        border: 2px solid #b8754d !important; background: #103159 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .scroll-nav-btn svg {
        width: 15px !important;
        height: 15px !important;
    }
}

@media (max-width: 768px) {
    /* 1. HIDE static sidebar in page flow on mobile */
    aside,
    .locality-sidebar,
    .sidebar,
    .sidebar-secondary,
    aside.sticky-sidebar,
    aside#contact-directory,
    .main-content-layout aside,
    .layout-with-sidebar aside,
        display: none !important;
    }

    /* 2. Slide-up Sidebar Drawer Modal */
    .va-sidebar-drawer-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 999999;
        background: rgba(9, 26, 46, 0.72);
        backdrop-filter: blur(4px);
        align-items: flex-end;
        justify-content: center;
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .va-sidebar-drawer-overlay.is-active {
        display: flex !important;
        opacity: 1;
    }

    .va-sidebar-drawer-box {
        width: 100%;
        max-width: 520px;
        max-height: 80vh;
        background: #ffffff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    }

    .va-sidebar-drawer-overlay.is-active .va-sidebar-drawer-box {
        transform: translateY(0);
    }

    .va-sidebar-drawer-header {
        background: linear-gradient(135deg, #091a2e 0%, #0f2d4a 100%);
        color: #ffffff;
        padding: 14px 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 2px solid #0284c7;
        flex-shrink: 0;
    }

    .va-sidebar-drawer-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 800;
        color: #ffffff;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .va-sidebar-drawer-close {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: #ffffff;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        cursor: pointer;
    }

    
    .va-sidebar-drawer-overlay aside,
    .va-sidebar-drawer-body aside {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
    }

    .va-sidebar-drawer-body {
        padding: 16px;
        overflow-y: auto;
        color: #1e293b;
        background: #f8fafc;
    }

    .va-sidebar-drawer-body .widget,
    .va-sidebar-drawer-body .sidebar-card,
    .va-sidebar-drawer-body > * {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 14px;
        margin-bottom: 14px;
    }

    .va-sidebar-drawer-body a {
        color: #0284c7;
        font-weight: 600;
        text-decoration: none;
    }
}
