/* ===== ویجت چت آنلاین سایت ===== */
.webchat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 999;
    border: none;
    box-shadow: 0 4px 20px rgba(108,60,225,0.5);
    transition: var(--transition);
}

.webchat-bubble:hover {
    transform: translateY(-5px);
}

.webchat-bubble .webchat-unread-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid var(--dark-bg, #0a0a1a);
    display: none;
}

.webchat-bubble.has-unread .webchat-unread-dot {
    display: block;
}

.webchat-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 460px;
    max-height: calc(100vh - 140px);
    background: rgba(10,10,26,0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.webchat-panel.open {
    display: flex;
}

.webchat-header {
    background: var(--gradient-primary);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.webchat-header strong {
    font-size: 0.95rem;
}

.webchat-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}

.webchat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.webchat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
}

.webchat-msg.incoming {
    align-self: flex-end;
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #fff);
    border: 1px solid var(--glass-border);
}

.webchat-msg.outgoing {
    align-self: flex-start;
    background: var(--gradient-primary);
    color: white;
}

.webchat-prechat {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    flex: 1;
    overflow-y: auto;
}

.webchat-prechat.active {
    display: flex;
}

.webchat-prechat-intro {
    color: var(--text-secondary, #ccc);
    font-size: 0.85rem;
    margin: 0 0 4px;
}

.webchat-prechat input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-primary, #fff);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.85rem;
    outline: none;
}

.webchat-prechat input:focus {
    border-color: var(--primary);
}

.webchat-prechat-error {
    color: #ef4444;
    font-size: 0.8rem;
    min-height: 1em;
}

.webchat-prechat button {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
}

.webchat-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
}

.webchat-footer {
    padding: 10px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 8px;
}

.webchat-footer input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-primary, #fff);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.85rem;
    outline: none;
}

.webchat-footer input:focus {
    border-color: var(--primary);
}

.webchat-footer button {
    background: var(--gradient-primary);
    border: none;
    color: white;
    width: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

@media (max-width: 480px) {
    .webchat-panel {
        right: 12px;
        bottom: 90px;
        width: calc(100vw - 24px);
    }
    .webchat-bubble {
        right: 16px;
        bottom: 16px;
    }
}
