/* ═══════════════════════════════════════════
   Ask AI Launcher — Floating contextual widget
   ═══════════════════════════════════════════ */

/* ── Floating Launcher (collapsed FAB) ── */
.aal-launcher {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg1, #0c1620);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 999px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.aal-launcher:hover {
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: 0 16px 44px rgba(220, 38, 38, 0.18);
}
.aal-launcher.aal-hidden {
    transform: scale(0) translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.aal-icon-wrap {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, #1a0808, #2c1212);
    position: relative;
}
.aal-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(220, 38, 38, 0.4);
    animation: aalpulse 2.4s infinite;
}
@keyframes aalpulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.aal-context-text {
    padding: 0 18px 0 4px;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.25s ease, padding 0.25s ease;
}
.aal-launcher.aal-expanded-label .aal-context-text {
    max-width: 220px;
    padding: 0 18px 0 4px;
}
.aal-ctx-eyebrow {
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 8px;
    color: var(--text3, #486480);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1px;
}
.aal-ctx-main {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text, #d0e4f4);
}

/* ── Expanded Panel ── */
.aal-panel {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 501;
    width: 380px;
    max-height: min(620px, calc(100vh - 44px));
    background: var(--bg1, #0c1620);
    border: 1px solid var(--border2, rgba(255,255,255,0.13));
    border-radius: 16px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: aalPanelIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.aal-panel.aal-open {
    display: flex;
}
@keyframes aalPanelIn {
    from { opacity: 0; transform: scale(0.9) translateY(16px); }
    to { opacity: 1; transform: none; }
}

/* ── Panel Header ── */
.aal-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
    flex-shrink: 0;
}
.aal-av {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(150deg, #1a0808, #2c1212);
    border: 1px solid rgba(220, 38, 38, 0.26);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.aal-hdr-text { flex: 1; min-width: 0; }
.aal-name { font-size: 13px; font-weight: 700; }
.aal-status {
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 9px;
    color: var(--green, #00c27a);
    display: flex;
    align-items: center;
    gap: 4px;
}
.aal-status-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--green, #00c27a);
}
.aal-hdr-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.aal-icon-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: none;
    border: 1px solid var(--border, rgba(255,255,255,0.07));
    color: var(--text3, #486480);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.13s;
}
.aal-icon-btn:hover {
    color: var(--text2, #8fb0c8);
    border-color: var(--border2, rgba(255,255,255,0.13));
}

/* ── Context Strip ── */
.aal-context {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
    background: rgba(0, 0, 0, 0.2);
}
.aal-context-lbl {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text3, #486480);
    margin-bottom: 8px;
}
.aal-context-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.aal-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 10px;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--bg2, #0f1b28);
    border: 1px solid var(--border2, rgba(255,255,255,0.13));
    color: var(--text2, #8fb0c8);
}
.aal-chip b { color: var(--text, #d0e4f4); font-weight: 600; }
.aal-chip.aal-chip-page {
    background: rgba(55, 138, 221, 0.1);
    border-color: rgba(55, 138, 221, 0.26);
    color: var(--blue, #378add);
}

/* ── Body ── */
.aal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aal-empty-hint {
    font-size: 12.5px;
    color: var(--text3, #486480);
    line-height: 1.6;
    text-align: center;
    padding: 20px 8px;
}

/* ── Suggested Questions ── */
.aal-suggest-lbl {
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text3, #486480);
    margin-bottom: 8px;
}
.aal-suggest-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.aal-suggest-q {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    width: 100%;
    font-family: var(--sans, 'DM Sans', system-ui, sans-serif);
    font-size: 12.5px;
    color: var(--text2, #8fb0c8);
    background: var(--bg2, #0f1b28);
    border: 1px solid var(--border, rgba(255,255,255,0.07));
    border-radius: 9px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.14s;
}
.aal-suggest-q:hover {
    background: var(--bg3, #111f2e);
    border-color: var(--border2, rgba(255,255,255,0.13));
    color: var(--text, #d0e4f4);
}
.aal-suggest-q svg { flex-shrink: 0; color: var(--text3, #486480); }

/* ── Composer ── */
.aal-composer {
    border-top: 1px solid var(--border, rgba(255,255,255,0.07));
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.aal-input {
    flex: 1;
    background: var(--bg2, #0f1b28);
    border: 1px solid var(--border2, rgba(255,255,255,0.13));
    border-radius: 9px;
    padding: 9px 12px;
    font-family: var(--sans, 'DM Sans', system-ui, sans-serif);
    font-size: 12.5px;
    color: var(--text, #d0e4f4);
    outline: none;
    transition: border-color 0.14s;
}
.aal-input:focus { border-color: rgba(220, 38, 38, 0.4); }
.aal-input::placeholder { color: var(--text3, #486480); }

.aal-send {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--red, #dc2626);
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background 0.13s, opacity 0.13s;
}
.aal-send:hover { background: #b91c1c; }
.aal-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Full Page Link ── */
.aal-fullink {
    padding: 8px 16px 12px;
    text-align: center;
    flex-shrink: 0;
}
.aal-fullink a {
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 10px;
    color: var(--text3, #486480);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.13s;
}
.aal-fullink a:hover { color: var(--blue, #378add); }

/* ── Keyboard Hint ── */
.aal-kbd-hint {
    position: fixed;
    bottom: 82px;
    right: 22px;
    z-index: 499;
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 9px;
    color: var(--text3, #486480);
    background: var(--bg1, #0c1620);
    border: 1px solid var(--border, rgba(255,255,255,0.07));
    border-radius: 6px;
    padding: 5px 9px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.aal-kbd-hint.show { opacity: 1; }
.aal-kk {
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border2, rgba(255,255,255,0.13));
    margin: 0 1px;
}

/* ═══════════════════════════════════════
   Mobile responsive
   ═══════════════════════════════════════ */
@media (max-width: 640px) {
    .aal-launcher {
        bottom: 16px;
        right: 16px;
    }
    .aal-icon-wrap {
        width: 46px;
        height: 46px;
    }
    .aal-panel {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
        max-height: min(560px, calc(100vh - 32px));
        border-radius: 14px;
    }
    .aal-kbd-hint {
        display: none;
    }
}
