/* ============================================================
   TECNOACCESS AI — Floating Action Button (FAB)
   ============================================================ */

#aap-fab {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 99999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif !important;
}

#aap-fab .aap-fab-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a05a 0%, #b88848 100%);
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #0f0f10;
    box-shadow: 0 6px 20px rgba(212,160,90,.4), 0 2px 6px rgba(0,0,0,.2);
    transition: all .2s;
    animation: aap-fab-pulse 3s ease-in-out infinite;
    padding: 0;
}
#aap-fab .aap-fab-button:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(212,160,90,.5), 0 2px 6px rgba(0,0,0,.2);
    animation-play-state: paused;
}
#aap-fab .aap-fab-button:active {
    transform: scale(0.95);
}

#aap-fab .aap-fab-tooltip {
    position: absolute;
    right: 72px;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a1c;
    color: #ececec;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    border: 1px solid #2a2a2c;
}
#aap-fab .aap-fab-button:hover + .aap-fab-tooltip {
    opacity: 1;
}

@keyframes aap-fab-pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(212,160,90,.4), 0 2px 6px rgba(0,0,0,.2); }
    50% { box-shadow: 0 6px 28px rgba(212,160,90,.7), 0 0 0 8px rgba(212,160,90,.15); }
}

#aap-fab.minimized {
    display: none;
}

/* Mini chat panel */
#aap-fab-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 140px);
    background: #0f0f10;
    border: 1px solid #2a2a2c;
    border-radius: 16px;
    overflow: hidden;
    z-index: 99998;
    display: none;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    animation: aap-fab-panel-in .25s ease-out;
}
#aap-fab-panel.open { display: flex; }

@keyframes aap-fab-panel-in {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#aap-fab-panel .aap-fab-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(212,160,90,.1) 0%, transparent 100%);
    border-bottom: 1px solid #2a2a2c;
    display: flex;
    align-items: center;
    gap: 10px;
}
#aap-fab-panel .aap-fab-h-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d4a05a 0%, #b88848 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #0f0f10;
}
#aap-fab-panel .aap-fab-h-title {
    flex: 1;
    color: #ececec;
    font-weight: 600;
    font-size: 14px;
}
#aap-fab-panel .aap-fab-h-action {
    background: transparent;
    border: 0;
    color: #a0a0a8;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#aap-fab-panel .aap-fab-h-action:hover {
    background: #232325;
    color: #ececec;
}

#aap-fab-panel .aap-fab-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#aap-fab-panel .aap-fab-welcome {
    color: #a0a0a8;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    padding: 20px 8px;
}
#aap-fab-panel .aap-fab-welcome strong { color: #d4a05a; }

#aap-fab-panel .aap-fab-msg {
    max-width: 90%;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 12px;
    color: #ececec;
}
#aap-fab-panel .aap-fab-msg.user {
    background: #1d4ed8;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
#aap-fab-panel .aap-fab-msg.assistant {
    background: #1a1a1c;
    border: 1px solid #2a2a2c;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
#aap-fab-panel .aap-fab-msg.assistant strong { color: #d4a05a; }

#aap-fab-panel .aap-fab-msg-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2a2a2c;
    font-size: 12px;
    color: #6a6a72;
}
#aap-fab-panel .aap-fab-msg-sources a {
    color: #d4a05a;
    text-decoration: none;
    margin-right: 6px;
}

#aap-fab-panel .aap-fab-input-row {
    border-top: 1px solid #2a2a2c;
    padding: 10px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
#aap-fab-panel .aap-fab-input {
    flex: 1;
    background: #1a1a1c;
    border: 1px solid #2a2a2c;
    border-radius: 10px;
    padding: 9px 12px;
    color: #ececec;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    max-height: 100px;
    outline: 0;
}
#aap-fab-panel .aap-fab-input:focus { border-color: #d4a05a; }
#aap-fab-panel .aap-fab-send {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: #d4a05a;
    color: #0f0f10;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
}
#aap-fab-panel .aap-fab-send:disabled { opacity: .5; cursor: not-allowed; }

#aap-fab-panel .aap-fab-fullscreen {
    display: block;
    text-align: center;
    padding: 8px;
    background: rgba(212,160,90,.05);
    color: #d4a05a;
    font-size: 12px;
    text-decoration: none;
    border-top: 1px solid #2a2a2c;
}
#aap-fab-panel .aap-fab-fullscreen:hover {
    background: rgba(212,160,90,.1);
    text-decoration: none;
}

@media (max-width: 480px) {
    #aap-fab-panel {
        bottom: 90px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
    #aap-fab .aap-fab-button {
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
    #aap-fab {
        bottom: 16px !important;
        right: 16px !important;
    }
}
