/* FloatingChatWidget — bottom-right pin со attention-grabbing CTA + chat panel. */

/* ─── Closed CTA button ─── */
.fcw-cta {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9000;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 12px 20px 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: visible;
}
.fcw-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
}
.fcw-cta-icon { font-size: 1.4rem; }

/* Pulsing ring за привлекување attention */
.fcw-cta-pulse {
    position: absolute;
    top: -4px; right: -4px; bottom: -4px; left: -4px;
    border-radius: 32px;
    border: 2px solid #6366f1;
    opacity: 0.6;
    animation: fcw-pulse 2s infinite ease-out;
    pointer-events: none;
}
@keyframes fcw-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ─── Open panel ─── */
.fcw-panel {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9000;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 520px;
    max-height: calc(100vh - 4rem);
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fcw-slide-in 0.25s ease-out;
}
@keyframes fcw-slide-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.fcw-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fcw-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fcw-header-title small {
    display: block;
    font-size: 0.7rem;
    opacity: 0.85;
}
.fcw-avatar {
    width: 36px; height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.fcw-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    width: 28px; height: 28px;
    border-radius: 50%;
    transition: background 0.15s;
}
.fcw-close:hover { background: rgba(255, 255, 255, 0.15); }

.fcw-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fafafa;
}

.fcw-greeting {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.fcw-greeting strong { font-size: 1.05rem; }
.fcw-greeting p { margin: 6px 0 4px; font-size: 0.9rem; color: #444; }
.fcw-greeting small { color: #888; font-size: 0.75rem; }

.fcw-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.fcw-bubble--user {
    align-self: flex-end;
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 4px;
}
.fcw-bubble--ai {
    align-self: flex-start;
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* Typing indicator (3 точки animation) */
.fcw-typing {
    display: flex;
    gap: 4px;
    padding: 12px;
}
.fcw-typing span {
    width: 8px; height: 8px;
    background: #888;
    border-radius: 50%;
    animation: fcw-bounce 1.2s infinite ease-in-out;
}
.fcw-typing span:nth-child(2) { animation-delay: 0.2s; }
.fcw-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fcw-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%          { transform: translateY(-6px); opacity: 1; }
}

.fcw-success {
    background: #d1fae5;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    text-align: center;
}
.fcw-success a {
    color: #047857;
    font-weight: 600;
}

.fcw-footer {
    border-top: 1px solid #e0e0e0;
    padding: 10px 12px;
    background: white;
}
.fcw-turns {
    font-size: 0.7rem;
    color: #888;
    text-align: right;
    margin-bottom: 4px;
}
.fcw-input-row {
    display: flex;
    gap: 6px;
}
.fcw-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px;
    outline: none;
    font-size: 0.9rem;
}
.fcw-input:focus { border-color: #6366f1; }
.fcw-send {
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}
.fcw-send:hover:not(:disabled) { background: #4f46e5; }
.fcw-send:disabled { opacity: 0.5; cursor: not-allowed; }

.fcw-limit-notice {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.fcw-limit-notice a { color: #92400e; font-weight: 600; }

/* Mobile responsive */
@media (max-width: 480px) {
    .fcw-panel {
        right: 0.5rem;
        bottom: 0.5rem;
        left: 0.5rem;
        width: auto;
    }
    .fcw-cta {
        right: 1rem;
        bottom: 1rem;
    }
}

/* Team picker step (Batch: chat widget bug fix + UX) */
.fcw-team-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
}
.fcw-team-btn {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}
.fcw-team-btn:hover {
    border-color: #6366f1;
    background: #f5f3ff;
    transform: translateY(-1px);
}
.fcw-team-btn .material-icons {
    color: #6366f1;
    font-size: 28px;
}

/* Error banner — inline во chat (не само toast) */
.fcw-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 4px 0;
    font-size: 0.85rem;
}
.fcw-error strong {
    color: #991b1b;
    display: block;
    margin-bottom: 4px;
}
.fcw-error p {
    margin: 4px 0;
    color: #7f1d1d;
}
.fcw-error small {
    display: block;
    margin-top: 6px;
    color: #991b1b;
    font-size: 0.75rem;
    opacity: 0.8;
}
