/* FZ Group Live Chat Widget */
#fz-chat-root {
    --fz-chat-accent: #4b8bf9;
    --fz-chat-accent-hover: #1c99fe;
    --fz-chat-bg: #0f1117;
    --fz-chat-surface: #1a1d27;
    --fz-chat-border: rgba(255, 255, 255, 0.08);
    --fz-chat-text: #f3f4f6;
    --fz-chat-muted: #9ca3af;
    --fz-chat-visitor: #2a3142;
    --fz-chat-admin: linear-gradient(135deg, #4b8bf9 0%, #1c99fe 100%);
    font-family: inherit;
}

.fz-chat-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.fz-chat-launcher {
    position: fixed;
    z-index: 100012;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fz-chat-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 32px rgba(249, 115, 22, 0.55);
}

.fz-chat-launcher.is-open {
    background: var(--fz-chat-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.fz-chat-launcher__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.fz-chat-launcher__icon svg {
    width: 26px;
    height: 26px;
    display: block;
    fill: currentColor;
}

.fz-chat-launcher__icon--close svg {
    width: 22px;
    height: 22px;
}

.fz-chat-launcher__icon--close {
    display: none;
}

.fz-chat-launcher.is-open .fz-chat-launcher__icon--chat {
    display: none;
}

.fz-chat-launcher.is-open .fz-chat-launcher__icon--close {
    display: inline-flex;
}

.fz-chat-panel[hidden] {
    display: none !important;
}

.fz-chat-launcher__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.fz-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + 58px + 1rem);
    z-index: 100011;
    width: min(380px, calc(100vw - 2rem));
    height: min(560px, calc(100vh - 7rem));
    background: var(--fz-chat-bg);
    border: 1px solid var(--fz-chat-border);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fzChatSlideUp 0.3s ease;
}

@keyframes fzChatSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fz-chat-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    background: var(--fz-chat-surface);
    border-bottom: 1px solid var(--fz-chat-border);
}

.fz-chat-panel__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--fz-chat-text);
}

.fz-chat-panel__brand strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
}

.fz-chat-panel__avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--fz-chat-admin);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.04em;
}

.fz-chat-panel__status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--fz-chat-muted);
}

.fz-chat-panel__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.fz-chat-panel__close {
    background: transparent;
    border: none;
    color: var(--fz-chat-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.fz-chat-panel__close:hover {
    color: var(--fz-chat-text);
    background: rgba(255, 255, 255, 0.06);
}

.fz-chat-panel__body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fz-chat-intro {
    padding: 1.25rem 1.1rem;
    color: var(--fz-chat-text);
}

.fz-chat-intro__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.fz-chat-intro__text {
    font-size: 0.875rem;
    color: var(--fz-chat-muted);
    margin-bottom: 1.1rem;
    line-height: 1.5;
}

.fz-chat-form__label {
    display: block;
    font-size: 0.75rem;
    color: var(--fz-chat-muted);
    margin-bottom: 0.35rem;
}

.fz-chat-form__input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--fz-chat-border);
    border-radius: 10px;
    background: var(--fz-chat-surface);
    color: var(--fz-chat-text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.fz-chat-form__input:focus {
    border-color: var(--fz-chat-accent);
}

.fz-chat-form__submit {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    background: var(--fz-chat-admin);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.fz-chat-form__submit:hover { opacity: 0.92; }
.fz-chat-form__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.fz-chat-wa-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(37, 211, 102, 0.35);
    color: #25d366;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s;
}

.fz-chat-wa-link:hover {
    background: rgba(37, 211, 102, 0.08);
    color: #25d366;
}

.fz-chat-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fz-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-behavior: smooth;
}

.fz-chat-messages::-webkit-scrollbar { width: 5px; }
.fz-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.fz-chat-bubble {
    max-width: 85%;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
}

.fz-chat-bubble--visitor {
    align-self: flex-end;
    background: var(--fz-chat-visitor);
    color: var(--fz-chat-text);
    border-bottom-right-radius: 4px;
}

.fz-chat-bubble--admin {
    align-self: flex-start;
    background: var(--fz-chat-admin);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.fz-chat-bubble__meta {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.68rem;
    opacity: 0.75;
}

.fz-chat-bubble__sender {
    font-weight: 600;
    font-size: 0.72rem;
    margin-bottom: 0.15rem;
    opacity: 0.9;
}

.fz-chat-panel__footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--fz-chat-border);
    background: var(--fz-chat-surface);
}

.fz-chat-compose {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.fz-chat-compose__input {
    flex: 1;
    resize: none;
    max-height: 100px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--fz-chat-border);
    border-radius: 12px;
    background: var(--fz-chat-bg);
    color: var(--fz-chat-text);
    font-size: 0.875rem;
    line-height: 1.4;
    outline: none;
}

.fz-chat-compose__input:focus {
    border-color: var(--fz-chat-accent);
}

.fz-chat-compose__send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: var(--fz-chat-admin);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.fz-chat-compose__send:hover { opacity: 0.9; }
.fz-chat-compose__send:disabled { opacity: 0.5; cursor: not-allowed; }

.fz-chat-typing {
    align-self: flex-start;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--fz-chat-muted);
    font-style: italic;
}

@media (max-width: 575px) {
    .fz-chat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: min(100vh, 100dvh);
        border-radius: 20px 20px 0 0;
    }
}

body:has(#fz-chat-panel:not([hidden])) .rn-progress-parent {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}
