/* fruitlive-assistant.css - FruitLive Guide FAB (z-1210) and rail (z-1220) */

/* --- FAB -------------------------------------------------------------- */
.fl-agent-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1210;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--phoenix-primary, #0077b6);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    padding: 0;
    overflow: hidden;
}

.fl-agent-fab:hover {
    transform: scale(1.09);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
}

.fl-agent-fab:focus-visible {
    outline: 3px solid var(--theme-accent, #90e0ef);
    outline-offset: 3px;
}

.fl-agent-fab svg,
.fl-agent-fab .fas {
    width: 30px;
    height: 30px;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.fl-agent-fab .fas {
    width: auto;
    height: auto;
}

.fl-agent-fab--hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

/* --- Rail ------------------------------------------------------------- */
.fl-agent-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1220;
    width: 340px;
    max-width: 560px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background: var(--phoenix-card-bg, #fff);
    border-left: 1px solid var(--phoenix-border-color, #e2e8f0);
    box-shadow: -4px 0 28px rgba(0, 0, 0, 0.13);
    transform: translateX(110%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.fl-agent-rail.fl-agent-open {
    transform: translateX(0);
}

@media (max-width: 575px) {
    .fl-agent-rail {
        width: 100vw !important;
        min-width: unset;
        max-width: unset;
    }
}

/* --- Resize handle ---------------------------------------------------- */
.fl-agent-resize {
    position: absolute;
    top: 0;
    left: -3px;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 1;
    border-radius: 3px;
    transition: background 0.15s;
}

.fl-agent-resize:hover {
    background: var(--phoenix-primary, #0077b6);
    opacity: 0.2;
}

/* --- Header ----------------------------------------------------------- */
.fl-agent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--phoenix-border-color, #e2e8f0);
    flex-shrink: 0;
}

.fl-agent-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--phoenix-text-color, #1f2937);
}

.fl-agent-header-icon {
    width: 28px;
    height: 28px;
    color: var(--phoenix-primary, #0077b6);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.fl-agent-header-icon svg,
.fl-agent-header-icon .fas {
    width: 100%;
    height: 100%;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fl-agent-header-icon .fas {
    width: auto;
    height: auto;
}

.fl-agent-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--phoenix-text-color, #6b7280);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.fl-agent-close-btn:hover {
    background: var(--phoenix-light, #f3f4f6);
}

/* --- Thread ----------------------------------------------------------- */
.fl-agent-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Welcome block */
.fl-agent-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 18px 8px 6px;
}

.fl-agent-welcome-svg {
    width: 58px;
    height: 58px;
    color: var(--phoenix-primary, #0077b6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fl-agent-welcome-svg svg,
.fl-agent-welcome-svg .fas {
    width: 100%;
    height: 100%;
    font-size: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fl-agent-welcome-svg .fas {
    width: auto;
    height: auto;
}

.fl-agent-welcome-text {
    font-size: 0.9rem;
    color: var(--phoenix-text-color, #374151);
    line-height: 1.55;
    margin: 0;
}

/* Example chips */
.fl-agent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}

.fl-agent-chip {
    background: var(--phoenix-light, #f3f4f6);
    border: 1px solid var(--phoenix-border-color, #e5e7eb);
    border-radius: 20px;
    padding: 4px 13px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--phoenix-primary, #0077b6);
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.fl-agent-chip:hover {
    background: var(--theme-accent, #bae6fd);
    border-color: var(--phoenix-primary, #0077b6);
}

/* Messages */
.fl-agent-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}

.fl-agent-msg--user {
    align-self: flex-end;
    background: var(--phoenix-primary, #0077b6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.fl-agent-msg--assistant {
    align-self: flex-start;
    background: var(--phoenix-light, #f3f4f6);
    color: var(--phoenix-text-color, #1f2937);
    border-bottom-left-radius: 4px;
}

.fl-agent-msg--assistant strong {
    font-weight: 600;
}

/* Citation buttons → open user guide at #anchor */
.fl-agent-citations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 100%;
    margin-top: -4px;
}

.fl-agent-citation {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--phoenix-card-bg, #fff);
    border: 1px solid var(--phoenix-border-color, #d1d5db);
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--phoenix-text-color, #1f2937);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.fl-agent-citation:hover {
    border-color: var(--phoenix-primary, #0077b6);
    background: var(--theme-accent, #bae6fd);
}

.fl-agent-citation i {
    color: var(--phoenix-primary, #0077b6);
    font-size: 0.72rem;
}

/* In-app route chips */
.fl-agent-nav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 100%;
}

.fl-agent-nav-chip {
    background: var(--phoenix-primary, #0077b6);
    border: none;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
    transition: filter 0.15s;
}

.fl-agent-nav-chip:hover {
    filter: brightness(1.08);
}

/* Typing indicator */
.fl-agent-typing {
    align-self: flex-start;
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 11px 15px;
    background: var(--phoenix-light, #f3f4f6);
    border-radius: 14px 14px 14px 4px;
}

.fl-agent-typing span {
    width: 7px;
    height: 7px;
    background: var(--phoenix-primary, #0077b6);
    border-radius: 50%;
    animation: fl-agent-bounce 1.2s infinite ease-in-out;
    opacity: 0.7;
}

.fl-agent-typing span:nth-child(2) { animation-delay: 0.2s; }
.fl-agent-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes fl-agent-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-7px); opacity: 1; }
}

/* Suggested replies after assistant message */
.fl-agent-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 100%;
}

.fl-agent-suggestion-chip {
    background: none;
    border: 1px solid var(--phoenix-primary, #0077b6);
    border-radius: 14px;
    padding: 3px 11px;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--phoenix-primary, #0077b6);
    transition: background 0.15s;
    font-family: inherit;
}

.fl-agent-suggestion-chip:hover {
    background: var(--theme-accent, #bae6fd);
}

/* --- Composer --------------------------------------------------------- */
.fl-agent-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--phoenix-border-color, #e2e8f0);
    flex-shrink: 0;
}

.fl-agent-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--phoenix-border-color, #d1d5db);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--phoenix-text-color, #1f2937);
    background: var(--phoenix-card-bg, #fff);
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.fl-agent-input:focus {
    border-color: var(--phoenix-primary, #0077b6);
}

.fl-agent-send-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--phoenix-primary, #0077b6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
}

.fl-agent-send-btn:hover {
    filter: brightness(1.1);
}

.fl-agent-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fl-agent-send-btn svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

/* --- Reduced-motion overrides ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .fl-agent-rail { transition: none; }
    .fl-agent-fab  { transition: none; }
    .fl-agent-typing span { animation: none; opacity: 0.65; }
}
