/* ============================================
   Floating Chat Widget
   ============================================ */

/* FAB Toggle Button */
.fc-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #0e7490);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.45), 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    outline: none;
}

.fc-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(6, 182, 212, 0.6), 0 4px 12px rgba(0,0,0,0.4);
}

.fc-fab:active {
    transform: scale(0.95);
}

/* Icon swap */
.fc-fab .fc-icon-chat,
.fc-fab .fc-icon-close {
    position: absolute;
    font-size: 1.4rem;
    color: #fff;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fc-fab .fc-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
}

.fc-fab.open .fc-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

.fc-fab.open .fc-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Unread badge */
.fc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #020617;
    animation: fc-pulse 2s ease-in-out infinite;
    transition: opacity 0.2s ease;
}

.fc-badge.hidden { opacity: 0; pointer-events: none; }

@keyframes fc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
    50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* Chat Window */
.fc-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: 360px;
    max-height: 520px;
    background: #0d1b2e;
    border-radius: 18px;
    border: 1px solid rgba(6, 182, 212, 0.22);
    box-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 4px 16px rgba(6,182,212,0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* hidden by default */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    transform-origin: bottom right;
}

.fc-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.fc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(6,182,212,0.12), rgba(14,116,144,0.08));
    border-bottom: 1px solid rgba(6,182,212,0.15);
    flex-shrink: 0;
}

.fc-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #0e7490);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.fc-header-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #0d1b2e;
}

.fc-header-info { flex: 1; }

.fc-header-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0;
    line-height: 1.2;
}

.fc-header-status {
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 500;
    margin-top: 2px;
}

/* Messages Area */
.fc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(6,182,212,0.2) transparent;
}

/* Bubble base */
.fc-bubble {
    max-width: 82%;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.55;
    animation: fc-pop 0.22s ease-out;
}

@keyframes fc-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* AI / Agent bubble */
.fc-bubble.ai {
    background: rgba(6,182,212,0.1);
    border: 1px solid rgba(6,182,212,0.2);
    color: #cbd5e1;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

/* User bubble */
.fc-bubble.user {
    background: linear-gradient(135deg, #06b6d4, #0e7490);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing indicator */
.fc-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.55rem 0.9rem;
    background: rgba(6,182,212,0.08);
    border: 1px solid rgba(6,182,212,0.15);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: fc-pop 0.22s ease-out;
}

.fc-typing span {
    width: 7px;
    height: 7px;
    background: #22d3ee;
    border-radius: 50%;
    animation: fc-dot 1.3s ease-in-out infinite;
}

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

@keyframes fc-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* Input Row */
.fc-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid rgba(6,182,212,0.12);
    background: rgba(15,23,42,0.6);
    flex-shrink: 0;
}

.fc-input {
    flex: 1;
    background: rgba(6,182,212,0.07);
    border: 1px solid rgba(6,182,212,0.2);
    border-radius: 24px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #e2e8f0;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.fc-input::placeholder { color: #475569; }

.fc-input:focus {
    border-color: rgba(6,182,212,0.5);
    background: rgba(6,182,212,0.1);
}

.fc-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #0e7490);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fc-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(6,182,212,0.4);
}

/* ============================================
   Quick-reply chips
   ============================================ */
.fc-chips {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.25rem 0 0.5rem;
    animation: fc-pop 0.22s ease-out;
    width: 100%;
}

.fc-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(6,182,212,0.07);
    border: 1px solid rgba(6,182,212,0.22);
    border-radius: 9px;
    color: #a5f3fc;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
    font-family: inherit;
    text-align: left;
    line-height: 1.3;
    width: 100%;
}

.fc-chip .fc-chip-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.fc-chip .fc-chip-text {
    flex: 1;
}

/* Back / muted chip */
.fc-chip.fc-chip-highlight {
    border-color: rgba(245,158,11,0.45);
    color: #f59e0b;
}

.fc-chip.fc-chip-highlight:hover {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.7);
    color: #fbbf24;
}

.fc-chip.fc-chip-back {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    color: #64748b;
    font-size: 0.75rem;
    justify-content: center;
    padding: 0.38rem 0.85rem;
}

.fc-chip.fc-chip-back:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
    color: #94a3b8;
    transform: none;
}

.fc-chip:hover {
    background: rgba(6,182,212,0.16);
    border-color: rgba(6,182,212,0.45);
    transform: translateX(2px);
}

.fc-chip:active {
    transform: translateX(0);
}

/* ============================================
   Contact card
   ============================================ */
.fc-contact-card {
    background: rgba(6,182,212,0.06);
    border: 1px solid rgba(6,182,212,0.2);
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    animation: fc-pop 0.22s ease-out;
    align-self: flex-start;
    max-width: 90%;
}

.fc-contact-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    margin-bottom: 0.6rem;
}

.fc-contact-links {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fc-contact-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.15s ease;
}

.fc-contact-btn:hover {
    transform: translateX(3px);
    text-decoration: none;
}

.fc-contact-btn i {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.fc-contact-btn em {
    font-style: normal;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: auto;
}

/* WhatsApp */
.fc-wa {
    background: rgba(37,211,102,0.1);
    border: 1px solid rgba(37,211,102,0.25);
    color: #4ade80;
}

.fc-wa:hover { background: rgba(37,211,102,0.18); color: #4ade80; }

.fc-wa i { color: #25d366; }

.fc-wa em {
    background: rgba(37,211,102,0.15);
    color: #4ade80;
}

/* Telegram */
.fc-tg {
    background: rgba(42,170,226,0.1);
    border: 1px solid rgba(42,170,226,0.25);
    color: #7dd3fc;
}

.fc-tg:hover { background: rgba(42,170,226,0.18); color: #7dd3fc; }

.fc-tg i { color: #2aabe2; }

/* Mobile adjustments */
@media (max-width: 480px) {
    .fc-window {
        right: 12px;
        bottom: 90px;
        width: calc(100vw - 24px);
        max-height: 460px;
    }

    .fc-fab {
        bottom: 20px;
        right: 16px;
    }
}
