/* ═══════════════════════════════════════════════════════
   Ginfomatics — Chat Widget  (Dark Navy / Blue / Cyan)
   ═══════════════════════════════════════════════════════ */

:root {
    --gfc-navy: #090e1a;
    --gfc-card: #0d1526;
    --gfc-surface: #111d35;
    --gfc-blue: #0066ff;
    --gfc-cyan: #00d4ff;
    --gfc-text: #94a3b8;
    --gfc-white: #e2e8f0;
    --gfc-border: rgba(255, 255, 255, 0.08);
    --gfc-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    --gfc-font: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --gfc-radius: 18px;
}

/* ── Container ── */
#gf-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: var(--gfc-font);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Chat Window ── */
#gf-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--gfc-navy);
    border-radius: 20px;
    border: 1px solid var(--gfc-border);
    box-shadow: var(--gfc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

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

/* ── Header ── */
#gf-header {
    background: linear-gradient(135deg, #0a1628 0%, #0d1f42 100%);
    border-bottom: 1px solid var(--gfc-border);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#gf-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#gf-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066ff 0%, #00d4ff 100%);
    border: 2px solid rgba(0, 212, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    box-shadow: 0 0 16px rgba(0, 102, 255, 0.5);
}

#gf-title {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
}

#gf-status {
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.gf-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00d4ff;
    display: inline-block;
    animation: gf-pulse 2s infinite;
    box-shadow: 0 0 6px rgba(0, 212, 255, 0.8);
}

@keyframes gf-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

#gf-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

#gf-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fff;
}

/* ── Messages Area ── */
#gf-messages {
    flex: 1;
    padding: 16px 14px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--gfc-navy);
    scroll-behavior: smooth;
}

#gf-messages::-webkit-scrollbar {
    width: 4px;
}

#gf-messages::-webkit-scrollbar-track {
    background: transparent;
}

#gf-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 255, 0.3);
    border-radius: 4px;
}

/* ── Message Wrappers ── */
.gf-msg-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
    animation: gf-fadein 0.2s ease;
}

@keyframes gf-fadein {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gf-ai,
.gf-admin {
    flex-direction: row;
}

.gf-user {
    flex-direction: row-reverse;
}

.gf-error {
    flex-direction: row;
}

.gf-av-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066ff, #0049b8);
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    box-shadow: 0 0 10px rgba(0, 102, 255, 0.4);
}

.gf-admin .gf-av-sm {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
    font-size: 12px;
}

/* ── Bubbles ── */
.gf-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: var(--gfc-radius);
    word-break: break-word;
    font-size: 13.5px;
    line-height: 1.55;
}

.gf-ai .gf-bubble {
    background: var(--gfc-surface);
    color: var(--gfc-white);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--gfc-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.gf-admin .gf-bubble {
    background: rgba(124, 58, 237, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-bottom-left-radius: 4px;
}

.gf-user .gf-bubble {
    background: linear-gradient(135deg, #0066ff, #004dd9);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.4);
}

.gf-error .gf-bubble {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-bottom-left-radius: 4px;
    font-size: 12.5px;
}

/* Timestamps */
.gf-ts {
    font-size: 10.5px;
    color: #334155;
    align-self: flex-end;
    margin-bottom: 4px;
    white-space: nowrap;
}

.gf-user .gf-ts {
    order: -1;
}

/* ── Typing Indicator ── */
#gf-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 8px;
    background: var(--gfc-navy);
}

#gf-typing-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gf-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--gfc-surface);
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--gfc-border);
}

.gf-dots span {
    width: 7px;
    height: 7px;
    background: #0066ff;
    border-radius: 50%;
    display: inline-block;
    animation: gf-bounce 1.3s infinite;
}

.gf-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.gf-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes gf-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Quick Replies ── */
#gf-quick {
    padding: 6px 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--gfc-navy);
    flex-shrink: 0;
    border-top: 1px solid var(--gfc-border);
}

.gf-qr {
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.25);
    color: #6ba3ff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--gfc-font);
    white-space: nowrap;
}

.gf-qr:hover {
    background: #0066ff;
    border-color: #0066ff;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.4);
    transform: translateY(-1px);
}

/* ── Input Footer ── */
#gf-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--gfc-border);
    background: var(--gfc-card);
    flex-shrink: 0;
}

#gf-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--gfc-border);
    border-radius: 25px;
    outline: none;
    font-size: 13.5px;
    color: var(--gfc-white);
    font-family: var(--gfc-font);
    background: var(--gfc-surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

#gf-input:focus {
    border-color: rgba(0, 102, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

#gf-input::placeholder {
    color: #334155;
}

#gf-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#gf-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0066ff, #0049b8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.5);
}

#gf-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

#gf-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.65);
}

#gf-send:disabled {
    background: #1e3a5f;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* ── Launcher Button ── */
#gf-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066ff 0%, #004dd9 100%);
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.55), 0 0 0 0 rgba(0, 102, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: gf-ring 3s 2s infinite;
}

@keyframes gf-ring {
    0% {
        box-shadow: 0 4px 20px rgba(0, 102, 255, 0.55), 0 0 0 0 rgba(0, 102, 255, 0.4);
    }

    70% {
        box-shadow: 0 4px 20px rgba(0, 102, 255, 0.55), 0 0 0 12px rgba(0, 102, 255, 0);
    }

    100% {
        box-shadow: 0 4px 20px rgba(0, 102, 255, 0.55), 0 0 0 0 rgba(0, 102, 255, 0);
    }
}

#gf-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 102, 255, 0.7);
    animation: none;
}

#gf-btn-icon {
    position: relative;
    width: 28px;
    height: 28px;
}

#gf-btn-icon svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: opacity 0.2s, transform 0.2s;
}

.gf-icon-chat {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

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

#gf-btn.gf-open .gf-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

#gf-btn.gf-open .gf-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Notification badge */
#gf-notif {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--gfc-navy);
    animation: gf-pop 0.3s ease;
}

@keyframes gf-pop {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* ── Powered By ── */
#gf-powered {
    text-align: center;
    padding: 5px 14px 7px;
    font-size: 10px;
    color: #1e293b;
    background: var(--gfc-card);
    border-top: 1px solid var(--gfc-border);
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

#gf-powered a {
    color: #0066ff;
    text-decoration: none;
    font-weight: 600;
}

#gf-powered a:hover {
    text-decoration: underline;
}

/* ── Mobile Responsive ── */
@media (max-width: 420px) {
    #gf-window {
        width: calc(100vw - 24px);
        right: 0;
        bottom: 80px;
        border-radius: 16px;
        height: 80vh;
    }

    #gf-chat {
        right: 12px;
        bottom: 12px;
    }
}