/**
 * FSAI Plugin - Widget CSS
 * Offcanvas chat panel styles (header icon + side panel)
 *
 * @author Luis
 * @copyright 2024 Mitiga
 */

/* Fix FlexyTheme MenuTemplate missing .body-wrapper-inner:
   make .body-wrapper scrollable when the inner wrapper is absent.
   Uses :not(:has()) so it does NOT apply with MitigaTheme (which provides .body-wrapper-inner). */
.body-wrapper:not(:has(.body-wrapper-inner)) {
    overflow-y: auto !important;
    height: calc(100vh - var(--header-height, 70px));
}

/* =============================================
   OFFCANVAS HEADER
   ============================================= */

.fsai-offcanvas-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fsai-offcanvas-header .offcanvas-title {
    font-weight: 600;
    font-size: 15px;
}

.fsai-offcanvas-header i {
    font-size: 16px;
}

/* =============================================
   STATUS INDICATOR (dot next to title)
   ============================================= */

.fsai-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
}

.fsai-status-indicator.active {
    background: #00e676;
    animation: fsaiPulse 2s infinite;
}

.fsai-status-indicator.idle {
    background: rgba(255, 255, 255, 0.4);
    animation: none;
}

@keyframes fsaiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* =============================================
   STATS BAR (below header)
   ============================================= */

.fsai-stats-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.fsai-stat-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    font-size: 12px;
    font-weight: 500;
}

.fsai-stat-chip i {
    font-size: 11px;
}

.fsai-stat-chip.processing { color: #0d6efd; }
.fsai-stat-chip.pending    { color: #fd7e14; }
.fsai-stat-chip.ready      { color: #198754; }
.fsai-stat-chip.failed     { color: #dc3545; }

/* Hide chips with value 0 to keep bar clean */
.fsai-stat-chip.hidden {
    display: none;
}

/* =============================================
   HEADER ICON BADGE (notification count)
   ============================================= */

#fsaiHeaderItem,
#fsaiHeaderItem .nav-link {
    overflow: visible !important;
}

#fsaiBadge {
    font-size: 0.7rem;
    padding: 2px 6px;
    min-width: 16px;
    line-height: 1.2;
}

/* =============================================
   CHAT BODY (fills offcanvas)
   ============================================= */

.fsai-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* =============================================
   CHAT TOOLBAR
   ============================================= */

.fsai-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 4px 8px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.fsai-chat-toolbar .btn-link {
    font-size: 12px;
    text-decoration: none;
}

/* =============================================
   MOBILE
   ============================================= */

@media (max-width: 576px) {
    #fsaiChatOffcanvas {
        width: 100% !important;
    }
}
